Development :  K-Meleon Web Browser Forum
K-Meleon development related discussions. 
view source in notepad
Posted by: froggy
Date: March 23, 2012 11:46AM

I would like to view the source code of a web page in notepad, not html.
CTRL-U opens the source in a new html window.
Is there a macro I can load where I can press a newly created button to open the source in notepad, as can be done in IE?

Thanks

Options: ReplyQuote
Re: view source in notepad
Posted by: JujuLand
Date: March 23, 2012 12:34PM

You can download an extension I made there is a long time: editSource

You can find it here : http://extensions.geckozone.org/K-MeleonEn

You can download the setup, or if you prefer the source and just keep editsource.kmm and put it in macros folder.

After, launching K-Meleon will gives you a second menu entry more than View Source, Edit Source.

I don't remember how to activate it easily, but you can use this method:

Edit => Configuration => Browser Configuration => source

and set kmeleon.general.sourceCommand to C:\Windows\Notepad.exe

It's immediat.

You have always the view method in html, and have now an edit method
The shortcut has been kept for View => Ctrl-U, and Ctrl-Alt-U is now used for "Edit Source"

A+



Mozilla/5.0 (x11; U; Linux x86_64; fr-FR; rv:38.0) Gecko/20100101 Ubuntu/12.04 K-Meleon/76.0


Web: http://jujuland.pagesperso-orange.fr/
Mail : alain [dot] aupeix [at] wanadoo [dot] fr



Ubuntu 12.04 - Gramps 3.4.9 - Harbour 3.2.0 - Hwgui 2.20-3 - K-Meleon 76.0 rc



Options: ReplyQuote
Re: view source in notepad
Posted by: guenter
Date: March 23, 2012 05:32PM

Quote
JujuLand
You can download an extension I made there is a long time: editSource

You can find it here : http://extensions.geckozone.org/K-MeleonEn

editSource is like most of the extensions of Your extension page not found


Quote
Error Page
Page introuvable

Vous venez d'être redirigé vers une page d'erreur.
L'adresse URL que vous avez saisie ou le lien que vous avez cliqué sont erronés.

Vous pouvez poursuivre votre navigation en lançant une nouvelle recherche:

Source:
http://www.orange.fr/bin/frame.cgi?u=http%3A//pp.auto.search.ke.voila.fr/

Maybe He can try instead. http://kmext.sourceforge.net/ext7.htm

Quote
disrupted about Edit Page

Edit Page (Download URL)

transforms k-meleon into a simple html editor. with this extension you can remove or resize images or modify the page text. handy for better display/layout or before printing or just for fun.
menu entry: edit>edit page
extra notes: -
versions supported: 1.1.x - 1.5.x -1.6.x



Edited 1 time(s). Last edit at 03/23/2012 05:45PM by guenter.

Options: ReplyQuote
Re: view source in notepad
Posted by: JujuLand
Date: March 23, 2012 09:43PM

Yes, Guenter, there is some problem on links.

Just take the secon link which is really the source (7z file) and it works.

A+



Mozilla/5.0 (x11; U; Linux x86_64; fr-FR; rv:38.0) Gecko/20100101 Ubuntu/12.04 K-Meleon/76.0


Web: http://jujuland.pagesperso-orange.fr/
Mail : alain [dot] aupeix [at] wanadoo [dot] fr



Ubuntu 12.04 - Gramps 3.4.9 - Harbour 3.2.0 - Hwgui 2.20-3 - K-Meleon 76.0 rc



Options: ReplyQuote
Re: view source in notepad
Posted by: JamesD
Date: March 23, 2012 10:19PM

@ froggy

The following macro will allow viewing the source in Notpad. All that is required is a picture for the button. Name the picture (filetype bmp) as "Src_v_np.bmp" and put it in your skins/default folder. I use the Klassic skin so I have the button picture as 16x16 pixels. You might have a bigger button with another skin. Change this line in the macro to the needed size. $_Vnp_BSize = "16" ;


Src_v_np.kmm

#  K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage2)
#
# ---------- Src_v_np.kmm
# ---------- View source in Notepad via a button
#
# Dependencies        : main.kmm
# Resources           : Image Src_v_np.bmp in SKINS\DEFAULT
# Preferences         : "kmeleon.general.sourceEnabled", "kmeleon.general.sourceCommand"
# Version             : 0.1  2012-03-23 
# --------------------------------------------------------------------------------

_Src_v_np_RunCode {
$_Vnp_ToolbarName = "Src_v_np" ;
$_Vnp_BSize = "16" ;
$_Vnp_LastItem = "" ;
$_Vnp_AddBarTag = $_Vnp_ToolbarName .",". $_Vnp_BSize .",". $_Vnp_BSize .",". $_Vnp_LastItem ; 
pluginmsg(toolbars, "AddToolbar", $_Vnp_AddBarTag);

$_Vnp_ButtonName = "ViewNP" ;
$_Vnp_Command = "macros(Src_v_np_View)" ;
$_Vnp_MenuName = "" ;
$_Vnp_tipText = "View source in Notepad";
$_Vnp_ImageHot  = "Src_v_np.bmp[0]" ;
$_Vnp_ImageCold = "Src_v_np.bmp[0]" ;
$_Vnp_ImageDead = "Src_v_np.bmp[0]" ;
$_Vnp_AddButtonTag = $_Vnp_ToolbarName.",".$_Vnp_ButtonName.",".$_Vnp_Command.",".$_Vnp_MenuName.",".$_Vnp_tipText.",".$_Vnp_BSize.",".$_Vnp_BSize.",".$_Vnp_ImageHot.",".$_Vnp_ImageCold.",".$_Vnp_ImageDead.",".$_Vnp_LastItem ; 
pluginmsg(toolbars, "AddButton", $_Vnp_AddButtonTag);
}

Src_v_np_View {
$_Vnp_CurUse = getpref(BOOL,"kmeleon.general.sourceEnabled");
if ($_Vnp_CurUse) {
	$_Vnp_CurPgm = getpref(STRING,"kmeleon.general.sourceCommand");
	setpref(STRING,"kmeleon.general.sourceCommand","NOTEPAD.EXE");
	id(ID_VIEW_SOURCE);
	setpref(STRING,"kmeleon.general.sourceCommand",$_Vnp_CurPgm);
	}
	else {
	setpref(BOOL,"kmeleon.general.sourceEnabled", true);
	$_Vnp_CurPgm = getpref(STRING,"kmeleon.general.sourceCommand");
	setpref(STRING,"kmeleon.general.sourceCommand","NOTEPAD.EXE");
	id(ID_VIEW_SOURCE);
	setpref(STRING,"kmeleon.general.sourceCommand",$_Vnp_CurPgm);
	setpref(BOOL,"kmeleon.general.sourceEnabled", false);
	}
}

$OnSetup=$OnSetup."_Src_v_np_RunCode;";
$macroModules=$macroModules."Src_v_np;";

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: view source in notepad
Posted by: froggy
Date: March 24, 2012 02:55AM

Not sure why I cant get Src_v_np.kmm to work but the EditScript Extension above does work so I' got what I need.

Thanks

Options: ReplyQuote
Re: view source in notepad
Posted by: JujuLand
Date: March 24, 2012 08:12AM

@JamesD,

I think it's not necessary to write a so complicated macro to do that. My macro is using a feature which has disappeared since 1?6.0 (I think) that allows to change the external editor to view the page source.

I just add a little macro which play with the pref 'enabled', and allow to use internal or external viewer. It just added a shortcut, to choose between the two solution, and don't remove the internal method as it was originally.

Here is the source, and you'll see it's really simpliest. The only problem now is that we haven't an easy way to set or change the external path.

==================================================================================
# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)

# ---------- EditSource Extension -----------------------------------------------
#
# Dependencies : -
# Resources : -
# Preferences : -
#
# ---------------------------------------------------------------------------------

EditSource_Page{
menugrayed=getpref(STRING,"kmeleon.general.sourceCommand")=="";
setpref(BOOL,"kmeleon.general.sourceEnabled",true);
id(ID_VIEW_SOURCE);
setpref(BOOL,"kmeleon.general.sourceEnabled",false);
}

EditSource_Frame{
menugrayed=getpref(STRING,"kmeleon.general.sourceCommand")=="";
setpref(BOOL,"kmeleon.general.sourceEnabled",true);
id(ID_VIEW_FRAME_SOURCE);
setpref(BOOL,"kmeleon.general.sourceEnabled",false);
}

# ----- PRIVATE

_EditSource_BuildMenu{
# view menu
setmenu("Page &Properties",macro,"Edit Source",EditSource_Page,"Cache &Information");
# context menus
setmenu("Page Pro&perties",macro,"Edit Source",EditSource_Page,"Cache &Information");
setmenu("Frame &Properties",macro,"Edit Source",EditSource_Frame,"Cache &Information");

# Accels
#
setaccel("CTRL ALT U","macros(EditSource_Page)");
#setaccel("SHIFT CTRL ALT U","macros(EditSource_Frame)");
}

$OnInit=$OnInit."_EditSource_BuildMenu;";
# -------------------------------------------------------------------------------
$macroModules=$macroModules."EditSource;";

=============================================================================

The macro menu are also translatable, by using the kml file present and which perhaps needs to be translatabled for a few languages.

Last point, It works also for frames, but I haven't been able to set a shortcut for it. I think it's not possible.

A+



Mozilla/5.0 (x11; U; Linux x86_64; fr-FR; rv:38.0) Gecko/20100101 Ubuntu/12.04 K-Meleon/76.0


Web: http://jujuland.pagesperso-orange.fr/
Mail : alain [dot] aupeix [at] wanadoo [dot] fr



Ubuntu 12.04 - Gramps 3.4.9 - Harbour 3.2.0 - Hwgui 2.20-3 - K-Meleon 76.0 rc





Edited 1 time(s). Last edit at 03/24/2012 08:13AM by JujuLand.

Options: ReplyQuote
Re: view source in notepad
Posted by: JamesD
Date: March 24, 2012 11:26AM

@ foggy

Did you get a toolbar without a button? It works for me.

@ JujuLand

Mine does not seem any more complex than yours and foggy did say a button was desired. We are manipulating the same two prefs.

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: view source in notepad
Posted by: froggy
Date: March 24, 2012 09:24PM

I must have done something wrong the first time. It works now, just like EditSource.
I made my own 16x16 button using MSpaint.

Thanks

Options: ReplyQuote
Re: view source in notepad
Posted by: rodocop
Date: March 28, 2012 02:22PM

I've just set this in Preferences


and my Ctrl+U opens my preferable editor, Mark.

Write down the full path to notepad - and that's it!

No need to make button and new macro.

Options: ReplyQuote
Re: view source in notepad
Posted by: JamesD
Date: March 28, 2012 05:42PM

But a button is what froggy wanted. I already do the prefs for Notepad++.
My macro does not interfere with that.

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: view source in notepad
Posted by: froggy
Date: March 31, 2012 02:07AM

I see.

Yes a button is nice. I didnt realize the "Use External Source Code Viewer" option was available. I can now use either the button or keyboard shortcut to open notepad.

Options: ReplyQuote
Re: view source in notepad
Posted by: JujuLand
Date: March 31, 2012 06:55AM

Just a last point, the macro of JamesD doesn't interfere with the External pref, but the macro must be modified to change the editor. With mine, just change the editor in Preference, and it rolls ...

A+



Mozilla/5.0 (x11; U; Linux x86_64; fr-FR; rv:38.0) Gecko/20100101 Ubuntu/12.04 K-Meleon/76.0


Web: http://jujuland.pagesperso-orange.fr/
Mail : alain [dot] aupeix [at] wanadoo [dot] fr



Ubuntu 12.04 - Gramps 3.4.9 - Harbour 3.2.0 - Hwgui 2.20-3 - K-Meleon 76.0 rc





Edited 1 time(s). Last edit at 03/31/2012 06:55AM by JujuLand.

Options: ReplyQuote


K-Meleon forum is powered by Phorum.