Extensions :  K-Meleon Web Browser Forum
All about K-Meleon extensions. 
Pages: Previous12
Current Page: 2 of 2
Re: Take a screenshot of an entire webpage
Posted by: siria
Date: December 12, 2020 11:33PM

I'm trying the new version now and it's really amazing. Also looking at your code, so clear and educative, love it!

While you're here (must use the extremely rare opportunity of an addon expert around, hehe), would it be very complicated to save the screenshot alternatively into clipboard, not to disk? For example, when using KM from a usb stick on a foreign computer (or simply as yet another handy code example for future own struggles without experts around ;-)

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: Kris_88
Date: December 13, 2020 12:27PM

Quote
JohnHell
and if the shift key is pressed, then the opposite of the check will happen.

Well. Updated.

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: Kris_88
Date: December 13, 2020 12:32PM

Quote
JohnHell
- the hostname shouldn't be between brackets "()"

Why not?
But you can easily extract the hostname from the file name, for example, for automatic processing.

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: Kris_88
Date: December 13, 2020 12:44PM

Quote
siria
Would it be very complicated to save the screenshot alternatively into clipboard, not to disk?

This is a bad idea because the image will be stored unpacked and will take up a lot of memory. Up to 100MB, but in fact it is two or three times more than 100. And I do not know a way to do it with minimal costs.

Maybe sometime later...

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: JohnHell
Date: December 13, 2020 05:39PM

Quote
Kris_88
Quote
JohnHell
and if the shift key is pressed, then the opposite of the check will happen.

Well. Updated.

Thanks. I didn't find at first sight. It is as preference

Quote
Kris_88
Quote
JohnHell
- the hostname shouldn't be between brackets "()"

Why not?
But you can easily extract the hostname from the file name, for example, for automatic processing.

I see your point, despite I won't automate it, to date...

I see my point that if hostname exists in filename before the first underscore "_" there is no point for them. Just my view, and to be fair, I'm not a fan of brackets in filenames

Maybe my wording, instead "shouldn't", could have been, "I don't see the point of them" winking smiley

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: Kris_88
Date: December 13, 2020 06:24PM

Quote
JohnHell
if hostname exists in filename before the first underscore "_" there is no point for them.

Of course I agree.
But dots are also replaced with underscores. And I really don't like the extra dots inside the filename.

Which option do you prefer?

(kmeleonbrowser_org)_20201213_201334.png
or
kmeleonbrowser_org_20201213_201334.png
or
kmeleonbrowser.org_20201213_201334.png
or
20201213_201334_(kmeleonbrowser_org).png
or something other?



Edited 2 time(s). Last edit at 12/13/2020 06:37PM by Kris_88.

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: JohnHell
Date: December 13, 2020 07:32PM

Quote
Kris_88
Quote
JohnHell
if hostname exists in filename before the first underscore "_" there is no point for them.

Of course I agree.
But dots are also replaced with underscores. And I really don't like the extra dots inside the filename.

Which option do you prefer?

(kmeleonbrowser_org)_20201213_201334.png
or
kmeleonbrowser_org_20201213_201334.png
or
kmeleonbrowser.org_20201213_201334.png
or
20201213_201334_(kmeleonbrowser_org).png
or something other?

I'd go for the second, then, but you are a dev and you might know what is better at OS/engine level or whatever, so if dots are a problem, if underscores at too, leave it as the first with the brackets and lets live with it smiling smiley

To give an idea of what I did with a macro for other purpose, I just got the domain. I remove the TLD and any subdomain and I dump the data to a filename like, as with this site, kmeleonbrowser_whatever.ext. And that was the first version, then I just went with spaces "kmeleonbrowser whatever.ext". But this is macro language and it accepts it, AFAIK.

You are the dev, in the end. Choose the best option smiling smiley

Or if there are more users, lets hear their opinion, not only mine smiling smiley

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: siria
Date: December 13, 2020 07:33PM

Quote
Kris_88
the image will be stored unpacked and will take up a lot of memory. Up to 100MB, but in fact it is two or three times more than 100

YIKES!! Uh oh...

Suggestion filenames, for automatic tools one could include some other marker letter for the domain end. Not sure if this letter is allowed, or whatever...
kmeleonbrowser_org_@20201213_201334.png

And finally got my own tweaks at least at beta state. Have attached an options.xul sheet for setting prefs on "about:addons", exploring all such possibilities. Please simply place it in top folder (next to install.rdf) and have a look? No entries in install.rdf needed or whatever.
Not complete by any means, for now mainly for playing and exploring.
And only tested on KMG74, no clue if still working in 76 too? Like e.g. the linebreaks in 'embedded' Help-version.

That file looks rather bloated and confusing at first, but that's only because it contains a lot of test comments and is trying to give future users examples of all methods I could find. For real use in a specific addon it can be stripped much smaller.
The additional prefs are of course not working yet, only those already existing in the addon itself.

I think such simplified Options GUI files could be a great way for self-helping users who want a prefs-GUI in whatever other addon in KM too. Just making a copy, picking which pref types they want for a specific addon (string/number/bool/color etc.), changing pref name and labels, and delete the rest.

Update v2: added note about linebreaks in description line, and fixed it in picker-remark.
And renamed pref to "addheader", acc new xpi

Update v3:
Added tooltip-example
radio buttons can be horizontal or vertical
menulist and radio can have a "selected" default value (how for string or bool?)

Added option to display folder path "full" or short ???
(had seemed to work at first, but now does nothing anymore?)



Edited 6 time(s). Last edit at 12/14/2020 12:46PM by siria.

Attachments: options_v3.xul.zip (3.3 KB)  
Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: siria
Date: December 14, 2020 02:42AM

Not meaning to request too much (already more fulfilled as ever dreamed!), just as little suggestion anyway. The 3rd title line could be saved with such a layout:

(2020-12-14) URL: http://kmeleonbrowser.org/forum/addon.php?0,module=recent_messages
TITLE: Recent Messages

Am actually embedding this on top of html-pages by macro when saving them to disk since 2-3 years. And still very happy with it. Usually don't want the time, only date. On the other hand, sometimes the time could be important too.
But personally no prob, the already existing code is a great basis for own tweaks :-)



Edited 1 time(s). Last edit at 12/14/2020 02:49AM by siria.

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: Kris_88
Date: December 16, 2020 04:32AM

Quote
siria
And finally got my own tweaks at least at beta state.

Great work siria!

But I did it differently.

Updated.

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: Kris_88
Date: December 16, 2020 02:40PM

V1.1 ready!

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: siria
Date: December 16, 2020 11:15PM

Cannot save anymore in v7+8... after picking a folder, it complains "cannot create folder" - although it exists already obviously.
And when I tried to screenshot a local page, it attempted to create a subfolder named ..."/empty/"....

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: JohnHell
Date: December 16, 2020 11:59PM

In automatic it creates that empty folder too and inside saves it.

I think we complicate it too much, how easy it was and now too much things XD

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: Kris_88
Date: December 17, 2020 12:05AM

Functions OS.File.makeDir and OS.File.writeAtomic do not work as described in KM74.
Poorly checked this point in KM74.

Corrected.

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: Kris_88
Date: December 17, 2020 12:09AM

"Empty" is by design.
Hostname is blank.
This is not a common situation.

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: Kris_88
Date: December 17, 2020 12:26AM

Quote
JohnHell
I think we complicate it too much, how easy it was and now too much things XD

This is traditional for programs... )))

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: JohnHell
Date: December 17, 2020 01:00AM

Quote
Kris_88
Quote
JohnHell
I think we complicate it too much, how easy it was and now too much things XD

This is traditional for programs... )))

smiling smiley

I prefer the KISS principle, even if I just do some macros.

I think I'll keep on previous version, unless I find a very annoying bug or a very handy feature smiling smiley

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: Kris_88
Date: December 17, 2020 01:09AM

Quote
JohnHell
I prefer the KISS principle, even if I just do some macros.
I am too.
But what if we need different capabilities?

Quote
JohnHell
I think I'll keep on previous version, unless I find a very annoying bug or a very handy feature smiling smiley
As you wish.

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: siria
Date: December 18, 2020 07:39PM

Never mind, JH always had a strong dislike of GUIs beyond ultra-minimalistic ;-)

Thanks for fixing in KM74, works again.
Those customizable filenames are handy, thanks!
Just that subfolder thing had me quite confused at the first quick test. Personally have no use for any fix subfolders, but was in a hurry. Only now got around to a second look, and then of course understood it - and more important, how to get rid of it ;-) Quite easy, thankfully. I wouldn't use it as default, prefering instead a hint in the new help text.

And still think the header font is really extremely tiny with default size 11. Your screenshot shows that you see it rather small too, though not quite as tiny as mine. I think readability is important, so IMO font size should be a pref too. I also see quite often in forums desktops-users mentioning getting probs with their eyesight.

Was surprised that you prefer splitting Reset and Settings in two buttons on about:addons, would be handier to have Reset merged into settings, instead of needing 2 clicks now...

And frankly, the selection-shot is rather awkward, taking selected text only. Would be perfect if users could simply draw a rectangle, as in FastStone Capture. After clicking the menu it shows crosslines which users can move and click start and end point. But probably a lot of work again...

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: siria
Date: December 19, 2020 12:54AM

Offtopic
Have now experimented more with JSBridge.GetActiveBrowser for other addons, and major pity sad smiley
Had hoped it could be used in KM1.6 too, but unknown there yet. And JSB.setMenuCallback unknown too yet. And JSB.registerCmd unknown too - starting to wonder what JSB can do at all there... Aside from the 'little' prob of having no clue anyway how to get ANY addon scripts running there, the few existing example addons I have all only open their own xul page.
Too bad, have an old scriptlet (from CustomButtons) modified which CAN do screenshots in KM1.6 fine, by simple macro-injectJS, BUT only allowed in chrome/about pages, normal webpages are forbidden. Always the same old prob, running against walls sad smiley
And KM74 doesn't know registerCMD yet.
Started wondering if it might be possible, as a simpler macro workaround without all that bootstrap framework stuff, to get elevated scripts into normal web pages by opening a chrome page in background, containing the script, and JSBridge.GetActiveBrowser might pick the webpage in foreground? But no luck either, the background window is the active one, oh well. If THAT had worked, it would have been a real chance for KM1.6 too, which can't seem to create any menus at all with addon-created functions. But never sure, just tapping in the dark and hoping to find something by luck ;-)

But dimly remember some addon author had created an observed pref as trigger workaround... perhaps was addneditcookies, at any rate was something with cookies... must check again... On the other hand, probably only usable in KM7x too, if KM1.6 cannot even find "GetActiveBrowser"? Or using some unknown method... getting all too complicated again :-(
Found that pref "listener" again, it's cookiekeeper! It tells the addon when to run shutdown...
http://kmeleonbrowser.org/forum/read.php?9,131507,138108#msg-138108
http://kmeleonbrowser.org/forum/read.php?9,131507
That actually created a menu too, had forgotten that, oops. But the whole addon is so extremely huge and complicated (>240 files) that I couldn't use it as example, and focused more on that pref trick.
The file ui.js seems to contain that listener stuff, and imports JSBridge as module:
Cu.import("resource:///modules/KMeleon.jsm");
KMeleon.SetMenuCallback("&Tools",.....
Services.prefs.addObserver("cookiekeeper.kmeleon.exit", ckKMeleonUI, false);



Edited 5 time(s). Last edit at 12/19/2020 02:59AM by siria.

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: Kris_88
Date: December 19, 2020 04:00AM

Quote
siria
Just that subfolder thing had me quite confused at the first quick test. Personally have no use for any fix subfolders, but was in a hurry. Only now got around to a second look, and then of course understood it - and more important, how to get rid of it ;-) Quite easy, thankfully. I wouldn't use it as default, prefering instead a hint in the new help text.

People don't read help.
They won't even know that subfolders can be used.


Quote
siria
And still think the header font is really extremely tiny with default size 11.
I even have a 10px font looks fine.
But ok, I made a setting.

Quote
siria
Was surprised that you prefer splitting Reset and Settings in two buttons on about:addons, would be handier to have Reset merged into settings, instead of needing 2 clicks now...

This is not really a reset to defaults, but a deletion of settings.
This is closer to removing the add-on than the settings.

Quote
siria
And frankly, the selection-shot is rather awkward, taking selected text only. Would be perfect if users could simply draw a rectangle, as in FastStone Capture. After clicking the menu it shows crosslines which users can move and click start and end point. But probably a lot of work again...

Pictures are selected without problems.

As to crosslines, there is a security issue and several other problems.
There is no point in messing with this now, and I don't have much time.

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: Kris_88
Date: December 19, 2020 04:00AM

Updated.

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: Kris_88
Date: December 19, 2020 04:18AM

Quote
siria
Had hoped it could be used in KM1.6 too

There is no point in fighting other people's old mistakes.
In general, the KM developers rewrote menus and toolbars, but did not provide an adequate mechanism for add-ons. But such a mechanism was in Firefox...
This discourages the desire to develop something for KM, especially for older versions.

Quote
siria
if KM1.6 cannot even find "GetActiveBrowser"? Or using some unknown method... getting all too complicated again :-(

This shouldn't really be a problem...



Edited 1 time(s). Last edit at 12/19/2020 04:20AM by Kris_88.

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: siria
Date: December 20, 2020 04:26AM

Glad there's now a working pref for font size, thanks smiling smiley A too tiny header font would really be a killer for normal users. But the hard limit of max 15 in bootstrap.js shows me again how huge the differences in physical pixel size seem to be on different monitors. I keep feeling the same font size must appear much smaller on mine as on yours! On this old notebook screen with really big pixels (28cm width, 1024px), the max size 14 looks just perfect for normal eyes now, a little smaller as a comfortable page text size. But users with real eye probs will need it a lot bigger. If they do figure out how to choose a bigger font on aboutconfig directly, the addon IMO shouldn't force-reset it to only 15 again. Perhaps a hard limit 28?

Little bug on aboutaddons page: clicking the Options button or "More..." link does nothing anymore. In the middle of options.xul the <settings> tags are missing since the rename.
While fixing typos, in settings page "embed toolbar/menu" should read "embed in...". Or perhaps better "In menu:" and "Button in toolbar:"?

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: Kris_88
Date: December 20, 2020 10:32AM

Quote
siria
Little bug on aboutaddons page: clicking the Options button or "More..." link does nothing anymore.
In the middle of options.xul the <settings> tags are missing since the rename.

What do you mean?
The "more..." and "Options" are working, tested in KM74,75,76.
One "setting" tag for two buttons. This was in previous version too.

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: siria
Date: December 20, 2020 12:39PM

Quote
Kris_88
The "more..." and "Options" are working, tested in KM74,75,76.
One "setting" tag for two buttons. This was in previous version too.

oops, you're right! Sorry. The prob was something else, NOT related to your addon. For some reason KMG74 aboutaddons page is a bit quirky on my old system, when clicking on addon details and nothing happens, I need to hit a keyboard key to wake it up. Thought I had tried that, but perhaps was in too much hurry. Incidentally, the great side effect is your 2-buttons-in-1-setting method gets them lined up horizontally, what I had tried in vain to figure out before :-)

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: Kris_88
Date: December 20, 2020 10:48PM

Quote
siria
But users with real eye probs will need it a lot bigger. If they do figure out how to choose a bigger font on aboutconfig directly, the addon IMO shouldn't force-reset it to only 15 again. Perhaps a hard limit 28?

While fixing typos, in settings page "embed toolbar/menu" should read "embed in...". Or perhaps better "In menu:" and "Button in toolbar:"?

Thank you.

Updated.

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: J.G.
Date: December 30, 2020 05:59AM

Shouldn't be added this useful addon by default to KMGoanna latest release to enhance it?
And just could be possible to modify and also to add by default other useful addons also?
(just asking, not enough skills by my side in this area) :O

Options: ReplyQuote
Re: Take a screenshot of an entire webpage
Posted by: siria
Date: December 31, 2020 12:45AM

Currently looking around for easier solutions for that ASCII-string prob with get/setCharPref()
It's hard to believe, and so far I can only test in KMG74, but looks like Mozilla really needed until Gecko55 to finally create get/setStringPref:
https://bugzilla.mozilla.org/show_bug.cgi?id=1345294

Now came across this possibility, no idea if useful here just in case:
range">Cu.import("resource://gre/modules/Preferences.jsm"

That contains ready-made functions to simply use this:
Preferences.get('my.pref.name', mydefaultvalue);
Preferences.set('my.pref.name1', 'äöü');
Preferences.set('my.pref.name2', 123);
Preferences.set('my.pref.name3', true);
The type it finds automatically by value type.

Options: ReplyQuote
Pages: Previous12
Current Page: 2 of 2


K-Meleon forum is powered by Phorum.