You are not logged in.

#701 2011-12-09 14:58:03

alius.miles
Member
Registered: 2011-12-07
Posts: 3

Re: luakit browser framework (almost with jQuery!)

any advice about how to convert easylist for adblock.lua?

and another problem -- luakit doesn't remeber history at all. Any suggestion about what to do / where to look?

Offline

#702 2011-12-09 21:43:55

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: luakit browser framework (almost with jQuery!)

It remembers history very well here! Did you try without any custom config files? Do you use luakit-git from the AUR or luakit from the repos?

About easylist for adblock.lua, maybe the script from the AUR-package privoxy-blocklist might be a good starting point. Maybe I'll look into it a bit.

Offline

#703 2011-12-09 22:46:45

alius.miles
Member
Registered: 2011-12-07
Posts: 3

Re: luakit browser framework (almost with jQuery!)

Yes, default configs solve the history problem. I've just modified rc.lua and golbals.lua again -- change useragent and hint symbols.

Adblocking currently works via privoxy, which finally starts at boot. Used adblock2prioxy.pl for converting easylist into adblock.action. Loks like it is the best option.


So there are another questions:
- is there any way to make PASS THROUGH mode on gmail/google.reader permanent?

- I'm using dark gtk theme, but a lot of input fields in luakit has black font on dark barckground (arch forum included). Should I change gtk theme, or maybe just css?

- how to implement vim-like shortcuts in Insert mode? Simple copiing from cmd to insert section in binds.lua didn't work.


And what happend to wiki section on luakit.org? Some pages got 404, some are old and code doesn't work. For example, way of changing hint symbols I'e found on Issue section and it's just two lines, while on Wiki there is a lot of unusable code.

Last edited by alius.miles (2011-12-09 22:48:00)

Offline

#704 2011-12-10 09:36:04

Next7
Member
Registered: 2011-12-07
Posts: 44

Re: luakit browser framework (almost with jQuery!)

When I try to open AUR link https://aur.archlinux.org/ luakit crashes:

luakit: relocation error: /usr/lib/gio/modules/libgiognutls.so: symbol gnutls_certificate_verify_peers, version GNUTLS_1_4 not defined in file libgnutls.so.26 with link time reference

Is it possible to fix it?

I use:

luakit-git 20111204-1
gnutls 3.0.8-1

Offline

#705 2011-12-10 10:09:45

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: luakit browser framework (almost with jQuery!)

Did you try to rebuild luakit?

Offline

#706 2011-12-10 11:30:26

Next7
Member
Registered: 2011-12-07
Posts: 44

Re: luakit browser framework (almost with jQuery!)

How should I rebuild it? I have compiled luakit-git  just a minute ago and it still crashes when trying to enter bbs.archlinux.org and AUR.

Offline

#707 2011-12-10 12:50:01

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: luakit browser framework (almost with jQuery!)

Ok that's what I meant. Are you on 32bit or 64bit? I'm on 64bit and everything works fine. Do you use libwebkit from the repos or a custom build?

Offline

#708 2011-12-10 13:22:25

Next7
Member
Registered: 2011-12-07
Posts: 44

Re: luakit browser framework (almost with jQuery!)

I'm on 32bit. libwebkit 1.6.1-1 from the repos.

Offline

#709 2011-12-10 21:33:51

milomouse
Member
Registered: 2009-03-24
Posts: 940
Website

Re: luakit browser framework (almost with jQuery!)

@Next7:  Which version of glib-networking do you have?

Offline

#710 2011-12-11 08:24:14

Next7
Member
Registered: 2011-12-07
Posts: 44

Re: luakit browser framework (almost with jQuery!)

milomouse
I had glib-networking 2.28.7-1, but now I have upgraded to 2.30.1-1 from repos and the problem has gone. Thanks for helping!

Offline

#711 2011-12-11 08:48:33

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: luakit browser framework (almost with jQuery!)

Of course you should always be on the latest version of packages. If you aren't and something breaks, it's very likely that this is the reason!

Offline

#712 2011-12-11 15:00:44

mtrokic
Member
From: Montreal
Registered: 2009-10-24
Posts: 56
Website

Re: luakit browser framework (almost with jQuery!)

Hi everyone. I love this project! However, I'm having trouble seeing the changelog for some kernels on the kernel.org website with luakit. The statusbar is telling me the site downloads fully, however, all I see is a blank page. My guess is that luakit is looking at this as a mime-object, which, albeit, I don't have set up in my mime-types settings on my system. Nevertheless, it seems strange to me that this is indeed the case as the site I'm interested in is just a bunch of raw text...

Can anyone help me out with this?

Last edited by mtrokic (2011-12-11 15:03:57)

Offline

#713 2011-12-11 19:47:25

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: luakit browser framework (almost with jQuery!)

Did you try this site with another webkit browser like jumanji?

Offline

#714 2011-12-11 20:47:09

mtrokic
Member
From: Montreal
Registered: 2009-10-24
Posts: 56
Website

Re: luakit browser framework (almost with jQuery!)

I think I figured out what was wrong and at the same time might have figured out a bug... Ok, so the other day I followed the luakit wiki on "How do I change/stop the white flash during the loading of a page in a new tab." This requires you to put

webview.init_funcs.set_win_trans = function (view, w) -- show GTK the background color
    view.transparent = true
end

after require("webview") in your rc.lua file. It seems that this code was causing trouble. After removing the code the page I wanted loads fine. It seems the transparency was preventing the page from loading properly. I think this may be a bug of sorts. In any case, I solved my problem but this may be of interest to the developers.

Offline

#715 2011-12-18 06:14:47

TheImmortalPhoenix
Member
From: 127.0.0.1
Registered: 2011-08-13
Posts: 436

Re: luakit browser framework (almost with jQuery!)

hi man, how can i start luakit in a fullscreen window?

Last edited by TheImmortalPhoenix (2011-12-18 06:15:34)

Offline

#716 2011-12-18 14:26:24

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: luakit browser framework (almost with jQuery!)

Maybe your window manager is capable of handling this.

Offline

#717 2011-12-18 16:17:55

PotatoesMaster
Member
From: France
Registered: 2010-08-26
Posts: 54

Re: luakit browser framework (almost with jQuery!)

Here is a script I made for playing videos from youtube, vimeo and others using mplayer without need of flash. It requires quvi to be installed.

------------------------------------------------------------------------------
-- Open videos from video hosting services using quvi                       --
--                                                                          --
-- author: David Pugnasse <david.pugnasse@gmail.com>                        --
--                                                                          --
-- Command ':videos' and key 'V' in normal mode opens the video menu.       --
------------------------------------------------------------------------------

-- This script opens a console and uses mplayer to play videos.
-- Edit 'player_command' and 'quvi_command' values below to change this
-- behaviour.

local pairs = pairs
local ipairs = ipairs
local string = string

local lousy = require "lousy"
local theme = theme
local table = table
local add_binds, add_cmds = add_binds, add_cmds
local key = lousy.bind.key
local new_mode, menu_binds = new_mode, menu_binds
local capi = { luakit = luakit }

module("quvi")

-- mplayer options from youtube-viewer
-- (https://github.com/trizen/youtube-viewer)
player_command = 'mplayer %u -prefer-ipv4 -cache 30000 -cache-min 5 -unicode -utf8'

-- urxvt -e quvi <url> --exec <player_command>
quvi_command = 'urxvt -e quvi %q --exec %q'
--quvi_command = 'quvi %q --exec %q' -- alternatively, do not open a console

-- TODO: find supported hosts from command `quvi --support`
-- We match only domain names, so there is a lot of false positive,
-- especially when invoking on one of these sites.
-- E.g.: on youtube, a bunch of crap like 'upload.youtube.com/my_videos_upload'
-- and all others "http://*.youtube.com/*" urls appears in the list.
-- Matching complete urls is better, but need more effort to maintain, as quvi
-- does not provide access to a list of url patterns for now.

local hosts = {
    'audioboo%.fm',
    'break%.com',
    'mgnetwork%.com',
    'yfrog%.com',
    'videobash%.com',
    'dailymotion%.%w+',
    'metacafe%.com',
    'bloomberg%.com',
    'guardian%.co%.uk',
    'academicearth%.org',
    'clipfish%.de',
    'publicsenat%.fr',
    'vimeo%.com',
    'liveleak%.com',
    'francetelevisions%.fr',
    'tmunderground%.com',
    'ted%.com',
    'youtube%.com',
    'funnyhub%.com',
    'tvlux%.be',
    'blip%.tv',
    'gaskrank%.tv',
    'theonion%.com',
    'buzzhumor%.com',
    'sevenload%.com',
    'collegehumor%.com|dorkly%.com',
    'tagtele%.com',
    'charlierose%.com',
    'cbsnews%.com',
    'funnyordie%.com',
    'video%.globo%.com',
    'videos%.arte%.tv',
    'video%.google%.%w+',
    'spiegel%.de',
    'videos%.sapo%.pt',
    'pluzz%.fr',
    'bikeradar%.com',
    'megavideo%.com',
    'soundcloud%.com',
    'video%.foxnews%.com',
    'video%.golem%.de',
}

new_mode("quvimenu", {
    enter = function (w)
        local url
        local afg, ifg = theme.proxy_active_menu_fg, theme.proxy_inactive_menu_fg
        local abg, ibg = theme.proxy_active_menu_bg, theme.proxy_inactive_menu_bg
        local rows = {{ "Url(s)", title = true },}
        local list = list_videos(w)
        local url
        local i=0

        for url in pairs(list) do
            table.insert(rows, {
                "  " .. url,
                url = url,
                fg = afg or ifg,
                bg = abg or ibg,
            })
            i=1
        end

        if i<1 then
            w:set_mode()
            w:notify("No video url found")
            return
        end

        w.menu:build(rows)
        w:notify("Use j/k to move, y to yank, Return to play, o to play without closing this menu.", false)
    end,

    leave = function (w)
        w.menu:hide()
    end,
})

local key = lousy.bind.key
add_binds("quvimenu", lousy.util.table.join({
    -- Play the video
    key({}, "o",
        function (w)
            local row = w.menu:get()
            if row and row.url then
                launch_quvi(row.url)
            end
        end),

    -- Play the video (close menu)
    key({}, "Return",
        function (w)
            local row = w.menu:get()
            if row and row.url then
                w:set_mode()
                launch_quvi(row.url)
            end
        end),

    -- Yank url
    key({}, "y",
        function (w)
            local row = w.menu:get()
            if row and row.url then
                capi.luakit.selection.primary = row.url -- luakit-git (aur)
                --capi.luakit.set_selection(row.url) -- luakit (community)
            end
        end),

    -- Exit menu
    key({}, "q", function (w) w:set_mode() end),

}, menu_binds))

add_binds("normal", {
    key({}, "V",
        function (w)
            w:set_mode("quvimenu")
        end),
})

local cmd = lousy.bind.cmd
add_cmds({
    cmd({"videos"}, function (w, a)
            w:set_mode("quvimenu")
        end),
})

function launch_quvi(url)
    local command = string.format(quvi_command, url, player_command)
    capi.luakit.spawn(command)
end

function list_videos(w)
    local urls = {}
    local t = {}
    local host
    local supported_host
    local url
    local k

    -- get html code from current page
    local html = w:eval_js("document.documentElement.outerHTML", "dump")

    -- add current url
    local url = w.view.uri -- luakit-git (aur)
    --local url = w:get_current().uri  -- luakit (community)

    -- keep protocol + host
    host = string.sub(url, 0, string.find(url, '/', 9, true))
    urls[url] = host

    -- retrieve urls from html code
    -- TODO: build a nicer pattern for url matching
    for url in string.gmatch(html, "(https?://[^ \n\r'><\")]+)") do
        host = string.sub(url, 0, string.find(url, '/', 9, true))
        urls[url] = host
    end

    for url, host in pairs(urls) do
        for k, supported_host in ipairs(hosts) do
            -- consider it is a video link if host matches one of supported hosts
            if string.find(host, supported_host) then
                t[url] = 1
                break -- ok there, go to next url
            end
        end
    end

    return t
end

-- vim: et:sw=4:ts=8:sts=4:tw=80

Save it as quvi.lua in your luakit config directory and add a line

require "quvi"

in your rc.lua.

You can then access video menu by pressing V or with the :videos command.

Though it is far away from perfect, it is usable.

The problem remaining is that all the urls from video website domains are seen like video urls. So, all urls matching 'http://*.youtube.com/*', 'http://*.vimeo.com/*', etc. appear in the list.

Do not hesitate to point out errors. smile

Last edited by PotatoesMaster (2011-12-19 20:17:16)

Offline

#718 2011-12-18 16:38:34

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: luakit browser framework (almost with jQuery!)

Nice, I'll test this right away smile

Offline

#719 2011-12-18 17:14:22

TheImmortalPhoenix
Member
From: 127.0.0.1
Registered: 2011-08-13
Posts: 436

Re: luakit browser framework (almost with jQuery!)

@ PotatoesMaster: i have this error:

Error: In bind call: ~/.config/luakit/.quvi.lua:188: attempt to index field 'view' (a nil value)

What i have to do?

Offline

#720 2011-12-18 17:42:48

PotatoesMaster
Member
From: France
Registered: 2010-08-26
Posts: 54

Re: luakit browser framework (almost with jQuery!)

@TheImmortalPhoenix:
This script is for the development version.
If you have installed the luakit package from community, you have to replace this line 188 with

local url = w:get_current().uri

wink

Offline

#721 2011-12-19 05:56:48

TheImmortalPhoenix
Member
From: 127.0.0.1
Registered: 2011-08-13
Posts: 436

Re: luakit browser framework (almost with jQuery!)

Thanks, it works...it's a bit slow, but it works smile

Offline

#722 2011-12-19 14:28:17

TheImmortalPhoenix
Member
From: 127.0.0.1
Registered: 2011-08-13
Posts: 436

Re: luakit browser framework (almost with jQuery!)

i have problem also with line 148: capi.luakit.selection.primary = row.url

Offline

#723 2011-12-19 20:11:04

PotatoesMaster
Member
From: France
Registered: 2010-08-26
Posts: 54

Re: luakit browser framework (almost with jQuery!)

You can replace it with

capi.luakit.set_selection(row.url)

Offline

#724 2011-12-19 20:35:01

TheImmortalPhoenix
Member
From: 127.0.0.1
Registered: 2011-08-13
Posts: 436

Re: luakit browser framework (almost with jQuery!)

Thank you wink

Offline

#725 2011-12-21 05:37:07

mkaito
Member
From: Spain
Registered: 2010-06-12
Posts: 126
Website

Re: luakit browser framework (almost with jQuery!)

Would anyone know why I can place

webview.init_funcs.window_decision = function (view, w) [...]

in rc.lua and have it work just fine, but it won't work in mine.lua (required from rc.lua)?


Fear me! I have root! Sometimes...

Offline

Board footer

Powered by FluxBB