change default font size. add subscribe feed.
authorJoerg Jaspert <joerg@ganneff.de>
Fri, 12 Apr 2013 13:34:12 +0000 (15:34 +0200)
committerJoerg Jaspert <joerg@ganneff.de>
Fri, 12 Apr 2013 13:34:12 +0000 (15:34 +0200)
.conkerorrc/basics.js
.conkerorrc/functions.js

index 43856a1..103ed05 100644 (file)
@@ -128,7 +128,7 @@ user_pref("signon.rememberSignons", true);
 // Allow extensions (like Adblock Plus) to be installed
 session_pref("xpinstall.whitelist.required", false);
 
-session_pref("font.minimum-size.x-western", 14);
+session_pref("font.minimum-size.x-western", 13);
 session_pref("font.name.serif.x-western", "Bitstream Vera Serif");
 session_pref("font.name.monospace.x-western", "Bitstream Vera Sans Mono");
 session_pref("font.name.sans-serif.x-western", "Bitstream Vera Sans");
index 4134df7..28c0514 100644 (file)
@@ -125,3 +125,83 @@ let(st_on = false) {
   };
 };
 
+function subscribe_feed(I){
+    var f=false;
+    var reader = 'http://www.newsblur.com/?url=';
+    var document= I.buffer.document;
+    var ls=document.getElementsByTagName("link");
+    for(var i=0,l;l=ls[i];i++){
+        var t=l.getAttribute('type');
+        var r=l.getAttribute('rel');
+        if(t&&(t=='application/rss+xml'||t=='application/atom+xml')&&r&&r=='alternate'){
+            var h= l.getAttribute('href');
+            if(h.indexOf('http')!=0){
+                var p=(h.indexOf('/')!=0)?'/':document.location.pathname;
+                h='http://'+document.location.hostname+p+h;
+            }
+            document.location=reader+h;
+            f=true;
+        }}
+    if(!f) I.minibuffer.message('Oops. Can\'t find a feed.');
+};
+
+function subscribe_feed_all(I){
+    var document=I.buffer.document;
+    var reader = 'http://www.newsblur.com/?url=';
+    var el=document.createElement('div');
+    el.style.zIndex=10000;
+    el.style.position='absolute';
+    el.style.padding='2em';
+    el.style.top=0;
+    el.style.backgroundColor='#ffffcc';
+    el.style.border='1px solid #008000';
+    el.style.color='#000 !important';
+    el.style.fontFamily='Arial, sans-serif';
+    el.style.textAlign='left';
+    el.innerHTML='View the following feeds in Newsblur:';
+    var found = false;
+    var links = document.getElementsByTagName('link');
+    for (var i = 0, link;link = links[i];i++) {
+        var type = link.getAttribute('type');
+        var rel = link.getAttribute('rel');
+        var title = link.getAttribute('title');
+        if (type && (type == 'application/rss+xml' || type == 'application/atom+xml') && rel && rel == 'alternate'){
+            var href = link.getAttribute('href');
+            if (!href.match(/^http/)){
+                var path = (href.match(/^\//)) ? '/' : document.location.pathname;
+                href='http://' + document.location.hostname + path + href;
+            }
+            var previewLink = document.createElement('a');
+            previewLink.href = reader + href;
+            previewLink.innerHTML = ((title) ? title : '') + ' - ' + href;
+            previewLink.style.display='block';
+            previewLink.style.color='#00c';
+            previewLink.style.textDecoration='underline';
+            el.appendChild(previewLink);
+            found = true;
+        }}
+    var close=document.createElement('a');
+    close.innerHTML='hhh Hide this box hhh';
+    close.href='#';
+    close.style.display='block';
+    close.style.marginTop='2em';
+    close.style.color='#00c';
+    close.style.textDecoration='underline';
+    close.addEventListener('click',function() {
+                                   el.style.display='none';
+                                   return false;
+                               }, true);
+    el.appendChild(close);
+    function AddFeedBox() {
+        document.body.insertBefore(el, document.body.firstChild);
+        el.scrollIntoView();
+    }
+    if (!found) I.minibuffer.message('Oops. Can\'t find any feeds for this page.');
+    else void(AddFeedBox());
+};
+interactive("subscribe-feed", "C-u Subscribes to first encountered feed."
+            + "C-u C-u Pops-up a box with all available feeds on the page.",
+            alternates(subscribe_feed, subscribe_feed_all)
+);
+
+define_key(default_global_keymap, "C-c s", "subscribe-feed");