.vimperatorrc
changeset 14 16fe27af1a8b
parent 12 2840d13cb173
child 18 136028f70fa4
equal deleted inserted replaced
0:b4e3447c527c 1:5df249c6df16
    37 " plugin/copy.js
    37 " plugin/copy.js
    38 map ,c :copy <SPC>
    38 map ,c :copy <SPC>
    39 javascript <<EOM
    39 javascript <<EOM
    40 (function(){
    40 (function(){
    41 function get_tus(w, d) {
    41 function get_tus(w, d) {
    42     var win = new XPCNativeWrapper(w.content.window);
    42     var t = content.document.title;
    43     var s = win.getSelection().getRangeAt(0).toString();
    43     var u = content.location.href;
    44     var t = liberator.buffer.title;
    44     var s = content.window.getSelection().getRangeAt(0).toString();
    45     var u = liberator.buffer.URL;
       
    46     return [t, u, s];
    45     return [t, u, s];
    47 }
    46 }
    48 liberator.globalVariables.copy_templates = [
    47 liberator.globalVariables.copy_templates = [
    49    { label: 't',         value: '%TITLE%' },
    48    { label: 't',         value: '%TITLE%' },
    50    { label: 'tu',        value: '%TITLE% - %URL%' },
    49    { label: 'tu',        value: '%TITLE% - %URL%' },
    60        var [t, u, s] = get_tus(window, document);
    59        var [t, u, s] = get_tus(window, document);
    61        s = s.replace(/\n/, "\n  ");
    60        s = s.replace(/\n/, "\n  ");
    62        return t + ":\n  - " + u + (s? ("\n  >>\n  " + s + "\n  <<"): '');
    61        return t + ":\n  - " + u + (s? ("\n  >>\n  " + s + "\n  <<"): '');
    63    }},
    62    }},
    64    { label: 'datestr',  custom: function() {
    63    { label: 'datestr',  custom: function() {
    65        return '[' +  liberator.buffer.URL.match(/\d\d\d\d-\d\d-\d\d-\d+/) + ']';
    64        return '[' +  content.location.href.match(/\d\d\d\d-\d\d-\d\d-\d+/) + ']';
    66    }},
    65    }},
    67 ];
    66 ];
    68 })();
    67 })();
    69 EOM
    68 EOM
    70 
    69