Development :  K-Meleon Forum
K-Meleon development related discussions. 
"Rewind" boton
Posted by: Savo
Date: July 07, 2007 05:04PM

Hey!
How can I make a boton that switched back to the FIRST page opened in a domain, you know, like in Opera the first blue double arrow with the combination shift+z.

Options: ReplyQuote
Re: "Rewind" boton
Posted by: sliderule
Date: July 08, 2007 12:17AM

Savo:

The above is already possible.

From the menu, make sure the Go Buttons are visible. To do this make sure the following is checked:

View -> Toolbars -> Go Buttons

Next, by RIGHT CLICKING on the 'blue arrow ( pointing in a northwest direction -- at least in the default Phoenity skin ) you have the option to "Go To Top Directory Level".

Additionally, if you wish to assign an 'accelerator' key, for example CTRL + Z to this same action . . . that may be done. From the menu:

Edit -> Configuration -> Accelerators

scroll to the bottom . . . and add the NEW LINE:
   CTRL Z = macros(Go_Top)
Then, after you shut down and restart K-Meleon . . . CTRL + Z will take you to the top directory.

I hope this helps, please be sure to let me / us know.

Sliderule

Options: ReplyQuote
Re: "Rewind" boton
Posted by: JujuLand
Date: July 08, 2007 03:12AM

@Slirude,

I don't think that what you explain is what Savo wants.

I think he wants to return to the first page on the site where he browsed, not necessarelly the root folder of the site.

For now, there's nothing done, but I think it perhaps may be possible with a macro by looking in history.

A+


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

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




Options: ReplyQuote
Re: "Rewind" boton
Posted by: Savo
Date: July 08, 2007 04:06PM

Jujuland, yes exactly, that is the effect i want to obtain. Sliderule thanks for your help, i should mention that the blue arrow in meleon is not what im looking for, even though its a nice option;)
Jujuland gave the better explanation.
Is there really nothing done,beside the "history", anything more comfortable, i mean the edit-->configuration-->toolbars dont provide such possibility? or maybe an extension for firefox? Are firefox and k-meleon generally compatable?

Options: ReplyQuote
Re: "Rewind" boton
Posted by: JujuLand
Date: July 08, 2007 09:14PM

Well, extension aren't all compatable, but I think it's possible with a macro.

Have you the name of a Firefox extension which does what you are talking about ?

A+


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

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




Options: ReplyQuote
Re: "Rewind" boton
Posted by: mark307
Date: July 08, 2007 10:11PM

This is lua macro. Is this right?
-- CODE
function RewindPage()
    local titles, urls, index = km.GetMozillaSessionHistory()
    if not titles then return end
    titles = nil
    local host = string.match(urls[index], "[^/:]+://([^/]+).*")
    local i = index
    while i > 1 do
        i = i - 1
        if string.match(urls, "[^/:]+://([^/]+).*") ~= host then
            i = i + 1; break
        end
    end
    if i < index then km.GotoHistoryIndex(i - 1) end
end
-- CODE

-- toolbars.cfg
%ifplugin luamacro
Rewind{
luamacro(RewindPage)
Go back one page
mainbarhot.bmp[0]
mainbarcold.bmp[0]
mainbardead.bmp[0]
}
%endif
-- toolbars.cfg

thanks.

Options: ReplyQuote
Re: "Rewind" boton
Posted by: JujuLand
Date: July 09, 2007 03:37AM

@Savo,

Sorry for occupying your post, but if I don't make luamacro works, I can't help you ...


@mark307,

I had tested luamacros.dll plugin (the old name) there is a long time and if I remember it worked with Km 0.9.

Now with 1.1, it seems it have problems with luamacro.dll plugin (v 0.4).

I have copied luamacro.dll in kplugins.
I have copied all the samples in <km rootfolder>\Luamacros.
I copied macros.lua in profile folder and modified it to refer to my folder Luamacros.
I haven't use your old method to add menus, but a kmm file

Here are the sources:

macros.lua
----------
package.path = package.path .. ";" ..
               BROWSERPATH .. "\\Luamacros\\?.lua;" ..
               BROWSERPATH .. "\\Luamacros\\?.lc"

package.cpath = package.cpath .. ";" ..
               BROWSERPATH .. "Luamacros\\?.dll"

require "copyaslink"
require "google"
require "multiclip"

function Eval()
	local a, b
	a = prompt("lua", "k-meleon", "")
	if a then
		b = loadstring(a)
		if b then
			alert(b(), "lua", ICON_INFO)
		end
	end
end


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

# ---------- Luamacro Extension Tests -------------------
#
# Dependencies : 
# Resources : -
# Preferences : -
#
# -------------------------------------------------------

CopyAsLink{
luamacro(CopyAsLink);
}

copy_to{
luamacro(copy_to(1), Copy to internal Clipboard 1);
}
paste_from{
luamacro(paste_from(1), Paste from internal Clipboard 1);
}
GoogleSearch{
luamacro(GoogleSearch);
}

# ----- PRIVATE

_LuaTests_BuildMenu{
setmenu("&Tools",inline,LuaTests,WebServices);
setmenu(LuaTests,popup,"&Luamacros");
setmenu("&Luamacros",macro,"&Copy as Link",CopyAsLink);
setmenu("&Luamacros",macro,"&Copy To",copy_to);
setmenu("&Luamacros",macro,"&Paste from",paste_from);
setmenu("&Luamacros",macro,"&Google Search",GoogleSearch);
}

$OnInit=$OnInit."_LuaTests_BuildMenu;";

# ----------------------------------------------------------
$macroModules=$macroModules."LuaTests;";

With these two files, I have no error when launching K-Meleon and loading luamacro plugin (it appears enabled in Preferences\Plugins)

But when I Try to execute a menu entry, I have the following message:

.      ------------------------------     
.       Error
.      ------------------------------     
.       Command not found 'luamacro'
.      ------------------------------

I have tested with the default location in profile folder -> same error

I have found that perhaps, the function was perhaps capitalized, and I search in dll with an hex editor, and I found a thing which is probably an bug:
The readme.txt refers to a pref (I don't use it, thinking that the variable in macros.lua was enough).

In the readme, the pref is :
kmeleon.plugins.luamacro.path
and in luamacro.dll, the pref referenced is
kmeleon.plugins.luamacros.path

I don't think this is the reason, but I think it's a bug.

for my problem, if you have an idea ...

A+


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

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




Options: ReplyQuote
Re: "Rewind" boton
Posted by: JujuLand
Date: July 09, 2007 04:00AM

@mark307,

I have found where was my error (and probably yours)

CopyAsLink{
luamacro(CopyAsLink);
}

ought to be

CopyAsLink{
plugin(luamacro,"CopyAsLink");
}

the same for the others functions

RewindPage seems to work.

@Savo,

I'm going to do the package as extension.

A+

A+


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

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




Options: ReplyQuote
Re: "Rewind" boton
Posted by: Savo
Date: July 09, 2007 03:22PM

Jujuland good luck with the extension.
I dont fully understood what this k-meleon language has to say, but its quite interesting, anyway, thanks for your work buddys...

Options: ReplyQuote
Re: "Rewind" boton
Posted by: mark307
Date: July 09, 2007 10:02PM

@JujuLand
I remember the "luamacro()" notation can be only on menu.cfg or accel.cfg. Instead, the macro has some plugin statements to call a plugin.

@Savo
It seems to me that I was unkind. I made minimal zip package to check the
function.

rewind.zip (71.22KB)

This package contains three files, luamacro.dll, rewind_lua.kmm, macros.lua . To install, copy the luamacro.dll into kplugins folder, copy the rewind_lua.kmm to macros folder, copy the macros.lua to your profile folder (Profiles\default\********.***) . The "Rewind" item will be appeard on "View" menu. To uninstall, just delete thease three files.


BTW, does the "where" argument of setmenu statement work?
thanks.

Options: ReplyQuote
Re: "Rewind" boton
Posted by: Savo
Date: July 11, 2007 03:45PM

Excellentsmiling smiley, all works fine, thank you very much.
BTW, does it exist a method to place the Rewind option to the top of the "View" menu, without preparing a new extension?

Options: ReplyQuote
Re: "Rewind" boton
Posted by: mark307
Date: July 12, 2007 09:15PM

@Savo
It can through a little work. Please edit the "rewind_lua.kmm" by a editor (notepad, etc) as below.

before.
setmenu("&View","command","Rewind","luamacro(RewindPage)","ID_NAV_FORWARD");
after.
setmenu("&View","command","Rewind","luamacro(RewindPage)",0);
This code is ad-hoc, but works on mine. I'm not expert at the macro language.

BTW, you can also make a toolbar button and key combination. The detail is explained in the document.

thanks.

Options: ReplyQuote
Re: "Rewind" boton
Posted by: Savo
Date: July 14, 2007 07:17PM

its done already, thank u once again.
eot

Options: ReplyQuote
Re: "Rewind" boton
Posted by: JujuLand
Date: September 26, 2007 04:49PM

@mark307,

I have test a Km 1.5 beta, and rewind() doesn't work anymore. I don't know if it's due to changes in km.GetMozillaSessionHistory() or km.GotoHistoryIndex() functions.

Have you info about this?
Have you the possibility to test 1.5?

A+


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

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




Options: ReplyQuote
Re: "Rewind" boton
Posted by: mark307
Date: September 28, 2007 09:40PM

@JujuLand,

Quote
JujuLand
I have test a Km 1.5 beta, and rewind() doesn't work anymore.

Is lua plugin loaded?

Quote
JujuLand
I don't know if it's due to changes in km.GetMozillaSessionHistory() or km.GotoHistoryIndex() functions. Have you info about this?

I read k-meleon source on CVS, these APIs had little changes. I'm regarding the source to update a lua plugin.

Quote
JujuLand
Have you the possibility to test 1.5?

I don't have a km 1.5 beta.

Thanks.

Options: ReplyQuote
Re: "Rewind" boton
Posted by: JujuLand
Date: September 29, 2007 02:32AM

@mark307

Yes, obviously lua is loaded :-)

A+


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

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




Options: ReplyQuote
Re: "Rewind" boton
Posted by: mark307
Date: September 29, 2007 09:53PM

Quote
JujuLand
Yes, obviously lua is loaded :-)
Good. (^^)
Well, I heard km couldn't load lua on some bata versions.

Thanks.

Options: ReplyQuote


K-Meleon forum is powered by Phorum.