Other custom builds :  K-Meleon Web Browser Forum
All the custom builds, made and/or maintained by users 
Pages: Previous1234Next
Current Page: 3 of 4
Re: KM Twin 2.0 wishlist
Posted by: deadlock
Date: December 22, 2012 01:02PM

@adodupan
Nice picture :cool:

It also works with system tools:

Windows: findstr /C:''kmeleon.url bar.dropdown_lines'' prefs.js
Linux: agrep ''kmeleon.url bar.dropdown_lines'' prefs.js



Edited 1 time(s). Last edit at 12/22/2012 01:10PM by deadlock.

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: JamesD
Date: December 22, 2012 01:17PM

The getpref() and setpref() for "kmeleon.toolband.xxx" is easy. What is not so easy is knowing all the values for 'xxx' which is the toolbar name. There is no master list. Making the master list is the job on which I am now working.

My wife has gone shopping. Now it is just me and the computer this morning.

Hanlon’s razor is an eponymous adage named after Robert J. Hanlon that states: “Never attribute to malice that which is adequately explained by stupidity.”

JamesD

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: deadlock
Date: December 22, 2012 02:20PM

Quote
JamesD
What is not so easy is knowing all the values for 'xxx' which is the toolbar name. There is no master list.

Findstr & agrep support reqular expressions,
not sure what you're trying to do and
don't know which command you're using.

Options: ReplyQuote
 
Posted by: adodupan
Date: December 22, 2012 02:47PM

 



Edited 1 time(s). Last edit at 02/29/2016 07:26PM by adodupan.

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: deadlock
Date: December 22, 2012 03:47PM

Quote
adodupan
This function would return to you your 'master list', just inject it.

Error: Permission denied for http://kmeleon.sourceforge.net to get property XPCComponents.classes
Source file: InjectJS

Same with resource:///

Your js code works for me if active tab is about:plugins.

Not sure if he can use it, because it will only
get values from active profile and I thought
he's trying to modify settings in different
profiles.

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: rodocop
Date: December 22, 2012 05:54PM

Only active profile is the target now.

We are walking step by step :-)

Thank you guys for contribution. We can form a mighty team!

You all are welcome to the party as I can only generate ideas and choose direction - my coding skills are very-very basic if not to say they are absent.



Edited 1 time(s). Last edit at 12/22/2012 06:00PM by rodocop.

Options: ReplyQuote
 
Posted by: adodupan
Date: December 22, 2012 06:52PM

 



Edited 1 time(s). Last edit at 02/29/2016 07:26PM by adodupan.

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: deadlock
Date: December 22, 2012 09:54PM

@adodupan
Thanks for the explanation.
Didn't look at all the macros in this thread.
I must find their skin-change-macro to get the point.
KM has to calculate positions if skin changes.

The bug you named shows up in several locations.
1.9.x security checks need a better configuration.
Not sure why InjectJS should be blocked for about:blank.

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: JamesD
Date: December 22, 2012 10:57PM

Quote
adodupan
JamesD is working on it, and as usual, he chose the hard way.

I almost understand my way. I am willing to have a look at this inject stuff. Do I just copy the function to the "JS" part below and do I need any location?

 $value = injectJS( JS [, location ]);

Hanlon’s razor is an eponymous adage named after Robert J. Hanlon that states: “Never attribute to malice that which is adequately explained by stupidity.”

JamesD

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: JamesD
Date: December 22, 2012 11:16PM

I don't understand the injectJS function. I did not get any master list. The code runs when KM starts and returns nothing. It runs when I call from menu and just returns part of the code.

_Snippet_RunCode {
$_Snipper_JS_return = injectJS( function a_je_to() { var ajetoprefs=Components.classes['@mozilla.org/preferences-service;1'] .getService(Components.interfaces.nsIPrefService); alert(ajetoprefs.getBranch('kmeleon.toolband.').getChildList('', {})); }  );
alert($_Snipper_JS_return, "Return from injectJS()", INFO);
}

_Snippet_BuildMenu {
	# add another option to Favorites menu
	setmenu("F&avorites",macro,"Snippet Testing","_Snippet_RunCode",4);
}

$OnInit=$OnInit."_Snippet_BuildMenu;";
$macroModules=$macroModules."Snippet;";

Hanlon’s razor is an eponymous adage named after Robert J. Hanlon that states: “Never attribute to malice that which is adequately explained by stupidity.”

JamesD

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: Merlin
Date: December 23, 2012 01:20AM

Quote
adodupan

This function would return to you your 'master list', just inject it.

function a_je_to() {
var ajetoprefs=Components.classes['@mozilla.org/preferences-service;1']
.getService(Components.interfaces.nsIPrefService);
alert(ajetoprefs.getBranch('kmeleon.toolband.').getChildList('', {}));
}

It good function to get pref branch using xpcom components .
But when using it in injectJS Or Bookmarklets it set the function as part of the page script , and km see it as External script look in it's preferences , and block it for security reasons .

However in chrome locations , like "chrome://kmprefs/content/pref.xul" , about:config or about:plugins Km see the function as part of the chrome files and run it.

Quote
JamesD
I don't understand the injectJS function. I did not get any master list. The code runs when KM starts and returns nothing. It runs when I call from menu and just returns part of the code.

To use This function you need to create xul+js chrome files to be able to control Components and reading pref & other things like open or create files and more .

Code snippets

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: JamesD
Date: December 23, 2012 01:34AM

Thanks guys for all the imput. The stuff you are showing is just a little above my knowledge level.

I have gotten my (hard way) master list done. The reading/writing of the perfs is easy, now that I have the toolbar names.

My method is here: https://dl.dropbox.com/u/1522294/SkinSwitch.7z

Hanlon’s razor is an eponymous adage named after Robert J. Hanlon that states: “Never attribute to malice that which is adequately explained by stupidity.”

JamesD

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: JamesD
Date: December 24, 2012 04:56PM

@ rodocop

Here is the finished macro and js file. Download from:
https://dl.dropbox.com/u/1522294/SkinSwitch.7z

SkinSwitch is basic and I have done only a little testing. I was able to put back a skin layout after changing it. You will need to test and see if it meets your needs.

Hanlon’s razor is an eponymous adage named after Robert J. Hanlon that states: “Never attribute to malice that which is adequately explained by stupidity.”

JamesD

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: rodocop
Date: December 24, 2012 05:31PM

Thank you James and all who participate.

I'll test new macro as soon as I can.

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: rodocop
Date: December 25, 2012 09:17AM

James and all who had tested,
I've tried this macro and had the next experience:

one of my skins was reconstructed fine but other one has being crushing everytime.

The reason, as I can see, is that imported settings are present in prefs along with some old ones, so when I look into about:config, I see some blocks doubled and sometime values of 'break' and 'visibility' are swapped vice versa. Moreover, some '4 prefs blocks' are there that aren't produced by the injected skin.

Here one can download all the info (archive with skins, ini-files, produced by macro and toolband-part of prefs.js after closing KM with active Pinstripe Twin skin)



Edited 1 time(s). Last edit at 12/25/2012 09:18AM by rodocop.

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: JamesD
Date: December 25, 2012 12:36PM

@ rodocop

Sorry but the file you had for archive was not usable. Many error messages about unsupported compression method.

I tried DB tango skin and my ini file looked right. How many items did your use indicate were included from the WScript program. We may have hit the limit on size of string that can be read in from an ini file. The macros.dll from macros2 source can read a longer string. Also does anyone know the limit on a string in the registry?

Edit: It might have to do with this pref.
user_pref("kmeleon.general.toolbars_locked", true);

Hanlon’s razor is an eponymous adage named after Robert J. Hanlon that states: “Never attribute to malice that which is adequately explained by stupidity.”

JamesD



Edited 1 time(s). Last edit at 12/25/2012 12:50PM by JamesD.

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: rodocop
Date: December 25, 2012 01:06PM

trying to recreate archive

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: JamesD
Date: December 25, 2012 10:36PM

My version of 7 Zip is 4.65. It is too old?

Hanlon’s razor is an eponymous adage named after Robert J. Hanlon that states: “Never attribute to malice that which is adequately explained by stupidity.”

JamesD

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: rodocop
Date: December 26, 2012 06:10AM

Yeah! Current version is 9.20!

Update it, James, or the world will fall into darkness! grinning smileygrinning smileygrinning smiley



Edited 1 time(s). Last edit at 12/26/2012 06:41AM by rodocop.

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: JamesD
Date: December 26, 2012 02:20PM

@ rodocop

The update to 7-zip fixed the problem with me opening your file. Thanks for the heads up on that.

I just noticed something. Your files have a "skin.js" inside the skin folder. Is that a third place I have to read to complete the master list of toolbar names? In my Klassic skin, there is no such file, so I missed that in planning the macro.

Hanlon’s razor is an eponymous adage named after Robert J. Hanlon that states: “Never attribute to malice that which is adequately explained by stupidity.”

JamesD

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: rodocop
Date: December 26, 2012 03:26PM

As I can see, skin.js inside the skin folder is ignored by KM - or I just cannot cook it properly :O

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: JamesD
Date: December 26, 2012 05:41PM

@ rodocop

I will do some tests to see if I can figure it out. I just looked in the skins in my Beta 2.4 version. Klassic does not have a skin.js but the others skins do. However they are copies of perfskin.js. They have the same perfs and values and all say they are for Phoenity which is no longer in KM 1.6.

Since you said, "As I can see, skin.js inside the skin folder is ignored by KM . . ", I wonder if I can ignore them?

Hanlon’s razor is an eponymous adage named after Robert J. Hanlon that states: “Never attribute to malice that which is adequately explained by stupidity.”

JamesD

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: rodocop
Date: December 26, 2012 07:59PM

Quote
JamesD
@ rodocop
Since you said, "As I can see, skin.js inside the skin folder is ignored by KM . . ", I wonder if I can ignore them?
I think yes. These skin.js files were temporarily made by me manually to save toolbar config and so to say 'inject' prefs through the changing skin.js from defaults folder before KM restart.

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: JamesD
Date: December 26, 2012 08:28PM

@ rodocop

First let me address the SkinSwitch macro problem. I think the name is a bit of a misnomer. SkinSwitch in the current version does not actually switch a skin. It only resets all to toolbar positions and visibility settings. The user must currently load a new skin via Edit - Preferences.

Here is a test that I have just done.


2012-12-26   

Testing SkinSwitch in K-Meleon Twin +
- - - - - - - - - - - - - - - - - - - - - - - - -

Loaded a fresh copy of twin and created shortcut.
Ran twin and exported toolbar layout of dbTango - 18 items

Used View-Toolbars to uncheck Window diversion and Zoom buttons
At this point I wished to move the location of a toolbar, but that is not allowed.

Closed and started twin
The Window diversion and Zoom buttons are missing.
Used SkinSwitch to import dbTango's toolbar layout
There is no visible change in the current layout

Closed and started twin
The Window diversion and Zoom buttons are back in their place

If SkinSwitch is to completely change from one skin to another, then there is a lot more work to do.

About the skin.js file in the skin, you are right. That is not read at startup.

Do you have different settings or additional toolbars that need to be identified with a particular skin?

If so, I have a vague idea about doing that but it will require me to run some tests. It will also require that the answers from those tests be the ones for which I hope.

Hanlon’s razor is an eponymous adage named after Robert J. Hanlon that states: “Never attribute to malice that which is adequately explained by stupidity.”

JamesD

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: JamesD
Date: December 27, 2012 01:52AM

@ rodocop

This verion will change the skin and restart KM. It requires all the restart pieces already be in place. The 7-Zip file contains only a new kmm file.

https://dl.dropbox.com/u/1522294/SkinSwitch2dot5.7z

I will have something on the info in skin.js in the skin folder shortly. My vague idea panned out OK. It is possible to insert new/changed prefs prior to display of the screen. The problem is to decide if we want the ones from the skin or ones which may have been changed from the skin default. I think I may be able to do that if I can determine a fixed set of rules.

Hanlon’s razor is an eponymous adage named after Robert J. Hanlon that states: “Never attribute to malice that which is adequately explained by stupidity.”

JamesD

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: JamesD
Date: December 27, 2012 08:11PM

@ rodocop

Here is a first try and getting some prefs from each skin as it is being loaded. It is just something to try.

Note that all prefs entered this way become user prefs and are not default. I think the developers never intended any but one default set of prefs.

First you would set a "dat" file named "skin" in each skin folder for which you wish extra pref information.

Example skin.dat file

## Default toolband info for skin < skin name >

## Only one blank space allowed.  The blank space is before the value.
## No comma or paren or quote symbols allowed in these comments.
## This file is machine readable.  Format of the lines is important.

(INT,"kmeleon.toolband.Offline Button.break", 0)
(INT,"kmeleon.toolband.Offline Button.index", 12)
(INT,"kmeleon.toolband.Offline Button.size", 45)
(BOOL,"kmeleon.toolband.Offline Button.visibility", false)
(INT,"kmeleon.toolband.KMrestart.break", 0)
(INT,"kmeleon.toolband.KMrestart.index", 0)
(INT,"kmeleon.toolband.KMrestart.size", 36)
(BOOL,"kmeleon.toolband.KMrestart.visibility", true)

The following macro will run on init and read, parse, and set the prefs.

SkinPreLd.kmm

# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage2)
#
# File name: SkinPreLd.kmm
#
# ---------- Import prefs for skin.dat in individual skin folder  -------------------------------
#   
#    Loads prefs for the skin being loaded from data read in skin.dat file 
#    $OnInit=$OnInit."_SkinPreLd_Run;";  is executed prior to skin display 
#
# Dependencies		: main.kmm 
# Resources			: skin.dat
# Preferences		:  
# Version			: 1.0 2012-12-27  
# Author			: JamesD 
# -----------------------------------------------------------------------------------------------

_SkinPreLd_Run {
$_SkinPreLd_LoadSkin = getpref(STRING, "kmeleon.general.skinsCurrent");
$_SkinPreLd_Path = getfolder( RootFolder )."\\skins\\".$_SkinPreLd_LoadSkin."\\skin.dat" ;
#alert($_SkinPreLd_Path, "To read from");
$_SkinPreLd_Dat = readfile($_SkinPreLd_Path);
$_SkinPreLd_DatLen = length($_SkinPreLd_Dat);
$_SkinPreLd_Idx = 10;
while ($_SkinPreLd_Idx > 0 ) {
	$_SkinPreLd_P2 = index( $_SkinPreLd_Dat, "(" );                 ## find first left paren
	$_SkinPreLd_Dat = substr($_SkinPreLd_Dat, $_SkinPreLd_P2);      ## start at first left paren
	$_SkinPreLd_P1 = index( $_SkinPreLd_Dat, ")");                  ## find first right paren
	$_SkinPreLd_Pref = substr( $_SkinPreLd_Dat, 1 , $_SkinPreLd_P1 -1 ) ;
	## parse the pref - at this point the whole pref is a text string
	$_SkinPreLd_k = index($_SkinPreLd_Pref, ",\"" );                 ## "pos 1 of first delimit 
	$_SkinPreLd_Type = substr($_SkinPreLd_Pref, 0, $_SkinPreLd_k );  ## read from the first pos
	$_SkinPreLd_k2 = index($_SkinPreLd_Pref, "\"," );                ## "pos 1 of second delimit
	$_SkinPreLd_k3 = $_SkinPreLd_k2 - $_SkinPreLd_k ;
	$_SkinPreLd_Name = substr($_SkinPreLd_Pref, $_SkinPreLd_k +2, $_SkinPreLd_k3 -2 );
	$_SkinPreLd_Value = substr($_SkinPreLd_Pref, $_SkinPreLd_k2 + 2);
	#alert( "TYPE= ". $_SkinPreLd_Type . "  NAME= " . $_SkinPreLd_Name . "  VALUE= " . $_SkinPreLd_Value, $_SkinPreLd_Pref);
	setpref($_SkinPreLd_Type, $_SkinPreLd_Name, $_SkinPreLd_Value );
	$_SkinPreLd_Dat = substr($_SkinPreLd_Dat, $_SkinPreLd_P1 + 1 );
	$_SkinPreLd_Idx = index( $_SkinPreLd_Dat, "(" );
}
alert( $_SkinPreLd_Path, _("New items/values entered to prefs from"), INFO);
}

$OnInit=$OnInit."_SkinPreLd_Run;";
$macroModules=$macroModules."SkinPreLd;";

Hanlon’s razor is an eponymous adage named after Robert J. Hanlon that states: “Never attribute to malice that which is adequately explained by stupidity.”

JamesD

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: JamesD
Date: December 28, 2012 03:29PM

Here is an updated version of SkinPreLD which will run only once for a skin.

https://dl.dropbox.com/u/1522294/SkinPreLD.7z

Hanlon’s razor is an eponymous adage named after Robert J. Hanlon that states: “Never attribute to malice that which is adequately explained by stupidity.”

JamesD

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: rodocop
Date: December 28, 2012 07:49PM

Hey, folks, I haven't enough time to test all your stuff! tongue sticking out smiley

It's wonderful!

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: JamesD
Date: December 29, 2012 12:58AM

@ rodocop

I have updated SkinPreLD again. You should use version 2.0 from the same location.
https://dl.dropbox.com/u/1522294/SkinPreLD.7z
Added code to skip if skin.dat not present in skin folder.

I think I have SkinSwitch and SkinPreLD working together now. I don't actually have skins which require extra or changed prefs, so I am using dummy stuff. All seems to be showing correct.

I hope these macros fulfill your needs.

Hanlon’s razor is an eponymous adage named after Robert J. Hanlon that states: “Never attribute to malice that which is adequately explained by stupidity.”

JamesD

Options: ReplyQuote
Re: KM Twin 2.0 wishlist
Posted by: duffy98
Date: December 29, 2012 11:54PM

rodocop ... I have a question about why this web page is slightly different in appearance with your KM Twin version but is OK with KM 1.5.4 and the K-Meleon 1.6.0 beta 2.4 that I got from JamesD. Maybe there is a setting that I need to adjust or something. It is a Flash - Shockwave Test page ... it tests several items and there will be on the right side a "green check mark" for each item if it does pass the test. I see the green check marks on the other two KM versions but not on the KM Twin version, just see little squares instead of the green checkmarks. I put the link below for the test page ... javaScript must be on (enabled) and Proxomitron (if used) must be set on "Bypass" ... a little box should appear after a few seconds in the middle of the page to click on ... labeled "Run System Test". I noticed this when I first tried KM Twin but decided to ask about it today ... just wondering if you see green check marks or "no" green check marks with your KM Twin version?

Test Your System

http://www.explorelearning.com/index.cfm?method=cCorp.dspTest

...

Options: ReplyQuote
Pages: Previous1234Next
Current Page: 3 of 4


K-Meleon forum is powered by Phorum.