Extensions :  K-Meleon Forum
All about K-Meleon extensions. 
Pages: 12Next
Current Page: 1 of 2
About functions
Posted by: adodupan
Date: May 21, 2011 11:53PM

Take for example macro _example1, file abc.js and function a() inside file:

_example1{
injectJS(readfile(getfolder(MacroFolder)."\\abc.js"));
open("javascript:void(function(){a()})()");
}

You can try javascript function in a simple and fast way, just paste in URLBAR:
javascript: <code between the curly braces {}>
For example:
javascript:alert('Hello');
If everything is fine, you can use macrolanguage and injectJS() - for example:
injectJS("javascript:alert('Hello');");
javascript must be enabled!!

Is it possible to call js files, or functions inside chrome (jar files) with macros?
Answer is no!



Edited 1 time(s). Last edit at 12/23/2012 08:34AM by adodupan.

Options: ReplyQuote
Re: About functions
Posted by: disrupted
Date: May 22, 2011 12:55AM

you can't inject a js from chrome using readfile command because it's not able to read from a chrome jar-compressed folder. there's not much need for it and normally in kmeleon, the js is either coded inside the macro itself or called from a nornal file path, usually a 'scripts' folder in k-meleon's root. you can make kmeleon call a xul file inside the jar using open command that xul may call the js inside its own jar or another registered jar. the xul can be coded as simple xhtml window just to call the js but it's much easier/practical to have the js in kmeleon's root or scripts folder if its function isn't linked to a xul extension.

Options: ReplyQuote
Re: About functions
Posted by: adodupan
Date: May 22, 2011 01:43AM

Flashblock v.1.5.13



Edited 1 time(s). Last edit at 12/22/2012 12:33PM by adodupan.

Attachments: Flashblock v.1.5.13.7z (63.3 KB)  
Options: ReplyQuote
Re: About functions
Posted by: adodupan
Date: June 07, 2011 09:01PM

MOVED



Edited 1 time(s). Last edit at 07/07/2011 09:04PM by adodupan.

Attachments: win7_km16_HKCU.reg (13 KB)  
Options: ReplyQuote
Re: About functions
Posted by: adodupan
Date: September 23, 2011 03:12AM

Last week i read that Nick wants to open websites in other browsers and it fails. This is irrelevant, but sometimes it can bother users. I've tried all the extensions, but none passed my criteria. So, i wrote a universal code for easy opening websites in any browser.
With this km macro, the end user can simply add an item on the menu for every browser (the user can also easily delete any item from the menu). It is not necessary to restart km, after selecting the exe file, the item will appear in the menu.

To add items:
Tools > Open in browser > Add a new browser
To open a website you need to right click.
It is not necessary to restart km for any action.

browser.kmm v.0.4



Edited 4 time(s). Last edit at 03/15/2013 05:23AM by adodupan.

Attachments: browser v.0.4.7z (1.6 KB)  
Options: ReplyQuote
Re: About functions
Posted by: ndebord
Date: September 23, 2011 06:44AM

Quote
adodupan
Last week i read that Nick wants to open websites in other browsers and it fails. This is irrelevant, but sometimes it can bother users. I've tried all the extensions, but none passed my criteria. So, i wrote a universal code for easy opening websites in any browser. With this km macro, the end user can simply add an item on the menu for every browser (the user can also easily delete any item from the menu). It is not necessary to restart km, after selecting the exe file, the item will appear in the menu.

adodupan,

This works perfectly.... although I tried to get Alain's macro to work with Seamonkey portable, it never did work right. This one does. Very much appreciated.

Why Seamonkey was a problem and others not, I do not know. The right click macros work for Firefox, QTweb, IronPortable, IE, and Maxthon just fine. Now I have all the browsers available from within K-Meleon. (Will have to think about loading up Opera too, although that is a browser I never got used to, in terms of its quirky interface, that is.)

N

Options: ReplyQuote
Re: About functions
Posted by: John
Date: September 23, 2011 12:25PM

Quote
ndebord
Will have to think about loading up Opera too

Like there? http://kmext.sourceforge.net/ext5.htm

Options: ReplyQuote
Re: About functions
Posted by: ndebord
Date: September 23, 2011 08:30PM

Quote
John
Quote
ndebord
Will have to think about loading up Opera too

Like there? http://kmext.sourceforge.net/ext5.htm

John,

Yes or Alain's executable that does the same thing.

http://extensions.geckozone.org/K-MeleonEn#O

N

Options: ReplyQuote
Re: About functions
Posted by: jsnj
Date: September 24, 2011 02:51AM

Quote
adodupan
Last week i read that Nick wants to open websites in other browsers and it fails. This is irrelevant, but sometimes it can bother users. I've tried all the extensions, but none passed my criteria. So, i wrote a universal code for easy opening websites in any browser. With this km macro, the end user can simply add an item on the menu for every browser (the user can also easily delete any item from the menu). It is not necessary to restart km, after selecting the exe file, the item will appear in the menu.
To add items:
Tools > Open in browser > Add a new browser
To open a website you need to right click.
For developers, i suggest this code for the next update of km. The best way is to combine ie.kmm with this code.
Try this macro.

}

Nice addition. I'm curious why you chose not to use the 'Send To' menus in your _browser_03 macro.

"S&end Page To"
"S&end Link To"
"S&end Image To"
"S&end To"

Options: ReplyQuote
Re: About functions
Posted by: adodupan
Date: September 24, 2011 03:38PM

jsnj,
there is no special reason. In my km i do not have a file sendto.kmm, it is the only reason.
Now i suppose...
If you want combine file ie.kmm with this code ( or whatever ), you should have no trouble, you can use all the menus. You also can change and adapt this code any way you want.

Regards

Options: ReplyQuote
Re: About functions
Posted by: melo
Date: October 14, 2011 03:25PM

browser.kmm fails in KM 1.1.6 ! sad smiley



Edited 1 time(s). Last edit at 10/14/2011 03:26PM by melo.

Options: ReplyQuote
Re: About functions
Posted by: adodupan
Date: October 15, 2011 02:34PM

melo,
browser.kmm need a newer version of the macros.dll and function ExecMacros_List.

ExecMacros_List{
# Execute one or more macros for each item of a semicolon-separated list.
# Parameters (set before calling):
# - $ExecMacros: The macros to be executed (semicolon-separated list)
# - $List : The list to be processed ("<string1>;<string2>;...;<stringN>;" or an empty string)
# Output (for use in your macros):
# - $ListItem : The current substring <stringM>
$ListItem=$List?substr($List,0,index($List,";")):"";
while($ListItem) {
macros($ExecMacros);
$List=$List?sub($ListItem.";","",$List):"";
$ListItem=$List?substr($List,0,index($List,";")):"";
}
}

Packing for km11.
Differences: after selecting another browser, you need to restart your km.



Edited 1 time(s). Last edit at 01/06/2012 11:17PM by adodupan.

Attachments: browser_km11.7z (37.4 KB)  
Options: ReplyQuote
Re: About functions
Posted by: adodupan
Date: January 11, 2012 11:01PM

Now it is possible to set up K-Meleon as default browser without SetDefault.exe (file SetDefault.exe not needed anymore).

Tested on win2000/xp/vista/win7 (i don't have win98).

Download kmprefs.jar for km16.



Edited 1 time(s). Last edit at 01/11/2012 11:02PM by adodupan.

Attachments: kmprefs.jar (448.7 KB)   doNotTrack.7z (1.5 KB)  
Options: ReplyQuote
Re: About functions
Posted by: rodocop
Date: July 02, 2012 11:34PM

adodupan,
tell me please, what actually is changed inside kmprefs.jar?

_____________________________________
Using K-Meleon-1.6db+NS by dugbug / KM-16-S2014
1.6beta2.6 by JamesD
_____________________________________
Recommending K-Meleon Twin+`||`Discuss it!!!
_____________________________________
New KM74 for test and feedback! Get It!

Options: ReplyQuote
Re: About functions
Posted by: adodupan
Date: July 03, 2012 04:01AM

rodocop,

- changed a few lines of code in a file pref-browsing.xul,
- added a new file DefaultBrowser.js.

For more details you can compare file pref-browsing.xul with older file.

Options: ReplyQuote
Re: About functions
Posted by: rodocop
Date: July 03, 2012 05:00AM

thank you very much for your answer!

_____________________________________
Using K-Meleon-1.6db+NS by dugbug / KM-16-S2014
1.6beta2.6 by JamesD
_____________________________________
Recommending K-Meleon Twin+`||`Discuss it!!!
_____________________________________
New KM74 for test and feedback! Get It!

Options: ReplyQuote
Re: About functions
Posted by: adodupan
Date: September 04, 2012 03:06AM

AllowScript is a simple km addition for creating javascript whitelist.

EDIT: After installation, you must delete two files in the folder components (compreg.dat, xpti.dat)

Regards



Edited 1 time(s). Last edit at 09/04/2012 07:04PM by adodupan.

Options: ReplyQuote
Re: About functions
Posted by: adodupan
Date: March 10, 2013 03:22AM

Here you often discuss about User-Agent. I don't know why it takes 10-15 different UA strings, but it does not matter. Now it's possible even more, here is possibility that you create UA rules (or exceptions) for the site. This file transmits UA header of your choice, and you can create rules.
User interface requires more lines and more time. Of course, you're all invited to complete the interface.
Important:
nsUserAgent.js file reads preferences 'network.httpheaders.User-Agent.'
If you want to create a rule, for example for site http://kmeleon.sourceforge.net, and you want to send UA header Firefox 14.0.1, you need to create a pref STRING 'network.httpheaders.User-Agent.firefox' and set value:

Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20100101 Firefox/14.0.1@kmeleon.sourceforge.net

So, in the first place is ua string, then @, then hostname. Here you can put more than one page, but it is necessary to separate each, use a empty character, for example:

Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20100101 Firefox/14.0.1@kmeleon.sourceforge.net en.wikipedia.org developer.mozilla.org

Now you create a new pref, for example STRING 'network.httpheaders.User-Agent.iexplorer' etc...

nsUserAgent.js (put this file in the folder components)


Regards



Edited 1 time(s). Last edit at 10/07/2013 10:35PM by adodupan.

Attachments: nsUserAgent.js (1.8 KB)  
Options: ReplyQuote
Re: About functions
Posted by: rodocop
Date: March 10, 2013 07:44AM

adodupan,
great stuff!

But couldn't we ask you to create macro providing simple GUI for adding such strings (or assign one of predefined UA-strings to currently viewed site)?

_____________________________________
Using K-Meleon-1.6db+NS by dugbug / KM-16-S2014
1.6beta2.6 by JamesD
_____________________________________
Recommending K-Meleon Twin+`||`Discuss it!!!
_____________________________________
New KM74 for test and feedback! Get It!

Options: ReplyQuote
Re: About functions
Posted by: adodupan
Date: March 11, 2013 11:04AM

rodocop, as i already wrote, user interface file(s) requires much more lines and much more time than file nsUserAgent.js. Macrolanguage is too poor language, but it is possible. JavaScript xul is a better option.
Once again, you are all invited and welcome to complete the user interface, don't be shy :)
For macrolanguage coders, it is easy to change the way, how to read preferences in file nsUserAgent.js. Share your own code with everyone.

Best regards

Options: ReplyQuote
Re: About functions
Posted by: rodocop
Date: March 13, 2013 01:56AM

The case is only that I'm not enough capable in macrolanguage and not capable at all in JS or other languages.

KMML is the first language I've used to produce something really working but I'm too stupid to work with its GUI-handling part.

When I can I make macros by myself but not now, sorry...

_____________________________________
Using K-Meleon-1.6db+NS by dugbug / KM-16-S2014
1.6beta2.6 by JamesD
_____________________________________
Recommending K-Meleon Twin+`||`Discuss it!!!
_____________________________________
New KM74 for test and feedback! Get It!

Options: ReplyQuote
Re: About functions
Posted by: rodocop
Date: June 16, 2013 09:12AM

Oh, wise adodupan!

I need your help with nsUserAgent.js

_____________________________________
Using K-Meleon-1.6db+NS by dugbug / KM-16-S2014
1.6beta2.6 by JamesD
_____________________________________
Recommending K-Meleon Twin+`||`Discuss it!!!
_____________________________________
New KM74 for test and feedback! Get It!



Edited 2 time(s). Last edit at 06/16/2013 09:13AM by rodocop.

Options: ReplyQuote
Re: About functions
Posted by: adodupan
Date: June 19, 2013 04:48AM

Quote
rodocop
I need your help with nsUserAgent.js. Your way of setting site-specific UA-string doesn't work for me.

I've placed your js-file into 'components', deleted dat-files there, restarted KM, but my test failed - Google set by the specified preference to be handled with Firefox is shown like with KM default string...

What could be wrong? Might it be connected with unique component ID? Or what? Couldn't you clarify this?

rodocop, you're wasting your own energy for nothing. I suppose, only reason for this is,
you're in guenter's category 'We have younger ppl here at times, so...'.

I hope, maybe you'll soon enjoy the real projects :)

Anyway, here are images as a response to your request: Open As URL whoer.net

JavaScript execution enabled



JavaScript execution disabled



About 'your problematic website' i have no comment... It's your choice!

nsUserAgent.js file is small and most simply written code and for sure 'working'. If you need clarification and technical details about this code, best option for you is to visit the website https://developer.mozilla.org. Everything has already been explained.

Best regards



Edited 2 time(s). Last edit at 06/19/2013 05:50AM by adodupan.

Attachments: Clipboard01.png (52.1 KB)   Clipboard02.png (37.6 KB)  
Options: ReplyQuote
Re: About functions
Posted by: adodupan
Date: August 24, 2013 01:58AM

K-Meleon Macro Language
Plugin Commands for Macros - toolbars (explanation with examples)


    $_bChecked=pluginmsgex(toolbars,"IsButtonChecked","<ToolbarName>,<ButtonID>",INT);

## Example:
    $_Pref=getpref(STRING,"capability.policy.default.javascript.enabled");
    $_bChecked=pluginmsgex(toolbars,"IsButtonChecked","<ToolbarName>,
      macros(<MacroName>),".$_Pref,INT);
    alert($_bChecked,"Test",INFO); # - return 0 or 1

    $_bEnabled=pluginmsgex(toolbars,"IsButtonEnabled","<ToolbarName>,<ButtonID>",INT);
    pluginmsg(toolbars,"CheckButton","<ToolbarName>,<ButtonID>,[0|1]");

## Example: For pref STRING, use a variable that returns 0 or 1
    $_Pref=getpref(STRING,"capability.policy.default.javascript.enabled");
    $_Var=0;
    $_Pref=="allAccess"?$_Var=1:0;
    pluginmsg(toolbars,"CheckButton","<ToolbarName>,macros(<MacroName>),".($_Var?1:0));

    pluginmsg(toolbars,"EnableButton","<ToolbarName>,<ButtonID>,[0|1]");

## Example:
    _buttons_01{
      pluginmsg(toolbars,"AddToolbar","buttons,32,32","");
      pluginmsg(toolbars,"AddButton","buttons,,macros(_buttons_02),buttonsBtn,right-click,
        32,32,hot.bmp[0],cold.bmp[0],hot.bmp[0]");
      pluginmsg(toolbars,"AddButton","buttons,buttonA,macros(_buttons_03),buttonsBtn,right-click,
        32,32,hot.bmp[0],cold.bmp[0],hot.bmp[0]");
    }
    _buttons_02{
      $_Var==0?$_Var=1:$_Var=0;
      pluginmsg(toolbars,"EnableButton","buttons,macros(_buttons_03),".$_Var);
    }
    _buttons_03{
      $_bEnabled=pluginmsgex(toolbars,"IsButtonEnabled","buttons,macros(_buttons_02)",INT);
      alert($_bEnabled,"Test",INFO);
    }

    pluginmsg(toolbars,"SetButtonImage","<ToolbarName>,<ButtonID>,
      [HOT|COLD|DEAD],Path/to/new/image.bmp[0]");
    pluginmsg(toolbars,"AddToolbar","<ToolbarName>,<ButtonWidth>,<ButtonHeight>","");
    pluginmsg(toolbars,"AddButton","<ToolbarName>,<ButtonName>,<Command>,<MenuName>,
      <TooltipText>,<ButtonWidth>,<ButtonHeight>,hot.bmp[0],cold.bmp[0],dead.bmp[0]","");


Note:
Currently, buttons are identified by command, not by name.
Consequently, <ButtonID> must be replaced by the command associated to the button rather than the button's name.
AddToolbar and AddButton can be used OnSetup only (K-Meleon 1.1 and greater).
Currently, AddButton can be applied to toolbars only that were previously created using AddToolbar.
AddButton is not applicable to toolbars defined in toolbars.cfg!


Attachments: ExampleButton.7z (2.1 KB)  
Options: ReplyQuote
Re: About functions
Posted by: adodupan
Date: October 07, 2013 10:28PM

For testing.
Km menu offered four different options UA now. When user visits a page, user can change UA string (km stores in prefs the user's choice). Next time, km should send UA header in accordance with user's choice (even if javascript is enabled).

Attachments: useragent_test.7z (2.5 KB)  
Options: ReplyQuote
Re: About functions
Posted by: rodocop
Date: October 10, 2013 08:27PM

Oh, what the magic!!!

Adodupan, you're a magician! It works like a charm!

_____________________________________
Using K-Meleon-1.6db+NS by dugbug / KM-16-S2014
1.6beta2.6 by JamesD
_____________________________________
Recommending K-Meleon Twin+`||`Discuss it!!!
_____________________________________
New KM74 for test and feedback! Get It!

Options: ReplyQuote
Re: About functions
Posted by: naruman
Date: October 18, 2013 03:16AM

Hi adodupan , The useragent you made is a great Extension .

There is no large number of km extensions that using XPCOM Components , clearly you are on a high skill in those functions.

From your knowledge , Is it possible for km to sense of the change of tabs , or it will need kplugin?

I mean something like:

$OnChangeTab=$OnChangeTab."Do_Something;";

I've written a macro to hide pictures , kill css and bring them back (from Cache ), using the toolbar buttons .

Which improves performance , but could it do so in Auto way with the change of the tab?

Options: ReplyQuote
Re: About functions
Posted by: adodupan
Date: October 18, 2013 12:56PM

naruman, i can't figure what exactly the result you expect in your auto way. Can you be more specific?

Options: ReplyQuote
Re: About functions
Posted by: rodocop
Date: October 19, 2013 02:34AM

naruman,
couldn't you share your extension, please!

_____________________________________
Using K-Meleon-1.6db+NS by dugbug / KM-16-S2014
1.6beta2.6 by JamesD
_____________________________________
Recommending K-Meleon Twin+`||`Discuss it!!!
_____________________________________
New KM74 for test and feedback! Get It!

Options: ReplyQuote
Re: About functions
Posted by: naruman
Date: October 19, 2013 04:11AM

auto way >> Automatic ( bad Translation ) .

"On tab change "is the main thing , i was needed it for some other macros & i was forced to go around it by other long methods.

And about killing the elements is to get rid of all unimportant things running in the background.

To tell the engine , all the other pages is just text ,don't hold any places in the memory for it, don't play flash , images/gif ,css , js/XmlHttpRequest/AJAX ..

All of these elements can be hide, kill , dysfunction or stop & refresh it again by simple js code .

Now i have 6 tabs , everything is on & km is taking 110 MB of pc memmmory + Km cache space it use.






rodocop,

Kill images & css is part of complex toolbar , do some stuff for display some of my local sites, i will extract their own parts of it.

Options: ReplyQuote
Pages: 12Next
Current Page: 1 of 2


K-Meleon forum is powered by Phorum.