rem
stringlengths
0
126k
add
stringlengths
0
441k
context
stringlengths
15
136k
}
};
return function() { var i; var nes = new JSNES({ emulateSound: true, ui: JSNES.DummyUI }); nes.loadRom(croomRom); nes.setLimitFrames(false); nes.isRunning = true; for (i=0; i<5; i++) { nes.frame(); } // Hit enter on start screen to start scrolling nes.keyboard.keyDown({keyCode: 13}); nes.frame(); nes.keyboard.keyUp({keyCode: 13}); for (i=0; i<94; i++) { nes.frame(); } }
if(separatorPostion > 0 && separatorPostion<len && idx >= len-separatorPostion) {
if(separatorPosition > 0 && separatorPosition<len && idx >= len-separatorPosition) {
objects.forEach(function(object) { if (object) { //Get the name value. If value key is not specified convert obj //to string name = nameKey ? (object.get ? object.get(nameKey) : object[nameKey]) : object.toString() ; // localize name if specified. name = shouldLocalize? name.loc() : name ; //Get the icon value icon = iconKey ? (object.get ? object.get(iconKey) : object[iconKey]) : null ; if (SC.none(object[iconKey])) icon = null ; // get the value using the valueKey or the object value = (valueKey) ? (object.get ? object.get(valueKey) : object[valueKey]) : object ; if (!SC.none(currentSelectedVal) && !SC.none(value)){ if(this._equals(currentSelectedVal, value) ) { this.set('title', name) ; this.set('icon', icon) ; } } //Check if the item is currentSelectedItem or not if(this._equals(value, this.get('value'))) { // increase index by 1 if item falls below the separator in menu list if(separatorPostion > 0 && separatorPostion<len && idx >= len-separatorPostion) { idx++ ; } //set the itemIdx - To change the prefMatrix accordingly. this.set('itemIdx', idx) ; isChecked = !checkboxEnabled ? NO : YES ; } else { isChecked = NO ; } //Check if item is enabled itemEnabled = (isEnabledKey) ? (object.get ? object.get(isEnabledKey) : object[isEnabledKey]) : object ; if(NO !== itemEnabled) itemEnabled = YES ; //Set the first item from the list as default selected item if (idx === 0) { this._defaultVal = value ; this._defaultTitle = name ; this._defaultIcon = icon ; } var item = SC.Object.create({ title: name, icon: icon, value: value, isEnabled: itemEnabled, checkbox: isChecked, target: this, action: 'displaySelectedItem' }) ; //Set the items in the itemList array itemList.push(item); } idx += 1 ; // display the separator if specified by the user if (separatorPostion && idx === (len-separatorPostion)) { var separator = SC.Object.create({ separator: YES }) ; itemList.push(separator); } this.set('itemList', itemList) ; }, this ) ;
if (separatorPostion && idx === (len-separatorPostion)) {
if (separatorPosition && idx === (len-separatorPosition)) {
objects.forEach(function(object) { if (object) { //Get the name value. If value key is not specified convert obj //to string name = nameKey ? (object.get ? object.get(nameKey) : object[nameKey]) : object.toString() ; // localize name if specified. name = shouldLocalize? name.loc() : name ; //Get the icon value icon = iconKey ? (object.get ? object.get(iconKey) : object[iconKey]) : null ; if (SC.none(object[iconKey])) icon = null ; // get the value using the valueKey or the object value = (valueKey) ? (object.get ? object.get(valueKey) : object[valueKey]) : object ; if (!SC.none(currentSelectedVal) && !SC.none(value)){ if(this._equals(currentSelectedVal, value) ) { this.set('title', name) ; this.set('icon', icon) ; } } //Check if the item is currentSelectedItem or not if(this._equals(value, this.get('value'))) { // increase index by 1 if item falls below the separator in menu list if(separatorPostion > 0 && separatorPostion<len && idx >= len-separatorPostion) { idx++ ; } //set the itemIdx - To change the prefMatrix accordingly. this.set('itemIdx', idx) ; isChecked = !checkboxEnabled ? NO : YES ; } else { isChecked = NO ; } //Check if item is enabled itemEnabled = (isEnabledKey) ? (object.get ? object.get(isEnabledKey) : object[isEnabledKey]) : object ; if(NO !== itemEnabled) itemEnabled = YES ; //Set the first item from the list as default selected item if (idx === 0) { this._defaultVal = value ; this._defaultTitle = name ; this._defaultIcon = icon ; } var item = SC.Object.create({ title: name, icon: icon, value: value, isEnabled: itemEnabled, checkbox: isChecked, target: this, action: 'displaySelectedItem' }) ; //Set the items in the itemList array itemList.push(item); } idx += 1 ; // display the separator if specified by the user if (separatorPostion && idx === (len-separatorPostion)) { var separator = SC.Object.create({ separator: YES }) ; itemList.push(separator); } this.set('itemList', itemList) ; }, this ) ;
matches = array.nth(tabs.allTabs, function (t) t.linkedBrowser.lastURI.spec === buffer, 0);
matches = array.nth(tabs.allTabs, function (t) (t.linkedBrowser.lastURI || {}).spec === buffer, 0);
matches = array.nth(tabs.allTabs, function (t) t.linkedBrowser.lastURI.spec === buffer, 0);
util.timeout(function () { doc.body.removeChild(indicator); }, 500);
commandline.input("Upload file: ", function (path) { let file = io.File(path); dactyl.assert(file.exists()); elem.value = file.path; }, {
util.timeout(function () { doc.body.removeChild(indicator); }, 500);
function () { dactyl.assert(tabs.count > 1, "Can't detach the last tab");
function (args) { let tab = tabs.getTab();
function () { dactyl.assert(tabs.count > 1, "Can't detach the last tab"); tabs.detachTab(null); },
tabs.detachTab(null); },
let activate = args.bang ? true : false; if (options.get("activate").has("tabopen", "all")) activate = !activate; for (let i in util.range(0, Math.max(1, args.count))) tabs.cloneTab(tab, activate); }, {
function () { dactyl.assert(tabs.count > 1, "Can't detach the last tab"); tabs.detachTab(null); },
dactyl.execute(command);
commands.execute(command);
this.registerCallback("submit", modes.EX, function (command) { try { var readHeredoc = io.readHeredoc; io.readHeredoc = commandline.readHeredoc; commands.repeat = command; dactyl.execute(command); } finally { io.readHeredoc = readHeredoc; } });
util.timeout(function () { doc.body.removeChild(indicator); }, 500);
.filter(function (frame) !frame.frameElement || let (rect = frame.frameElement.getBoundingClientRect()) rect.width && rect.height);
util.timeout(function () { doc.body.removeChild(indicator); }, 500);
this.registerCallback("submit", modes.EX, function (command) { try { var readHeredoc = io.readHeredoc; io.readHeredoc = commandline.readHeredoc; commands.repeat = command; commands.execute(command); } finally { io.readHeredoc = readHeredoc; }
this.__defineGetter__("_completionList", function () { let node = this.widgets.active.commandline; if (!node._completionList) node._completionList = ItemList("dactyl-completions-" + node.id); return node._completionList;
this.registerCallback("submit", modes.EX, function (command) { try { var readHeredoc = io.readHeredoc; io.readHeredoc = commandline.readHeredoc; commands.repeat = command; commands.execute(command); } finally { io.readHeredoc = readHeredoc; } });
completion.file(context, true, dir + context.filter);
completion.file(context, args, true, dir + context.filter);
context.fork(dir, 0, this, function (context) { dir = dir.replace("/+$", "") + "/"; completion.file(context, true, dir + context.filter); context.title[0] = dir; context.keys.text = function (f) f.path.substr(dir.length); });
context.fork(dir, 0, this, function (context) { dir = dir.replace("/+$", "") + "/"; completion.file(context, true, dir + context.filter); context.title[0] = dir; context.keys.text = function (f) f.path.substr(dir.length); });
context.filters.push(function ({ item }) item.isDirectory() || !wig.getKey(this.name));
context.fork(dir, 0, this, function (context) { dir = dir.replace("/+$", "") + "/"; completion.file(context, true, dir + context.filter); context.title[0] = dir; context.keys.text = function (f) f.path.substr(dir.length); });
help: function (map) let (char = array.compact(map.modes.map(function (m) m.char))[0])
function (context, obj, args) { let mode = args[0]; return array.flatten([ [[name, map.description] for ([i, name] in Iterator(map.names))] for ([i, map] in Iterator(mappings._user[mode].concat(mappings._main[mode]))) ]); }
help: function (map) let (char = array.compact(map.modes.map(function (m) m.char))[0])
$("#popup_ok, #popup_cancel").keypress( function(e) { if( e.keyCode == 13 ) $("#popup_ok").trigger('click'); if( e.keyCode == 27 ) $("#popup_cancel").trigger('click');
$("#popup_cancel").click( function() { $.alerts._hide(); if( callback ) callback(false);
$("#popup_ok, #popup_cancel").keypress( function(e) { if( e.keyCode == 13 ) $("#popup_ok").trigger('click'); if( e.keyCode == 27 ) $("#popup_cancel").trigger('click'); });
ps.tags.forEach(function(tag){ this.injectCandidates(tag, true, false); }, this);
.addCallback(function(res){ self.arrangeSuggestions(res); self.setSuggestions(res); self.setTags(res.tags); removeElementClass(self.suggestionIcon, 'loading'); addElementClass(self.suggestionIcon, 'loaded'); connect(self.suggestionIcon, 'onclick', self, 'toggleSuggestions'); if(self.suggestionShownDefault){ self.toggleSuggestions(); } }).addErrback(function(e){
ps.tags.forEach(function(tag){ this.injectCandidates(tag, true, false); }, this);
chrome.extension.onRequest.addListener(function(req, sender, func){ var handler = onRequestsHandlers[req.request]; handler && handler.apply(this, arguments); });
chrome.tabs.captureVisibleTab(sender.tab.windowId, function(data){ func(data); });
chrome.extension.onRequest.addListener(function(req, sender, func){ var handler = onRequestsHandlers[req.request]; handler && handler.apply(this, arguments);});
function () { editor.expandAbbreviation(modes.INSERT); document.commandDispatcher.advanceFocus(); });
function () { editor.expandAbbreviation(modes.INSERT); },
function () { editor.expandAbbreviation(modes.INSERT); document.commandDispatcher.advanceFocus(); });
let type = ["-builtin", "-ex", "-javascript", "-keys"].reduce(function (a, b) args[b] ? b : a, default_);
let sorted = this._exCommands.sort(function (a, b) a.name > b.name);
let type = ["-builtin", "-ex", "-javascript", "-keys"].reduce(function (a, b) args[b] ? b : a, default_);
chrome.tabs.captureVisibleTab(sender.tab.windowId, function(data){ func(data); });
getSelected().addCallback(function(tab){ var ps = req.content; if(req.show){ TBRL.Popup.open(tab, ps); } else { var posters = Models.getDefaults(ps); if(!posters.length){ alert(chrome.i18n.getMessage('error_noPoster', ps.type.capitalize())); } else { TBRL.Service.post(ps, posters); } } func({}); }).addErrback(function(e){
chrome.tabs.captureVisibleTab(sender.tab.windowId, function(data){ func(data); });
commandline.open(":",
commandline.open("",
function () { let options = {}; let bmarks = bookmarks.get(buffer.URL).filter(function (bmark) bmark.url == buffer.URL); if (bmarks.length == 1) { let bmark = bmarks[0]; options["-title"] = bmark.title; if (bmark.keyword) options["-keyword"] = bmark.keyword; if (bmark.tags.length > 0) options["-tags"] = bmark.tags.join(", "); } else { if (buffer.title != buffer.URL) options["-title"] = buffer.title; } commandline.open(":", commands.commandToString({ command: "bmark", options: options, arguments: [buffer.URL], bang: bmarks.length > 1 }), modes.EX); });
chrome.extension.onRequest.addListener(function(req, sender, func){ var handler = onRequestsHandlers[req.request]; handler && handler.apply(this, arguments); });
logins.uniq().forEach(function(url){ chrome.tabs.create({ windowId: win.id, url: url, selected: false }); });
chrome.extension.onRequest.addListener(function(req, sender, func){ var handler = onRequestsHandlers[req.request]; handler && handler.apply(this, arguments);});
context.filters.push(function (item) item.isdir);
function (m) /^\\(\\\\)*!$/.test(m) ? m.replace("\\!", "!") : m.replace("!", io._lastRunCommand) );
context.filters.push(function (item) item.isdir);
dactyl.open(args[0] || "about:blank", { from: "tabopen", where: dactyl.NEW_TAB, background: args.bang });
let arg = args[0]; dactyl.assert(!arg || /^([+-]?\d+)$/.test(arg), "E488: Trailing characters"); tabs.move(config.tabbrowser.mCurrentTab, arg || "$", args.bang);
function (args) { dactyl.open(args[0] || "about:blank", { from: "tabopen", where: dactyl.NEW_TAB, background: args.bang }); }, {
c = confirm('Are you sure you want to delete this item? This action cannot be undone.');
trgt = this; action = $(this).attr("rel"); selector = '[rel="' + action + '"]'; containingList = $(selector).parent().parent().parent(); sectionNamePlural = $(containingList).closest("div").find("h3")[0] .childNodes[0].textContent .replace(/\s+$/, '') .toLowerCase(); sectionNameSingular = sectionNamePlural.substring(0, sectionNamePlural.length - 1); c = confirm('Are you sure you want to delete this ' + sectionNameSingular + '? This action cannot be undone.');
$("a.delete").live("click", function () { c = confirm('Are you sure you want to delete this item? This action cannot be undone.'); if (c) { trgt = this; action = $(this).attr("rel"); $.post(action, $.param({'delete': true}), function (data) { selector = '[rel="' + action + '"]'; if (data['deleted']) { containingList = $(selector).parent().parent().parent(); $(selector).parent().parent().remove(); if (!$(containingList).children().length) { $(containingList).append('<li class="empty">No ' + $(containingList).closest("div").find("h3").text().toLowerCase() + ' defined.</li>'); } $(containingList).trigger('changeLength'); } else { $(selector).insertAfter('<span class="fail">An error occurred.</span>'); $("span.fail").delay(1500).fadeOut("fast", function () { $(this).remove(); }); } }, "json"); } return false; });
trgt = this; action = $(this).attr("rel");
$("a.delete").live("click", function () { c = confirm('Are you sure you want to delete this item? This action cannot be undone.'); if (c) { trgt = this; action = $(this).attr("rel"); $.post(action, $.param({'delete': true}), function (data) { selector = '[rel="' + action + '"]'; if (data['deleted']) { containingList = $(selector).parent().parent().parent(); $(selector).parent().parent().remove(); if (!$(containingList).children().length) { $(containingList).append('<li class="empty">No ' + $(containingList).closest("div").find("h3").text().toLowerCase() + ' defined.</li>'); } $(containingList).trigger('changeLength'); } else { $(selector).insertAfter('<span class="fail">An error occurred.</span>'); $("span.fail").delay(1500).fadeOut("fast", function () { $(this).remove(); }); } }, "json"); } return false; });
selector = '[rel="' + action + '"]';
$("a.delete").live("click", function () { c = confirm('Are you sure you want to delete this item? This action cannot be undone.'); if (c) { trgt = this; action = $(this).attr("rel"); $.post(action, $.param({'delete': true}), function (data) { selector = '[rel="' + action + '"]'; if (data['deleted']) { containingList = $(selector).parent().parent().parent(); $(selector).parent().parent().remove(); if (!$(containingList).children().length) { $(containingList).append('<li class="empty">No ' + $(containingList).closest("div").find("h3").text().toLowerCase() + ' defined.</li>'); } $(containingList).trigger('changeLength'); } else { $(selector).insertAfter('<span class="fail">An error occurred.</span>'); $("span.fail").delay(1500).fadeOut("fast", function () { $(this).remove(); }); } }, "json"); } return false; });
containingList = $(selector).parent().parent().parent();
$("a.delete").live("click", function () { c = confirm('Are you sure you want to delete this item? This action cannot be undone.'); if (c) { trgt = this; action = $(this).attr("rel"); $.post(action, $.param({'delete': true}), function (data) { selector = '[rel="' + action + '"]'; if (data['deleted']) { containingList = $(selector).parent().parent().parent(); $(selector).parent().parent().remove(); if (!$(containingList).children().length) { $(containingList).append('<li class="empty">No ' + $(containingList).closest("div").find("h3").text().toLowerCase() + ' defined.</li>'); } $(containingList).trigger('changeLength'); } else { $(selector).insertAfter('<span class="fail">An error occurred.</span>'); $("span.fail").delay(1500).fadeOut("fast", function () { $(this).remove(); }); } }, "json"); } return false; });
$(containingList).append('<li class="empty">No ' + $(containingList).closest("div").find("h3").text().toLowerCase() + ' defined.</li>');
$(containingList).append('<li class="empty">No ' + sectionNamePlural + ' defined.</li>');
$("a.delete").live("click", function () { c = confirm('Are you sure you want to delete this item? This action cannot be undone.'); if (c) { trgt = this; action = $(this).attr("rel"); $.post(action, $.param({'delete': true}), function (data) { selector = '[rel="' + action + '"]'; if (data['deleted']) { containingList = $(selector).parent().parent().parent(); $(selector).parent().parent().remove(); if (!$(containingList).children().length) { $(containingList).append('<li class="empty">No ' + $(containingList).closest("div").find("h3").text().toLowerCase() + ' defined.</li>'); } $(containingList).trigger('changeLength'); } else { $(selector).insertAfter('<span class="fail">An error occurred.</span>'); $("span.fail").delay(1500).fadeOut("fast", function () { $(this).remove(); }); } }, "json"); } return false; });
this.registerCallback("change", modes.PROMPT, function (str) {
this.registerCallback("complete", modes.PROMPT, function (context) {
this.registerCallback("change", modes.PROMPT, function (str) { if (self._input.complete) self._autocompleteTimer.tell(false); if (self._input.change) self._input.change.call(commandline, str); });
self._autocompleteTimer.tell(false); if (self._input.change) self._input.change.call(commandline, str);
context.fork("input", 0, commandline, self._input.complete);
this.registerCallback("change", modes.PROMPT, function (str) { if (self._input.complete) self._autocompleteTimer.tell(false); if (self._input.change) self._input.change.call(commandline, str); });
function () { commandline._messageHistory.clear(); },
template.map(commandline._messageHistory.messages, function (message) <div highlight={message.highlight + " Message"}>{message.message}</div>));;
function () { commandline._messageHistory.clear(); },
!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Va,"")}return w}var o=c.isFunction(a);return this.each(function(p){var n=c(this),t=a;if(this.nodeType===1){if(o)t=a.call(this,p,n.val());if(typeof t==="number")t+="";if(c.isArray(t)&&Aa.test(this.type))this.checked=c.inArray(n.val(),t)>=0;else if(c.nodeName(this,"select")){var z=c.makeArray(t);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),z)>=0});if(!z.length)this.selectedIndex= -1}else this.value=t}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var i=Wa.test(b);if(b in a&&f&&!i){if(e){if(b==="type"&&Xa.test(a.nodeName)&&a.parentNode)throw"type property can't be changed";a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;
e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");
!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Va,"")}return w}var o=c.isFunction(a);return this.each(function(p){var n=c(this),t=a;if(this.nodeType===1){if(o)t=a.call(this,p,n.val());if(typeof t==="number")t+="";if(c.isArray(t)&&Aa.test(this.type))this.checked=c.inArray(n.val(),t)>=0;else if(c.nodeName(this,"select")){var z=c.makeArray(t);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),z)>=0});if(!z.length)this.selectedIndex=-1}else this.value=t}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var i=Wa.test(b);if(b in a&&f&&!i){if(e){if(b==="type"&&Xa.test(a.nodeName)&&a.parentNode)throw"type property can't be changed";a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;
chrome.extension.onRequest.addListener(function(req, sender, func){ if(req.request === 'popup'){ var content = req.content; (content.title ? succeed(content.title):getTitle()).addCallback(function(title){ var ctx = update({ document :document, window : window, title : title, selection : window.getSelection().toString(), target : TBRL.target || document }, window.location); if(Extractors.Quote.check(ctx)){ var d = Extractors.Quote.extract(ctx); } else { var d = Extractors.Link.extract(ctx); } maybeDeferred(d).addCallback(function(ps){ func(update({ page : title, pageUrl : content.url }, ps)); });
connect(document, 'onDOMContentLoaded', null, function(ev){ d.callback(title_getter());
chrome.extension.onRequest.addListener(function(req, sender, func){ if(req.request === 'popup'){ var content = req.content; (content.title ? succeed(content.title):getTitle()).addCallback(function(title){ var ctx = update({ document :document, window : window, title : title, selection : window.getSelection().toString(), target : TBRL.target || document }, window.location); if(Extractors.Quote.check(ctx)){ var d = Extractors.Quote.extract(ctx); } else { var d = Extractors.Link.extract(ctx); } maybeDeferred(d).addCallback(function(ps){ func(update({ page : title, pageUrl : content.url }, ps)); }); }); }});
} });
chrome.extension.onRequest.addListener(function(req, sender, func){ if(req.request === 'popup'){ var content = req.content; (content.title ? succeed(content.title):getTitle()).addCallback(function(title){ var ctx = update({ document :document, window : window, title : title, selection : window.getSelection().toString(), target : TBRL.target || document }, window.location); if(Extractors.Quote.check(ctx)){ var d = Extractors.Quote.extract(ctx); } else { var d = Extractors.Link.extract(ctx); } maybeDeferred(d).addCallback(function(ps){ func(update({ page : title, pageUrl : content.url }, ps)); }); }); }});
}).addCallback(function(resses){ if(!resses['tags'][0] || !resses['data'][0]){ throw new Error(chrome.i18n.getMessage('error_notLoggedin', self.name)); } var data = resses['data'][1]; console.log('duplicated', !!data['bookmarked_data']); return { duplicated : !!data['bookmarked_data'], recommended : data['recommend_tags'], tags : resses['tags'][1] }
return Hatena.getToken().addErrback(function(e){ delete self['tags']; throw new Error(chrome.i18n.getMessage('error_notLoggedin', self.name));
}).addCallback(function(resses){ if(!resses['tags'][0] || !resses['data'][0]){ throw new Error(chrome.i18n.getMessage('error_notLoggedin', self.name)); } var data = resses['data'][1]; console.log('duplicated', !!data['bookmarked_data']); return { duplicated : !!data['bookmarked_data'], recommended : data['recommend_tags'], tags : resses['tags'][1] } });
function (args) { let tab = tabs.getTab();
function () { dactyl.assert(tabs.count > 1, "Can't detach the last tab");
function (args) { let tab = tabs.getTab(); let activate = args.bang ? true : false; if (options.get("activate").has("tabopen", "all")) activate = !activate; for (let i in util.range(0, Math.max(1, args.count))) tabs.cloneTab(tab, activate); }, {
let activate = args.bang ? true : false; if (options.get("activate").has("tabopen", "all")) activate = !activate; for (let i in util.range(0, Math.max(1, args.count))) tabs.cloneTab(tab, activate); }, {
tabs.detachTab(null); },
function (args) { let tab = tabs.getTab(); let activate = args.bang ? true : false; if (options.get("activate").has("tabopen", "all")) activate = !activate; for (let i in util.range(0, Math.max(1, args.count))) tabs.cloneTab(tab, activate); }, {
dactyl.trapErrors(function () { if (self._completions) self._completions.tab(event.shiftKey, event.altKey && options["altwildmode"]); });
function (node) ItemList(node.id));
dactyl.trapErrors(function () { if (self._completions) self._completions.tab(event.shiftKey, event.altKey && options["altwildmode"]); });
this.each(function(value, index) { if (iterator.call(context, value, index)) { result = value; throw $break; } });
var Prototype={Version:"1.6.1",Browser:(function(){var b=navigator.userAgent;var a=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!a,Opera:a,WebKit:b.indexOf("AppleWebKit/")>-1,Gecko:b.indexOf("Gecko")>-1&&b.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile.*Safari/.test(b)}})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var a=window.Element||window.HTMLElement;return !!(a&&a.prototype)})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true}var c=document.createElement("div");var b=document.createElement("form");var a=false;if(c.__proto__&&(c.__proto__!==b.__proto__)){a=true}c=b=null;return a})()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(a){return a}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Abstract={};var Try={these:function(){var c;for(var b=0,d=arguments.length;b<d;b++){var a=arguments[b];try{c=a();break}catch(f){}}return c}};var Class=(function(){function a(){}function b(){var g=null,f=$A(arguments);if(Object.isFunction(f[0])){g=f.shift()}function d(){this.initialize.apply(this,arguments)}Object.extend(d,Class.Methods);d.superclass=g;d.subclasses=[];if(g){a.prototype=g.prototype;d.prototype=new a;g.subclasses.push(d)}for(var e=0;e<f.length;e++){d.addMethods(f[e])}if(!d.prototype.initialize){d.prototype.initialize=Prototype.emptyFunction}d.prototype.constructor=d;return d}function c(k){var f=this.superclass&&this.superclass.prototype;var e=Object.keys(k);if(!Object.keys({toString:true}).length){if(k.toString!=Object.prototype.toString){e.push("toString")}if(k.valueOf!=Object.prototype.valueOf){e.push("valueOf")}}for(var d=0,g=e.length;d<g;d++){var j=e[d],h=k[j];if(f&&Object.isFunction(h)&&h.argumentNames().first()=="$super"){var l=h;h=(function(i){return function(){return f[i].apply(this,arguments)}})(j).wrap(l);h.valueOf=l.valueOf.bind(l);h.toString=l.toString.bind(l)}this.prototype[j]=h}return this}return{create:b,Methods:{addMethods:c}}})();(function(){var d=Object.prototype.toString;function i(q,s){for(var r in s){q[r]=s[r]}return q}function l(q){try{if(e(q)){return"undefined"}if(q===null){return"null"}return q.inspect?q.inspect():String(q)}catch(r){if(r instanceof RangeError){return"..."}throw r}}function k(q){var s=typeof q;switch(s){case"undefined":case"function":case"unknown":return;case"boolean":return q.toString()}if(q===null){return"null"}if(q.toJSON){return q.toJSON()}if(h(q)){return}var r=[];for(var u in q){var t=k(q[u]);if(!e(t)){r.push(u.toJSON()+": "+t)}}return"{"+r.join(", ")+"}"}function c(q){return $H(q).toQueryString()}function f(q){return q&&q.toHTML?q.toHTML():String.interpret(q)}function o(q){var r=[];for(var s in q){r.push(s)}return r}function m(q){var r=[];for(var s in q){r.push(q[s])}return r}function j(q){return i({},q)}function h(q){return !!(q&&q.nodeType==1)}function g(q){return d.call(q)=="[object Array]"}function p(q){return q instanceof Hash}function b(q){return typeof q==="function"}function a(q){return d.call(q)=="[object String]"}function n(q){return d.call(q)=="[object Number]"}function e(q){return typeof q==="undefined"}i(Object,{extend:i,inspect:l,toJSON:k,toQueryString:c,toHTML:f,keys:o,values:m,clone:j,isElement:h,isArray:g,isHash:p,isFunction:b,isString:a,isNumber:n,isUndefined:e})})();Object.extend(Function.prototype,(function(){var k=Array.prototype.slice;function d(o,l){var n=o.length,m=l.length;while(m--){o[n+m]=l[m]}return o}function i(m,l){m=k.call(m,0);return d(m,l)}function g(){var l=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\
this.each(function(value, index) { if (iterator.call(context, value, index)) { result = value; throw $break; } });
function (opt) template.map(buffer.pageInfo[opt][0](), util.identity, ", "),
util.timeout(function () { doc.body.removeChild(indicator); }, 500);
function (opt) template.map(buffer.pageInfo[opt][0](), util.identity, ", "),
this.registerCallback("change", modes.PROMPT, function (str) { if (self._input.complete) self._autocompleteTimer.tell(false); if (self._input.change) self._input.change.call(commandline, str);
this.registerCallback("complete", modes.EX, function (context) { context.fork("ex", 0, completion, "ex");
this.registerCallback("change", modes.PROMPT, function (str) { if (self._input.complete) self._autocompleteTimer.tell(false); if (self._input.change) self._input.change.call(commandline, str); });
values(this._options.sort(function (a, b) String.localeCompare(a.name, b.name))),
this.__defineSetter__(name, function (value) { this._optionMap[name].values = value; });
values(this._options.sort(function (a, b) String.localeCompare(a.name, b.name))),
function (opt) template.map(buffer.pageInfo[opt][0](), util.identity, ", "),
commandline.input("Upload file: ", function (path) { let file = io.File(path); liberator.assert(file.exists()); elem.value = file.path; }, {
function (opt) template.map(buffer.pageInfo[opt][0](), util.identity, ", "),
let tab = tabs.getTab();
dactyl.assert(args.length <= 2 && !args.some(function (i) !/^\d+$/.test(i)), "E488: Trailing characters");
function (args) { let tab = tabs.getTab(); let activate = args.bang ? true : false; if (options.get("activate").has("tabopen", "all")) activate = !activate; for (let i in util.range(0, Math.max(1, args.count))) tabs.cloneTab(tab, activate); }, {
let activate = args.bang ? true : false; if (options.get("activate").has("tabopen", "all")) activate = !activate;
let [winIndex, tabIndex] = args.map(parseInt); let win = dactyl.windows[winIndex - 1];
function (args) { let tab = tabs.getTab(); let activate = args.bang ? true : false; if (options.get("activate").has("tabopen", "all")) activate = !activate; for (let i in util.range(0, Math.max(1, args.count))) tabs.cloneTab(tab, activate); }, {
for (let i in util.range(0, Math.max(1, args.count))) tabs.cloneTab(tab, activate);
dactyl.assert(win, "Window " + winIndex + " does not exist"); dactyl.assert(win != window, "Can't reattach to the same window"); let browser = win.getBrowser(); let dummy = browser.addTab("about:blank"); browser.stop(); browser.docShell; let last = browser.mTabs.length - 1; browser.moveTabTo(dummy, Math.constrain(tabIndex || last, 0, last)); browser.selectedTab = dummy; browser.swapBrowsersAndCloseOther(dummy, config.tabbrowser.mCurrentTab);
function (args) { let tab = tabs.getTab(); let activate = args.bang ? true : false; if (options.get("activate").has("tabopen", "all")) activate = !activate; for (let i in util.range(0, Math.max(1, args.count))) tabs.cloneTab(tab, activate); }, {
this.registerCallback("complete", modes.EX, function (context) { context.fork("ex", 0, completion, "ex");
this.registerCallback("submit", modes.EX, function (command) { try { var readHeredoc = io.readHeredoc; io.readHeredoc = commandline.readHeredoc; commands.repeat = command; commands.execute(command); } finally { io.readHeredoc = readHeredoc; }
this.registerCallback("complete", modes.EX, function (context) { context.fork("ex", 0, completion, "ex"); });
completion.addUrlCompleter("f", "Local files", function (context, full) {
completion.addUrlCompleter("f", "Local files", function (context, args, full) {
completion.addUrlCompleter("f", "Local files", function (context, full) { if (/^(\.{0,2}|~)\/|^file:/.test(context.filter)) completion.file(context, full); });
completion.file(context, full);
completion.file(context, args, full);
completion.addUrlCompleter("f", "Local files", function (context, full) { if (/^(\.{0,2}|~)\/|^file:/.test(context.filter)) completion.file(context, full); });
function () { tabs.keepOnly(config.tabbrowser.mCurrentTab); },
function () { tabs.keepOnly(tabs.getTab()); },
function () { tabs.keepOnly(config.tabbrowser.mCurrentTab); },
return this.getToken().addCallback(function(data){ return request('http: method: 'POST', sendContent : { rks : data['rks'], url : url.replace(/%[0-9a-f]{2}/g, function(s){ return s.toUpperCase(); }), title : title, comment : Models.Hatena.reprTags(tags) + description.replace(/[\n\r]+/g, ' ') } }); });
tags : map(function(pair){ var tag = pair[0], info = pair[1]; return { name : tag, frequency : info.count } }, items(tags))
return this.getToken().addCallback(function(data){ return request('http://b.hatena.ne.jp/bookmarklet.edit', { //denyRedirection: true, method: 'POST', sendContent : { rks : data['rks'], url : url.replace(/%[0-9a-f]{2}/g, function(s){ return s.toUpperCase(); }), title : title, comment : Models.Hatena.reprTags(tags) + description.replace(/[\n\r]+/g, ' ') } }); });
completion.addUrlCompleter("f", "Local files", function (context, full) { if (/^(\.{0,2}|~)\/|^file:/.test(context.filter)) completion.file(context, full); });
context.fork(dir, 0, this, function (context) { dir = dir.replace("/+$", "") + "/"; completion.file(context, true, dir + context.filter); context.title[0] = dir; context.keys.text = function (f) f.path.substr(dir.length); });
completion.addUrlCompleter("f", "Local files", function (context, full) { if (/^(\.{0,2}|~)\/|^file:/.test(context.filter)) completion.file(context, full); });
document.commandDispatcher.advanceFocus();
services.focus.moveFocus(window, null, Ci.nsIFocusManager.MOVEFOCUS_FORWARD, Ci.nsIFocusManager.FLAG_BYKEY);
function () { editor.expandAbbreviation(modes.INSERT); document.commandDispatcher.advanceFocus(); });
var layout = { top: 10, left: 10, width: 50, height: 50 }; var s = { top: 0, left: 0, width: 50, height: 50, "-webkit-transform": 'translate3d(10px, 10px, 0)' } ; var no_f = { x: 0, y: 0, width: 50, height: 50, "-webkit-transform": 'translate3d(10px, 10px, 0)' } ; var with_f = { x: 0, y: 0, width: 50, height: 50, "-webkit-transform": 'translate3d(10px, 10px, 0)' } ; performLayoutTest(layout, no_f, s, with_f, s) ; }) ;
performLayoutTest(layout, no_f, s, with_f, s) ; }) ;
test("layout {top, left, width, height}", function() { var layout = { top: 10, left: 10, width: 50, height: 50 }; var s = { top: 0, left: 0, width: 50, height: 50, "-webkit-transform": 'translate3d(10px, 10px, 0)' } ; var no_f = { x: 0, y: 0, width: 50, height: 50, "-webkit-transform": 'translate3d(10px, 10px, 0)' } ; var with_f = { x: 0, y: 0, width: 50, height: 50, "-webkit-transform": 'translate3d(10px, 10px, 0)' } ; performLayoutTest(layout, no_f, s, with_f, s) ;}) ;
$("#popup_ok").click( function() { var val = $("#popup_prompt").val(); $.alerts._hide(); if( callback ) callback( val );
$("#popup_ok, #popup_cancel").keypress( function(e) { if( e.keyCode == 13 ) $("#popup_ok").trigger('click'); if( e.keyCode == 27 ) $("#popup_cancel").trigger('click');
$("#popup_ok").click( function() { var val = $("#popup_prompt").val(); $.alerts._hide(); if( callback ) callback( val ); });
.addCallback(function(res){ self.arrangeSuggestions(res); self.setSuggestions(res); self.setTags(res.tags); removeElementClass(self.suggestionIcon, 'loading'); addElementClass(self.suggestionIcon, 'loaded'); connect(self.suggestionIcon, 'onclick', self, 'toggleSuggestions'); if(self.suggestionShownDefault){ self.toggleSuggestions(); } }).addErrback(function(e){
}).addErrback(function(e){ notify(Config['post']['tag_provider']+'\n'+e.message.indent(4)); var icon = $('loading_icon'); removeElementClass(icon, 'loading'); addElementClass(icon, 'loaded'); });
.addCallback(function(res){ self.arrangeSuggestions(res); self.setSuggestions(res); self.setTags(res.tags); removeElementClass(self.suggestionIcon, 'loading'); addElementClass(self.suggestionIcon, 'loaded'); connect(self.suggestionIcon, 'onclick', self, 'toggleSuggestions'); if(self.suggestionShownDefault){ self.toggleSuggestions(); } }).addErrback(function(e){
function () { editor.expandAbbreviation(modes.INSERT); });
function () { editor.expandAbbreviation(modes.INSERT); document.commandDispatcher.advanceFocus(); });
function () { editor.expandAbbreviation(modes.INSERT); });
getSelected().addCallback(function(tab){ var ps = req.content; if(req.show){ TBRL.Popup.open(tab, ps); } else { var posters = Models.getDefaults(ps); if(!posters.length){ alert(chrome.i18n.getMessage('error_noPoster', ps.type.capitalize())); } else { TBRL.Service.post(ps, posters); } } func({}); }).addErrback(function(e){
}).addErrback(function(e){ });
getSelected().addCallback(function(tab){ var ps = req.content; if(req.show){ TBRL.Popup.open(tab, ps); } else { var posters = Models.getDefaults(ps); if(!posters.length){ alert(chrome.i18n.getMessage('error_noPoster', ps.type.capitalize())); } else { TBRL.Service.post(ps, posters); } } func({}); }).addErrback(function(e){
context.filters.push(function ({ item }) item.isDirectory() || !wig.getKey(this.name));
completion.addUrlCompleter("f", "Local files", function (context, full) { if (/^(\.{0,2}|~)\/|^file:/.test(context.filter)) completion.file(context, full); });
context.filters.push(function ({ item }) item.isDirectory() || !wig.getKey(this.name));
dactyl.assert(!names.some(function (name) name in this._exMap, this),
let sorted = this._exCommands.sort(function (a, b) a.name > b.name);
dactyl.assert(!names.some(function (name) name in this._exMap, this),
.split("\n").filter(function (line) line.indexOf("=") > 0)
context.filters.push(function (item) item.isdir);
.split("\n").filter(function (line) line.indexOf("=") > 0)
chrome.tabs.captureVisibleTab(sender.tab.windowId, function(data){ func(data); });
Object.keys(val).forEach(function(k){ setter(k, val, target[key]); });
chrome.tabs.captureVisibleTab(sender.tab.windowId, function(data){ func(data); });
function () { dactyl.assert(tabs.count > 1, "Can't detach the last tab"); tabs.detachTab(null); },
function () { tabs.keepOnly(config.tabbrowser.mCurrentTab); },
function () { dactyl.assert(tabs.count > 1, "Can't detach the last tab"); tabs.detachTab(null); },
Object.keys(val).forEach(function(k){ setter(k, val, target[key]); });
Object.keys(log).forEach(function(k){ setter(k, log, TBRL.Config); });
Object.keys(val).forEach(function(k){ setter(k, val, target[key]); });
selector = '[rel="' + action + '"]';
$.post(action, $.param({'delete': true}), function (data) { selector = '[rel="' + action + '"]'; if (data['deleted']) { containingList = $(selector).parent().parent().parent(); $(selector).parent().parent().remove(); if (!$(containingList).children().length) { $(containingList).append('<li class="empty">No ' + $(containingList).closest("div").find("h3").text().toLowerCase() + ' defined.</li>'); } $(containingList).trigger('changeLength'); } else { $(selector).insertAfter('<span class="fail">An error occurred.</span>'); $("span.fail").delay(1500).fadeOut("fast", function () { $(this).remove(); }); } }, "json");
containingList = $(selector).parent().parent().parent();
$.post(action, $.param({'delete': true}), function (data) { selector = '[rel="' + action + '"]'; if (data['deleted']) { containingList = $(selector).parent().parent().parent(); $(selector).parent().parent().remove(); if (!$(containingList).children().length) { $(containingList).append('<li class="empty">No ' + $(containingList).closest("div").find("h3").text().toLowerCase() + ' defined.</li>'); } $(containingList).trigger('changeLength'); } else { $(selector).insertAfter('<span class="fail">An error occurred.</span>'); $("span.fail").delay(1500).fadeOut("fast", function () { $(this).remove(); }); } }, "json");
$(containingList).append('<li class="empty">No ' + $(containingList).closest("div").find("h3").text().toLowerCase() + ' defined.</li>');
$(containingList).append('<li class="empty">No ' + sectionNamePlural + ' defined.</li>');
$.post(action, $.param({'delete': true}), function (data) { selector = '[rel="' + action + '"]'; if (data['deleted']) { containingList = $(selector).parent().parent().parent(); $(selector).parent().parent().remove(); if (!$(containingList).children().length) { $(containingList).append('<li class="empty">No ' + $(containingList).closest("div").find("h3").text().toLowerCase() + ' defined.</li>'); } $(containingList).trigger('changeLength'); } else { $(selector).insertAfter('<span class="fail">An error occurred.</span>'); $("span.fail").delay(1500).fadeOut("fast", function () { $(this).remove(); }); } }, "json");
this.registerCallback("complete", modes.PROMPT, function (context) { if (self._input.complete) context.fork("input", 0, commandline, self._input.complete); });
["commandbar", "statusbar"].forEach(function (nodeSet) { Array.forEach(this.widgets[nodeSet].commandline.childNodes, function (node) { node.style.opacity = this._quiet || this._silent ? "0" : ""; }, this); }, this);
this.registerCallback("complete", modes.PROMPT, function (context) { if (self._input.complete) context.fork("input", 0, commandline, self._input.complete); });
function (args) { commandline.runSilently(function () dactyl.execute(args[0], null, true)); }, {
function () { commandline._messageHistory.clear(); },
function (args) { commandline.runSilently(function () dactyl.execute(args[0], null, true)); }, {
!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Va,"")}return w}var o=c.isFunction(a);return this.each(function(p){var n=c(this),t=a;if(this.nodeType===1){if(o)t=a.call(this,p,n.val());if(typeof t==="number")t+="";if(c.isArray(t)&&Aa.test(this.type))this.checked=c.inArray(n.val(),t)>=0;else if(c.nodeName(this,"select")){var z=c.makeArray(t);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),z)>=0});if(!z.length)this.selectedIndex=
e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");
!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Va,"")}return w}var o=c.isFunction(a);return this.each(function(p){var n=c(this),t=a;if(this.nodeType===1){if(o)t=a.call(this,p,n.val());if(typeof t==="number")t+="";if(c.isArray(t)&&Aa.test(this.type))this.checked=c.inArray(n.val(),t)>=0;else if(c.nodeName(this,"select")){var z=c.makeArray(t);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),z)>=0});if(!z.length)this.selectedIndex=
(content.title ? succeed(content.title):getTitle()).addCallback(function(title){
chrome.extension.onRequest.addListener(function(req, sender, func){ if(req.request === 'popup'){ var content = req.content; (content.title ? succeed(content.title):getTitle()).addCallback(function(title){
(content.title ? succeed(content.title):getTitle()).addCallback(function(title){ var ctx = update({ document :document, window : window, title : title, selection : window.getSelection().toString(), target : TBRL.target || document }, window.location); if(Extractors.Quote.check(ctx)){ var d = Extractors.Quote.extract(ctx); } else { var d = Extractors.Link.extract(ctx); } maybeDeferred(d).addCallback(function(ps){ func(update({ page : title, pageUrl : content.url }, ps)); }); });
} });
(content.title ? succeed(content.title):getTitle()).addCallback(function(title){ var ctx = update({ document :document, window : window, title : title, selection : window.getSelection().toString(), target : TBRL.target || document }, window.location); if(Extractors.Quote.check(ctx)){ var d = Extractors.Quote.extract(ctx); } else { var d = Extractors.Link.extract(ctx); } maybeDeferred(d).addCallback(function(ps){ func(update({ page : title, pageUrl : content.url }, ps)); }); });
return this.getToken().addCallback(function(){ var user = self.user; var tags = self.tags; if(user && tags){ return succeed(tags); } else { return request('http: try{ tags = JSON.parse(res.responseText)['tags']; } catch(e) { throw new Error(chrome.i18n.getMessage('error_notLoggedin', self.name)); } return self.tags = items(tags).map(function(pair){ return { name : pair[0], frequency : pair[1].count } }); }); }
return this.getToken().addCallback(function(data){ return request('http: method: 'POST', sendContent : { rks : data['rks'], url : url.replace(/%[0-9a-f]{2}/g, function(s){ return s.toUpperCase(); }), title : title, comment : Models.Hatena.reprTags(tags) + description.replace(/[\n\r]+/g, ' ') } });
return this.getToken().addCallback(function(){ var user = self.user; var tags = self.tags; if(user && tags){ return succeed(tags); } else { return request('http://b.hatena.ne.jp/'+user+'/tags.json').addCallback(function(res){ try{ tags = JSON.parse(res.responseText)['tags']; } catch(e) { throw new Error(chrome.i18n.getMessage('error_notLoggedin', self.name)); } return self.tags = items(tags).map(function(pair){ return { name : pair[0], frequency : pair[1].count } }); }); } });
dactyl.assert(!arg || arg[0] == ">" && !dactyl.has("Win32"),
dactyl.assert(!arg || arg[0] == ">" && !dactyl.has("WINNT"),
function (args) { let arg = args[0]; // FIXME: arg handling is a bit of a mess, check for filename dactyl.assert(!arg || arg[0] == ">" && !dactyl.has("Win32"), "E488: Trailing characters"); options.withContext(function () { if (arg) { options.setPref("print.print_to_file", "true"); options.setPref("print.print_to_filename", io.File(arg.substr(1)).path); dactyl.echomsg("Printing to file: " + arg.substr(1)); } else dactyl.echomsg("Sending to printer..."); options.setPref("print.always_print_silent", args.bang); options.setPref("print.show_print_progress", !args.bang); config.browser.contentWindow.print(); }); if (arg) dactyl.echomsg("Printed: " + arg.substr(1)); else dactyl.echomsg("Print job sent."); },
dactyl.assert(args.length <= 2 && !args.some(function (i) !/^\d+$/.test(i)), "E488: Trailing characters");
let tab = tabs.getTab();
function (args) { dactyl.assert(args.length <= 2 && !args.some(function (i) !/^\d+$/.test(i)), "E488: Trailing characters"); let [winIndex, tabIndex] = args.map(parseInt); let win = dactyl.windows[winIndex - 1]; dactyl.assert(win, "Window " + winIndex + " does not exist"); dactyl.assert(win != window, "Can't reattach to the same window"); let browser = win.getBrowser(); let dummy = browser.addTab("about:blank"); browser.stop(); // XXX: the implementation of DnD in tabbrowser.xml suggests // that we may not be guaranteed of having a docshell here // without this reference? browser.docShell; let last = browser.mTabs.length - 1; browser.moveTabTo(dummy, Math.constrain(tabIndex || last, 0, last)); browser.selectedTab = dummy; // required browser.swapBrowsersAndCloseOther(dummy, config.tabbrowser.mCurrentTab); }, {
let [winIndex, tabIndex] = args.map(parseInt); let win = dactyl.windows[winIndex - 1];
let activate = args.bang ? true : false; if (options.get("activate").has("tabopen", "all")) activate = !activate;
function (args) { dactyl.assert(args.length <= 2 && !args.some(function (i) !/^\d+$/.test(i)), "E488: Trailing characters"); let [winIndex, tabIndex] = args.map(parseInt); let win = dactyl.windows[winIndex - 1]; dactyl.assert(win, "Window " + winIndex + " does not exist"); dactyl.assert(win != window, "Can't reattach to the same window"); let browser = win.getBrowser(); let dummy = browser.addTab("about:blank"); browser.stop(); // XXX: the implementation of DnD in tabbrowser.xml suggests // that we may not be guaranteed of having a docshell here // without this reference? browser.docShell; let last = browser.mTabs.length - 1; browser.moveTabTo(dummy, Math.constrain(tabIndex || last, 0, last)); browser.selectedTab = dummy; // required browser.swapBrowsersAndCloseOther(dummy, config.tabbrowser.mCurrentTab); }, {
dactyl.assert(win, "Window " + winIndex + " does not exist"); dactyl.assert(win != window, "Can't reattach to the same window"); let browser = win.getBrowser(); let dummy = browser.addTab("about:blank"); browser.stop(); browser.docShell; let last = browser.mTabs.length - 1; browser.moveTabTo(dummy, Math.constrain(tabIndex || last, 0, last)); browser.selectedTab = dummy; browser.swapBrowsersAndCloseOther(dummy, config.tabbrowser.mCurrentTab);
for (let i in util.range(0, Math.max(1, args.count))) tabs.cloneTab(tab, activate);
function (args) { dactyl.assert(args.length <= 2 && !args.some(function (i) !/^\d+$/.test(i)), "E488: Trailing characters"); let [winIndex, tabIndex] = args.map(parseInt); let win = dactyl.windows[winIndex - 1]; dactyl.assert(win, "Window " + winIndex + " does not exist"); dactyl.assert(win != window, "Can't reattach to the same window"); let browser = win.getBrowser(); let dummy = browser.addTab("about:blank"); browser.stop(); // XXX: the implementation of DnD in tabbrowser.xml suggests // that we may not be guaranteed of having a docshell here // without this reference? browser.docShell; let last = browser.mTabs.length - 1; browser.moveTabTo(dummy, Math.constrain(tabIndex || last, 0, last)); browser.selectedTab = dummy; // required browser.swapBrowsersAndCloseOther(dummy, config.tabbrowser.mCurrentTab); }, {
this.__defineGetter__("_completionList", function () { let node = this.widgets.active.commandline; if (!node._completionList) node._completionList = ItemList("dactyl-completions-" + node.id); return node._completionList;
this.registerCallback("submit", modes.EX, function (command) { try { var readHeredoc = io.readHeredoc; io.readHeredoc = commandline.readHeredoc; commands.repeat = command; commands.execute(command); } finally { io.readHeredoc = readHeredoc; }
this.__defineGetter__("_completionList", function () { let node = this.widgets.active.commandline; if (!node._completionList) node._completionList = ItemList("dactyl-completions-" + node.id); return node._completionList; });
this.each(function(value, index) { if (iterator.call(context, value, index)) results.push(value); });
var Prototype={Version:"1.6.1",Browser:(function(){var b=navigator.userAgent;var a=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!a,Opera:a,WebKit:b.indexOf("AppleWebKit/")>-1,Gecko:b.indexOf("Gecko")>-1&&b.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile.*Safari/.test(b)}})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var a=window.Element||window.HTMLElement;return !!(a&&a.prototype)})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true}var c=document.createElement("div");var b=document.createElement("form");var a=false;if(c.__proto__&&(c.__proto__!==b.__proto__)){a=true}c=b=null;return a})()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(a){return a}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Abstract={};var Try={these:function(){var c;for(var b=0,d=arguments.length;b<d;b++){var a=arguments[b];try{c=a();break}catch(f){}}return c}};var Class=(function(){function a(){}function b(){var g=null,f=$A(arguments);if(Object.isFunction(f[0])){g=f.shift()}function d(){this.initialize.apply(this,arguments)}Object.extend(d,Class.Methods);d.superclass=g;d.subclasses=[];if(g){a.prototype=g.prototype;d.prototype=new a;g.subclasses.push(d)}for(var e=0;e<f.length;e++){d.addMethods(f[e])}if(!d.prototype.initialize){d.prototype.initialize=Prototype.emptyFunction}d.prototype.constructor=d;return d}function c(k){var f=this.superclass&&this.superclass.prototype;var e=Object.keys(k);if(!Object.keys({toString:true}).length){if(k.toString!=Object.prototype.toString){e.push("toString")}if(k.valueOf!=Object.prototype.valueOf){e.push("valueOf")}}for(var d=0,g=e.length;d<g;d++){var j=e[d],h=k[j];if(f&&Object.isFunction(h)&&h.argumentNames().first()=="$super"){var l=h;h=(function(i){return function(){return f[i].apply(this,arguments)}})(j).wrap(l);h.valueOf=l.valueOf.bind(l);h.toString=l.toString.bind(l)}this.prototype[j]=h}return this}return{create:b,Methods:{addMethods:c}}})();(function(){var d=Object.prototype.toString;function i(q,s){for(var r in s){q[r]=s[r]}return q}function l(q){try{if(e(q)){return"undefined"}if(q===null){return"null"}return q.inspect?q.inspect():String(q)}catch(r){if(r instanceof RangeError){return"..."}throw r}}function k(q){var s=typeof q;switch(s){case"undefined":case"function":case"unknown":return;case"boolean":return q.toString()}if(q===null){return"null"}if(q.toJSON){return q.toJSON()}if(h(q)){return}var r=[];for(var u in q){var t=k(q[u]);if(!e(t)){r.push(u.toJSON()+": "+t)}}return"{"+r.join(", ")+"}"}function c(q){return $H(q).toQueryString()}function f(q){return q&&q.toHTML?q.toHTML():String.interpret(q)}function o(q){var r=[];for(var s in q){r.push(s)}return r}function m(q){var r=[];for(var s in q){r.push(q[s])}return r}function j(q){return i({},q)}function h(q){return !!(q&&q.nodeType==1)}function g(q){return d.call(q)=="[object Array]"}function p(q){return q instanceof Hash}function b(q){return typeof q==="function"}function a(q){return d.call(q)=="[object String]"}function n(q){return d.call(q)=="[object Number]"}function e(q){return typeof q==="undefined"}i(Object,{extend:i,inspect:l,toJSON:k,toQueryString:c,toHTML:f,keys:o,values:m,clone:j,isElement:h,isArray:g,isHash:p,isFunction:b,isString:a,isNumber:n,isUndefined:e})})();Object.extend(Function.prototype,(function(){var k=Array.prototype.slice;function d(o,l){var n=o.length,m=l.length;while(m--){o[n+m]=l[m]}return o}function i(m,l){m=k.call(m,0);return d(m,l)}function g(){var l=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\
this.each(function(value, index) { if (iterator.call(context, value, index)) results.push(value); });
let list = template.map(option, function (option) { let opt = buffer.pageInfo[option]; return opt ? template.table(opt[1], opt[0](true)) : undefined; }, <br/>);
function (opt) template.map(buffer.pageInfo[opt][0](), util.identity, ", "),
let list = template.map(option, function (option) { let opt = buffer.pageInfo[option]; return opt ? template.table(opt[1], opt[0](true)) : undefined; }, <br/>);
this.registerCallback("complete", modes.PROMPT, function (context) { if (self._input.complete) context.fork("input", 0, commandline, self._input.complete);
this.registerCallback("change", modes.EX, function (command, from) { if (from !== "history") self._autocompleteTimer.tell(false);
this.registerCallback("complete", modes.PROMPT, function (context) { if (self._input.complete) context.fork("input", 0, commandline, self._input.complete); });
memoize(this._optionMap, name, function () Option(names, description, type, defaultValue, extraInfo));
this._options = this._options.filter(function (o) o != opt);
memoize(this._optionMap, name, function () Option(names, description, type, defaultValue, extraInfo));
let cmds = commands._exCommands.filter(function (c) c.user && (!cmd || c.name.match("^" + cmd)));
function (args) { let cmd = args[0]; dactyl.assert(!/\W/.test(cmd || ''), "E182: Invalid command name"); if (args.literalArg) { let nargsOpt = args["-nargs"] || "0"; let bangOpt = "-bang" in args; let countOpt = "-count" in args; let descriptionOpt = args["-description"] || "User-defined command"; let completeOpt = args["-complete"]; let completeFunc = null; if (completeOpt) { if (/^custom,/.test(completeOpt)) { completeOpt = completeOpt.substr(7); completeFunc = function () { try { var completer = dactyl.userEval(completeOpt); if (!callable(completer)) throw new TypeError("User-defined custom completer " + completeOpt.quote() + " is not a function"); } catch (e) { dactyl.echo(":" + this.name + " ..."); dactyl.echoerr("E117: Unknown function: " + completeOpt); dactyl.log(e); return undefined; } return completer.apply(this, Array.slice(arguments)); }; } else completeFunc = completion.closure[completeOptionMap[completeOpt]]; } let added = commands.addUserCommand([cmd], descriptionOpt, userCommand, { argCount: nargsOpt, bang: bangOpt, count: countOpt, completer: completeFunc, replacementText: args.literalArg, sourcing: io.sourcing && update({}, io.sourcing) }, args.bang); if (!added) dactyl.echoerr("E174: Command already exists: add ! to replace it"); } else { function completerToString(completer) { if (completer) return [k for ([k, v] in Iterator(completeOptionMap)) if (completer == completion[v])][0] || "custom"; return ""; } let cmds = commands._exCommands.filter(function (c) c.user && (!cmd || c.name.match("^" + cmd))); if (cmds.length > 0) commandline.commandOutput( template.tabular(["", "Name", "Args", "Range", "Complete", "Definition"], ["padding-right: 2em;"], ([cmd.bang ? "!" : " ", cmd.name, cmd.argCount, cmd.count ? "0c" : "", completerToString(cmd.completer), cmd.replacementText || "function () { ... }"] for ([, cmd] in Iterator(cmds))))); else dactyl.echomsg("No user-defined commands found"); } }, {
let cmds = commands._exCommands.filter(function (c) c.user && (!cmd || c.name.match("^" + cmd)));
$("write_xml").observe("click", function(ev) { window.location.href = URL + '/WriteXML';
$("summarize").observe("click", function(ev) { window.open(URL + "/Summarize", "SummarizeWindow");
$("write_xml").observe("click", function(ev) { window.location.href = URL + '/WriteXML'; });
this.each(function(value, index) { if (filter.match(value)) results.push(iterator.call(context, value, index)); });
value=value.call(elem,i);return typeof value==="number"&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className)) elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)
this.each(function(value, index) { if (filter.match(value)) results.push(iterator.call(context, value, index)); });
function (args) { dactyl.assert(args.length <= 2 && !args.some(function (i) !/^\d+$/.test(i)), "E488: Trailing characters"); let [winIndex, tabIndex] = args.map(parseInt); let win = dactyl.windows[winIndex - 1]; dactyl.assert(win, "Window " + winIndex + " does not exist"); dactyl.assert(win != window, "Can't reattach to the same window"); let browser = win.getBrowser(); let dummy = browser.addTab("about:blank"); browser.stop(); browser.docShell; let last = browser.mTabs.length - 1; browser.moveTabTo(dummy, Math.constrain(tabIndex || last, 0, last)); browser.selectedTab = dummy; browser.swapBrowsersAndCloseOther(dummy, config.tabbrowser.mCurrentTab); }, {
dactyl.assert(args.length <= 2 && !args.some(function (i) !/^\d+$/.test(i)),
function (args) { dactyl.assert(args.length <= 2 && !args.some(function (i) !/^\d+$/.test(i)), "E488: Trailing characters"); let [winIndex, tabIndex] = args.map(parseInt); let win = dactyl.windows[winIndex - 1]; dactyl.assert(win, "Window " + winIndex + " does not exist"); dactyl.assert(win != window, "Can't reattach to the same window"); let browser = win.getBrowser(); let dummy = browser.addTab("about:blank"); browser.stop(); // XXX: the implementation of DnD in tabbrowser.xml suggests // that we may not be guaranteed of having a docshell here // without this reference? browser.docShell; let last = browser.mTabs.length - 1; browser.moveTabTo(dummy, Math.constrain(tabIndex || last, 0, last)); browser.selectedTab = dummy; // required browser.swapBrowsersAndCloseOther(dummy, config.tabbrowser.mCurrentTab); }, {
var info_url=$(this).parent().attr('href').replace(/.photo\
var info_url=$(this).parent().attr('href').replace(/.photo.*\
$('.image img').hover(function() { var info_url=$(this).parent().attr('href').replace(/.photo\//,'.jsrpc/imginfo/'); $('#imageinfo').load(info_url) },function() {})
let list = template.map(option, function (option) { let opt = buffer.pageInfo[option]; return opt ? template.table(opt[1], opt[0](true)) : undefined; }, <br/>);
function (file) editor.editFileExternally(file.path);
let list = template.map(option, function (option) { let opt = buffer.pageInfo[option]; return opt ? template.table(opt[1], opt[0](true)) : undefined; }, <br/>);
this.registerCallback("change", modes.EX, function (command, from) { if (from !== "history") self._autocompleteTimer.tell(false);
this.registerCallback("complete", modes.EX, function (context) { context.fork("ex", 0, completion, "ex");
this.registerCallback("change", modes.EX, function (command, from) { if (from !== "history") self._autocompleteTimer.tell(false); });
completion.file(context, true);
completion.file(context, args, true);
[function (context, obj, args) { context.quote[2] = ""; completion.file(context, true); }]);
[function (context, obj, args) { context.quote[2] = ""; completion.file(context, true); }]);
completion.addUrlCompleter("f", "Local files", function (context, full) { if (/^(\.{0,2}|~)\/|^file:/.test(context.filter)) completion.file(context, full); });
[function (context, obj, args) { context.quote[2] = ""; completion.file(context, true); }]);
var layout = { top: 10, left: 10, bottom: 10, right: 10 }; var no_f = { x: 10, y: 10, width: 0, height: 0, "-webkit-transform": 'translateZ(0px)' } ; var with_f = { x: 10, y: 10, width: 180, height: 180, "-webkit-transform": 'translateZ(0px)' } ; var s = { top: 10, left: 10, bottom: 10, right: 10, "-webkit-transform": 'translateZ(0px)' } ;
var layout = { top: 10, left: 10, bottom: 10, right: 10 }; var expectedTransform = 'translateX(0px) translateY(0px)'; if (SC.platform.supportsCSS3DTransforms) expectedTransform += ' translateZ(0px)'; var no_f = { x: 10, y: 10, width: 0, height: 0, transform: expectedTransform } ; var with_f = { x: 10, y: 10, width: 180, height: 180, transform: expectedTransform } ; var s = { top: 10, left: 10, bottom: 10, right: 10, transform: expectedTransform } ;
test("layout {top, left, bottom, right}", function() { var layout = { top: 10, left: 10, bottom: 10, right: 10 }; var no_f = { x: 10, y: 10, width: 0, height: 0, "-webkit-transform": 'translateZ(0px)' } ; var with_f = { x: 10, y: 10, width: 180, height: 180, "-webkit-transform": 'translateZ(0px)' } ; var s = { top: 10, left: 10, bottom: 10, right: 10, "-webkit-transform": 'translateZ(0px)' } ; performLayoutTest(layout, no_f, s, with_f, s) ;}) ;
$("#popup_cancel").click( function() {
$("#popup_ok").click( function() { var val = $("#popup_prompt").val();
$("#popup_cancel").click( function() { $.alerts._hide(); if( callback ) callback( null ); });
if( callback ) callback( null );
if( callback ) callback( val );
$("#popup_cancel").click( function() { $.alerts._hide(); if( callback ) callback( null ); });
selection : createFlavoredString(window.getSelection()),
selection : (!!sel.raw)? sel : null,
chrome.extension.onRequest.addListener(function(req, sender, func){ if(req.request === 'popup'){ var content = req.content; (content.title ? succeed(content.title):getTitle()).addCallback(function(title){ var ctx = update({ document :document, window : window, title : title, selection : createFlavoredString(window.getSelection()), target : TBRL.target || document }, window.location); if(Extractors.Quote.check(ctx)){ var d = Extractors.Quote.extract(ctx); } else { var d = Extractors.Link.extract(ctx); } maybeDeferred(d).addCallback(function(ps){ func(update({ page : title, pageUrl : content.url }, ps)); }); }); }});
}).addErrback(function(e){ if(isPopup){ notify(Config['post']['tag_provider']+'\n'+e.message.indent(4)); } else { alert(Config['post']['tag_provider']+'\n'+e.message.indent(4)); } var icon = $('loading_icon'); removeElementClass(icon, 'loading'); addElementClass(icon, 'loaded'); });
connect(tags, 'oninput', this, function(ev){ var self = this; this.refreshCheck(); setTimeout(function(){ self.onInput(ev) }, 0); });
}).addErrback(function(e){ if(isPopup){ notify(Config['post']['tag_provider']+'\n'+e.message.indent(4)); } else { alert(Config['post']['tag_provider']+'\n'+e.message.indent(4)); } var icon = $('loading_icon'); removeElementClass(icon, 'loading'); addElementClass(icon, 'loaded'); });
function (count) { editor.executeCommand("cmd_undo", count); dactyl.mode = modes.TEXTAREA; },
function () { editor.expandAbbreviation(modes.INSERT); });
function (count) { editor.executeCommand("cmd_undo", count); dactyl.mode = modes.TEXTAREA; },
let sorted = this._exCommands.sort(function (a, b) a.name > b.name);
dactyl.assert(!names.some(function (name) name in this._exMap && !this._exMap[name].user, this),
let sorted = this._exCommands.sort(function (a, b) a.name > b.name);
}).addErrback(function(e){ });
chrome.extension.onRequest.addListener(function(req, sender, func){ var handler = onRequestsHandlers[req.request]; handler && handler.apply(this, arguments); });
}).addErrback(function(e){ });
context.keys.text = function (f) f.path.substr(dir.length);
context.keys.text = function (f) this.path.substr(dir.length);
context.fork(dir, 0, this, function (context) { dir = dir.replace("/+$", "") + "/"; completion.file(context, true, dir + context.filter); context.title[0] = dir; context.keys.text = function (f) f.path.substr(dir.length); });