You are not logged in.

#926 2012-07-25 23:46:05

brianb
Member
From: Montreal, QC
Registered: 2012-02-17
Posts: 61
Website

Re: dwb - a webkit web browser

manolomartinez wrote:

Maybe I'm just adding noise here: although I do see very high CPU usage with dwb in certain websites, it's hardly ever 100%. Besides, that tor link behaves OK for me here -- so you should probably just disregard my comment.

Hmm... weird. Guess it's a webkit thing and/or something on my end. I don't know enough about browsers to know where to begin looking for the culprit.

On an unrelated note, I've got a mimetypes question: for application/msword, I'd like to open .doc files by spawning urxvtc, feeding the .doc file to antiword, and then view the stdout with a pager like less. I tried the following, with no luck:

Spawn (application/msword): urxvtc -e antiword | less

I see a terminal pop up really fast and spew out some text and then close immediately, but that's it. Any tips?

Is there a variable like %f for the filename that I can feed to the command, e.g., urxvtc -e antiword %f | less?

Last edited by brianb (2012-07-25 23:47:21)

Offline

#927 2012-07-26 01:51:35

Reded
Member
From: Manchester, England
Registered: 2012-02-21
Posts: 233

Re: dwb - a webkit web browser

portix wrote:

Do you have addressbar-dns-lookup enabled? You can first try to disable it, this setting isn't a good idea anyway so this will probably be removed in the future.

Did'nt have it enabled in the first place sad


"Some humans would do anything to see if it was possible to do it. If you put a large switch in some cave somewhere, with a sign on it saying "End-of-the-World Switch. PLEASE DO NOT TOUCH", the paint wouldn't even have time to dry."

Offline

#928 2012-07-26 05:56:12

syngin
Member
From: Melbourne
Registered: 2011-03-29
Posts: 39

Re: dwb - a webkit web browser

brianb wrote:

On an unrelated note, I've got a mimetypes question: for application/msword, I'd like to open .doc files by spawning urxvtc, feeding the .doc file to antiword, and then view the stdout with a pager like less. I tried the following, with no luck:

Spawn (application/msword): urxvtc -e antiword | less

I see a terminal pop up really fast and spew out some text and then close immediately, but that's it. Any tips?

This was mentioned a couple of pages back. Don't use urxvtc; use urxvt instead.

Last edited by syngin (2012-07-26 05:56:44)

Offline

#929 2012-07-26 08:36:18

portix
Member
Registered: 2009-01-13
Posts: 755

Re: dwb - a webkit web browser

syngin wrote:
brianb wrote:

On an unrelated note, I've got a mimetypes question: for application/msword, I'd like to open .doc files by spawning urxvtc, feeding the .doc file to antiword, and then view the stdout with a pager like less. I tried the following, with no luck:

Spawn (application/msword): urxvtc -e antiword | less

I see a terminal pop up really fast and spew out some text and then close immediately, but that's it. Any tips?

This was mentioned a couple of pages back. Don't use urxvtc; use urxvt instead.

The urxvtc thing was only for the editor, when dwb spawns an application it
simply appends the filename to your argument, urxvtc -e antiword | less will be
converted to

urxvtc -e antiword | less <filename>

of course this cannot work, but even

urxvtc -d antiword <filename> | less

wouldn't work, you cannot use pipes directly with urxvtc's -e option. instead
you have to wrap it with sh -c, so here is a wrapper script

#!/bin/bash 
urxvtc -e sh -c "antiword $1 | less" 

Btw. there is also a googledocs extension that can automatically load doc/docx/odt/... with google docs, it's located here.

Offline

#930 2012-07-26 13:22:35

brianb
Member
From: Montreal, QC
Registered: 2012-02-17
Posts: 61
Website

Re: dwb - a webkit web browser

portix wrote:

Btw. there is also a googledocs extension that can automatically load doc/docx/odt/... with google docs, it's located here.

Ah, cool! I'm trying to get it working by using an extensionrc, but I'm failing. Here's what I have:

#!javascript

return {
    googledocs : {
        shortcut            : "egd",
        initiallyEnabled    : false,
        filetypes           : [ "doc", "docx", "xls", "xlsx", "ppt", "pptx",
                                "odt", "ods", "pages", "ai", "psd", "tiff",
                                "dxf", "svg", "eps", "ps", "ttf", "otf", "xps",
                                "zip", "rar" ]
    }
}

This is saved as ~/.config/dwb/extensionrc, and I have the googledocs extension saved in ~/.local/share/dwb/extensions/, but it doesn't seem to load.

Do I need to add something to my userscript/ folder? I don't quite understand the difference between loading an extension with a userscript and loading it with an extensionrc.

Offline

#931 2012-07-26 13:40:02

portix
Member
Registered: 2009-01-13
Posts: 755

Re: dwb - a webkit web browser

You also need to load it with a userscript, even if you have an extensionsrc, i already thought about completely removing the extensionsrc, it is only useful for sharing settings. 
So you still must create a userscript either

#!javascript
extensions.load("googledocs");

or

#!javascript
extensions.load("googledocs", {
        shortcut            : "egd",
        initiallyEnabled    : false,
        filetypes           : [ "doc", "docx", "xls", "xlsx", "ppt", "pptx",
                                "odt", "ods", "pages", "ai", "psd", "tiff",
                                "dxf", "svg", "eps", "ps", "ttf", "otf", "xps",
                                "zip", "rar" ]
});

The reason why there are extensions at all is that extensions can also be loaded/unloaded from within dwb on the fly.

Offline

#932 2012-07-26 14:05:59

brianb
Member
From: Montreal, QC
Registered: 2012-02-17
Posts: 61
Website

Re: dwb - a webkit web browser

Gotcha. OK, works perfectly now.

portix wrote:

The reason why there are extensions at all is that extensions can also be loaded/unloaded from within dwb on the fly.

Yeah, this is definitely a plus.

Offline

#933 2012-07-26 17:56:25

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: dwb - a webkit web browser

Does sourceforge tracker work ok for everyone? I'm getting about:blank page.

Offline

#934 2012-07-27 02:07:04

Axiomatic
Member
Registered: 2012-05-15
Posts: 3

Re: dwb - a webkit web browser

I've been using this as my primary browser for a while. It's by far the best vimperator-like browser.
Thanks for making it.

Offline

#935 2012-07-27 09:33:56

onny
Member
From: Europe
Registered: 2010-08-07
Posts: 39
Website

Re: dwb - a webkit web browser

Axiomatic wrote:

I've been using this as my primary browser for a while. It's by far the best vimperator-like browser.
Thanks for making it.

agree!

Offline

#936 2012-08-01 20:42:37

OK100
Member
From: [U==]
Registered: 2010-04-26
Posts: 453

Re: dwb - a webkit web browser

I've noticed huge memory usage when downloading big files. Right now I have only one tab opened while downloading 1.4GB file (1.3GB already downloaded) and dwb uses 1.6GB of RAM which still increases as the download is progressing. I'm using latest version from git.

Last edited by OK100 (2012-08-01 20:44:03)

Offline

#937 2012-08-01 21:31:25

portix
Member
Registered: 2009-01-13
Posts: 755

Re: dwb - a webkit web browser

dwb uses the builtin download mechanism of webkitgtk, i won't implement a different download mechanism, so you either have to use an external downloader or hope that webkitgtk reduces memory usage for downloads.

Offline

#938 2012-08-01 22:02:15

ignorant
Member
Registered: 2012-06-09
Posts: 50

Re: dwb - a webkit web browser

I'm really late to this thread, but just a suggestion for dwb: Swap out Webkit's JavascriptCore for v8: http://code.google.com/p/v8/ . Otherwise, great work!

Last edited by ignorant (2012-08-01 22:02:47)

Offline

#939 2012-08-01 22:17:05

portix
Member
Registered: 2009-01-13
Posts: 755

Re: dwb - a webkit web browser

ignorant wrote:

I'm really late to this thread, but just a suggestion for dwb: Swap out Webkit's JavascriptCore for v8: http://code.google.com/p/v8/ . Otherwise, great work!

That is not possible, JavaScriptCore is part of webkitgtk. You would need a webkitgtk-build that uses v8. I read about a webkitgtk-fork about a year ago that used v8 but i'm not sure if this fork was ever usable.

Offline

#940 2012-08-03 09:19:48

jsteel
Trusted User (TU)
From: England
Registered: 2008-03-18
Posts: 115

Re: dwb - a webkit web browser

Sometimes furthest right in the status bar I see what looks like [P] with a strike-through. What does that mean? I'm using the latest hg version. I wonder if it's the progress bar glitching out.

Thanks


PGP key: F40D2072
Key fingerprint: 8742 F753 5E7B 394A 1B04  8163 332C 9C40 F40D 2072

Offline

#941 2012-08-03 09:55:18

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

Re: dwb - a webkit web browser

It means, that there are plugins required on the website you're on, but you didn't allow them for this site. Type 'ph' to allow them for the currenst host.

Offline

#942 2012-08-07 10:05:01

theGunslinger
Member
Registered: 2011-05-20
Posts: 298

Re: dwb - a webkit web browser

Sometimes I can't connect to facebook and I'm getting this error message:

Error parsing message: too many header bytes seen; overflow detected

I can open the page in other browsers.

Offline

#943 2012-08-11 16:25:03

portix
Member
Registered: 2009-01-13
Posts: 755

Re: dwb - a webkit web browser

I have created a script that replaces all videos on youtube with a html5 video, even if html5 isn't available. It creates a small bar where the quality can be chosen (also with hints).
Here is a screenshot
tZjJqMA
The script is as follows

#!javascript
// vim:set ft=javascript:

var config = {
  togglePlay : "yp",
  autoplay : true, 
  controls : true,

  // possible qualities : 1080p, 720p, 480p, 360p, 240p 
  defaultQuality : "720p",
  excludeQuality : [  ],
  
  // possible formats : x-flv, webm, mp4, 3gpp
  preferredFormat : "mp4",
  excludeFormat : [ "webm" ],

  
  foregroundActive : "#008000",
  foregroundColor : "#fff", 
  backgroundColor : "#000", 
  linkColor : "#999", 

  backgroundDisabled : "#555", 
  foregroundDisabled : "#aaa", 
  separator : "1px solid #666",
  font : "10px helvetica",
  linkFont : "bold 10px helvetica",

  playerHeight : "376px",
  playerWidth : "640px"
};

function documentLoadedCallback(wv, frame) {
  var i;
  if (frame != wv.mainFrame) 
    return;
  if (frame.domain != "youtube.com") 
    return;

  var id = wv.uri.replace(/.*(\?v=|\/v\/)([^$&]+).*/, '$2');
  if (id == wv.uri) {
    return;
  }
  var el = [ "&el=embedded", "&el=detailpage", "&el=vevo" ];
  var result = null;
  for (i=0; i<3 && result === null; ++i) {
    var url = "http://youtube.com/get_video_info?video_id=" + id + el[i];
    var data = sendRequestSync(url);
    if (data.status = 200 && data.body.substring(0, 11) != "status=fail") 
      result = data.body;
  }
  if (result === null) {
    return;
  }
  var decoded = decodeURI(result);
  i = decoded.indexOf("&url_encoded_fmt_stream_map=");
  if (i == -1) {
    return;
  }
  decoded = decodeURIComponent(decoded.substring(i));
  var preUrls = decoded.split(/url=/);
  var urls = [];
  var q = { 
    "1080p" : [], 
    "720p"  : [], 
    "480p"  : [], 
    "360p"  : [], 
    "240p"  : []
  };
  for (i=0; i<preUrls.length; i++) {
    var end = preUrls[i].search(/&type=/);
    if (end > -1) {
      var endString = preUrls[i].substring(end + 12); // &type=video/<format>
      var format = endString.substring(0, endString.search(/[;&]/));
      var itag = parseInt(preUrls[i].replace(/.*&itag=([0-9]+).*/, '$1'), 10);
      if (config.excludeFormat.indexOf(format) != -1) 
        continue;
      var o= { url : preUrls[i].substring(0, end), itag : itag, format : format };
      switch (itag) {
        case 38: 
        case 46: 
        case 37: 
          if (config.excludeQuality.indexOf("1080p") == -1) 
            q["1080p"].push(o); 
          break;
        case 22: 
        case 45: 
          if (config.excludeQuality.indexOf("720p") == -1) 
            q["720p"].push(o); 
          break;
        case 44: 
        case 35: 
          if (config.excludeQuality.indexOf("480p") == -1) 
            q["480p"].push(o); 
          break;
        case 34: 
        case 43: 
        case 18: 
          if (config.excludeQuality.indexOf("360p") == -1) 
            q["360p"].push(o); 
          break;
        default : q["240p"].push(o); break;
      }
    }
  }
  var script = "(" + String(injectFunction) + ")(" + JSON.stringify(config) + 
      ", " + JSON.stringify(q) + ");";
  
  frame.inject(script);
}
var injectFunction = function (config, q) {
  var i;
  var d = document.getElementById("watch-player");
  var f = document.createElement("table");
  var id = "dwb_video_player";

  f.innerHTML = 
    "  <tr align='center' >" + 
    "    <td colspan='10' >" +
    "      <video id='" + id + "' style='margin-bottom:-3px;position:relative;padding:0px'" +
    "          width='" + config.playerWidth + "' " +  
    "          height='" + config.playerHeight + "' " +  
    "          src=''" +
    "          controls />" +
    "    </td>" +
    "  </tr>" +
    "  <tr align='left' >" +
    "    <td style='top:0px'><div onclick id='" + id + "1080p'>1080p</div>" + 
    "     <td><a id='" + id + "1080plink' href='' >link</a></td>" +
    "    <td style='1px solid #333'><div onclick id='" + id + "720p'>720p</div>" + 
    "     <td><a id='" + id + "720plink' href='' >link</a></td>" +
    "    <td style='1px solid #333'><div onclick id='" + id + "480p'>480p</div>" + 
    "     <td><a id='" + id + "480plink' href='' >link</a></td>" +
    "    <td style='1px solid #333'><div onclick id='" + id + "360p'>360p</div>" + 
    "     <td><a id='" + id + "360plink' href='' >link</a></td>" + 
    "    <td style='1px solid #333'><div onclick id='" + id + "240p'>240p</div>" + 
    "     <td><a id='" + id + "240plink' href='' >link</a></td>" +
    "  </tr>";
  var v = f.querySelector("#" + id);
  v.controls =  config.controls;
  v.autoplay = config.autoplay;
  var last = null;
  
  var qualities = [ "1080p", "720p", "480p", "360p", "240p" ];
  function getUrl (key) {
    if (q[key].length === 0) 
      return "";
    var url = null;
    for (var j=0; j<q[key].length && url === null; j++) {
      if (q[key][j].format === config.preferredFormat)  {
        url = q[key][j].url;
      }
    }
    return url === null ? q[key][0].url : url;
  }
  for (i=0; i<qualities.length; i++) {
    (function (key) {
        var c = f.querySelector("#" + id + key);
        var l = f.querySelector("#" + id + key + "link");
        var url = getUrl(key);
        if (q[key].length > 0) {
          c.style.cursor = "pointer";
          c.style.backgroundColor = config.backgroundColor;
          c.style.color = config.foregroundColor;
          l.style.font = config.linkFont;
          l.style.textDecoration = "none";
          l.style.color = config.linkColor;
          c.onclick = function () { 
            v.src = url;
            last.style.color = config.foregroundColor;
            c.style.color = config.foregroundActive;
            last = c;
          };
          l.href = url;
        }
        else {
          c.removeAttribute("onclick");
          c.parentNode.style.backgroundColor = config.backgroundDisabled;
          l.parentNode.style.backgroundColor = config.backgroundDisabled;
          c.style.color = config.foregroundDisabled;
          l.style.visibility = "hidden";
        }
        c.style.borderLeft = config.separator;
        c.style.font = config.font;
    })(qualities[i]);
  }
  var current = null;
  if (q[config.defaultQuality].length > 0) {
    current = config.defaultQuality;
  }
  else {
    for (i=qualities.indexOf(config.defaultQuality)+1; i<qualities.length && current === null; i++) {
      var key = qualities[i];
      if (q[key].length > 0) {
        current = key;
      }
    }
  }
  var c = f.querySelector("#" + id + current);
  c.style.color = config.foregroundActive;
  last = c;
  v.src = getUrl(current);

  while(d.hasChildNodes()) 
    d.removeChild(d.firstChild);
  d.appendChild(f);
};
function togglePlay() {
  var frame = tabs.current.mainFrame;
  if (frame.domain != "youtube.com") 
    return;
  var playFunction = function() {
    var v = document.getElementById("dwb_video_player");
    if (v.paused) 
      v.play();
    else 
      v.pause();
  };
  frame.inject(util.getBody(playFunction));
}

signals.connect("documentLoaded", documentLoadedCallback);
bind(config.togglePlay, togglePlay);

There are some config options at the beginning of the script.
I hope someone finds it useful.

Offline

#944 2012-08-11 16:50:08

jakob
Member
From: Berlin
Registered: 2005-10-27
Posts: 419

Re: dwb - a webkit web browser

portix wrote:

I have created a script that replaces all videos on youtube with a html5 video, even if html5 isn't available. It creates a small bar where the quality can be chosen (also with hints).

[…]

There are some config options at the beginning of the script.
I hope someone finds it useful.

Thanks alot! Since this is my first try with scripts in dwb, I run into the following error when starting dwb:

DWB EXTENSION ERROR: extension html5: Error in line 1 parsing /home/jakob/.local/share/dwb/extensions/html5
STACK: [getPlugin] [value] [anonymous] [[native code]]
DWB EXTENSION ERROR: extension html5: Couldn't find extension.
STACK: [value] [anonymous] [[native code]]

I created ~/.conf/dwb/userscripts/userscripts saying:

#!javascript

extensions.load("html5");

and copied (plus chmod +x'ed) the script to ~/.local/share/dwb/extensions/html5.

Am I still missing some things?

Thanks for any hint!

J

Last edited by jakob (2012-08-11 16:50:54)

Offline

#945 2012-08-12 08:53:35

portix
Member
Registered: 2009-01-13
Posts: 755

Re: dwb - a webkit web browser

You can just put the script in ~/.config/dwb/userscripts.

Offline

#946 2012-08-12 09:09:07

bslackr
Member
Registered: 2012-01-27
Posts: 131

Re: dwb - a webkit web browser

Would it be possible to make this script work for embedded youtube videos?

Offline

#947 2012-08-12 11:35:53

Onyros
Member
From: Lisbon, Portugal
Registered: 2007-10-11
Posts: 293

Re: dwb - a webkit web browser

portix wrote:

I have created a script that replaces all videos on youtube with a html5 video, even if html5 isn't available. It creates a small bar where the quality can be chosen (also with hints).
Here is a screenshot
http://ompldr.org/tZjJqMA
The script is as follows

snippety snip snip

There are some config options at the beginning of the script.
I hope someone finds it useful.

The script loads, the little bar is displayed and there's a video window displayed with the given dimensions... but it just won't play any video - tried many different ones, even ones that I uploaded and know they'll play in HTML5. Are there any possible dependencies I may not have? Would love this instead of Flash Youtube video.

Offline

#948 2012-08-12 11:49:43

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

Re: dwb - a webkit web browser

Same experience like Onyros.. sad

Offline

#949 2012-08-12 11:51:44

Onyros
Member
From: Lisbon, Portugal
Registered: 2007-10-11
Posts: 293

Re: dwb - a webkit web browser

This is the error it's showing when I try to play videos:

NPP_Initialize()
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)

Using ALSA. if that's any help. Tried reading something around and it usually showed it being related whether to PulseAudio (which I don't use), or Bluetooth - which I also don't use.

Offline

#950 2012-08-12 13:42:42

portix
Member
Registered: 2009-01-13
Posts: 755

Re: dwb - a webkit web browser

To be honest, i don't know why it doesn't work for you, it works here with every video i have tested so far. The only requirements should be the codecs and the gstreamer-plugins. I think the NPP_Initialize error is an error of gecko-mediaplayer but i'm not sure. Do you have mozplugger installed?

Offline

Board footer

Powered by FluxBB