rem
stringlengths 0
126k
| add
stringlengths 0
441k
| context
stringlengths 15
136k
|
---|---|---|
var byline = Zotero.Utilities.cleanString(doc.evaluate(' | var byline = Zotero.Utilities.trimInternal(doc.evaluate(' | function scrape(doc, url) { var newItem = new Zotero.Item("blogPost"); newItem.url = doc.location.href; newItem.title = doc.title.substr(0, doc.title.indexOf(" - ")); var titleRE = new RegExp('^http://time-blog.com/([^/]*)/'); var title = titleRE.exec(doc.location.href)[1].split("_"); for (var i = 0 ; i < title.length ; i++) { title[i] = title[i][0].toUpperCase() + title[i].substr(1).toLowerCase(); } newItem.blogTitle = title.join(" "); var metaTags = new Object(); var metaTagHTML = doc.getElementsByTagName("meta"); for (var i = 0 ; i < metaTagHTML.length ; i++) { metaTags[metaTagHTML[i].getAttribute("name")] = metaTagHTML[i].getAttribute("content"); } if (metaTags["description"]) { newItem.abstractNote = Zotero.Utilities.cleanString(Zotero.Utilities.cleanTags(metaTags["description"])); } if (metaTags["date"]) { var date = metaTags["date"]; var months = new Object(); months["jan"] = "January"; months["feb"] = "February"; months["mar"] = "March"; months["apr"] = "April"; months["may"] = "May"; months["jun"] = "June"; months["jul"] = "July"; months["aug"] = "August"; months["sep"] = "September"; months["oct"] = "October"; months["nov"] = "November"; months["dec"] = "December"; date = date.split(".").join("").split(", "); date[0] = months[date[0].split(" ")[0].toLowerCase()] + " " + date[0].split(" ")[1]; newItem.date = date.join(", "); } if (metaTags["keywords"]) { newItem.tags = metaTags["keywords"].split(", "); for (var i in newItem.tags) { if (newItem.tags[i] == "" || newItem.tags[i] == " ") { break; } else { var words = newItem.tags[i].split(" "); for (var j = 0 ; j < words.length ; j++) { if (words[j][0] == words[j][0].toLowerCase() && words[j][0]) { words[j] = words[j][0].toUpperCase() + words[j].substr(1).toLowerCase(); } } } newItem.tags[i] = words.join(" "); } } if (doc.evaluate('//span[@class="postedby"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) { var byline = Zotero.Utilities.cleanString(doc.evaluate('//span[@class="postedby"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); if (byline.substr(0,9).toLowerCase() == "posted by") { byline = byline.substr(10).split(" "); } else { byline.split(" "); } for (var i = 0; i < byline.length ; i++) { byline[i] = byline[i][0].toUpperCase() + byline[i].substr(1).toLowerCase(); } newItem.creators.push(Zotero.Utilities.cleanAuthor(byline.join(" "), "author")); } else if (newItem.blogTitle == "Theag") { newItem.creators.push(Zotero.Utilities.cleanAuthor("Matthew Yeomans", "author")); newItem.blogTitle = "the Aggregator"; } Zotero.debug(newItem); newItem.complete(); } |
info=Zotero.Utilities.cleanString(info); | info=Zotero.Utilities.trimInternal(info); | function scrape(doc,url){ var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; var newItem = new Zotero.Item("newspaperArticle"); newItem.publicationTitle = "The Los Angeles Times"; newItem.ISSN = "0458-3035"; var xpath='//h2/a'; var t=doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE,null).iterateNext(); if(t) {newItem.section=t.textContent; } else { xpath='//a/img[@alt="WEST"]'; if(doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE,null).iterateNext()) {newItem.section="West";} else { xpath = '//h1'; var rows=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE, null); if(t=rows.iterateNext()) {newItem.section=t.textContent;} } } xpath='//h1[last()]'; var rows=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE, null); if(t=rows.iterateNext()) {newItem.title=t.textContent;} newItem.url = url; xpath='//div[@class="storybyline"]'; var test=doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE,null).iterateNext(); if(!test) {xpath='//p[@class="by-author"]';} var info=doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE,null).iterateNext().textContent; info=Zotero.Utilities.cleanString(info); var date=findDate(info); if(date) { newItem.date=date; info=info.replace(date,''); } info=Zotero.Utilities.cleanString(info); if(info.indexOf(", ")>-1) { var phrases=info.split(", "); var a=phrases[0]; if (a.substr(0,3).toLowerCase() == "by ") {a= a.substr(3);} if(a.substr(0,5).toLowerCase()!="from ") { var authors=a.split(" and "); var n; for(n in authors) {newItem.creators.push(Zotero.Utilities.cleanAuthor(authors[n],"author"));} } } else { xpath='//div[@class="storydeckhead"]/a'; temp=doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE,null).iterateNext(); if(temp!=null && temp!='') {newItem.creators.push(Zotero.Utilities.cleanAuthor(temp.textContent,"author"));} } newItem.attachments.push({document:doc, title:"The Los Angeles Times Snapshot"}); newItem.complete();} |
scroll_view_to(0, BF.get_position(verse_obj).top - topLoader.offsetHeight); | scroll_view_to(BF.get_position(verse_obj).top - topLoader.offsetHeight); | scroll_to_verse: function (verse_id) { ///FIXME: This will not get the correct element if the verse is verse 1 (i.e., is at the beginning of a chapter or book). var verse_obj = document.getElementById(verse_id + "_verse"); if (!verse_obj) { return false; } /// Calculate the verse's Y coordinate. ///NOTE: "- topLoader.offsetHeight" subtracts off the height of the top bar. scroll_view_to(0, BF.get_position(verse_obj).top - topLoader.offsetHeight); ///TODO: Determine if there is any value to returning TRUE and FALSE. return true; }, |
scroll_pos = get_top_position(verse_obj) - topLoader.offsetHeight; pixels_needed = doc_docEl.clientHeight - (document.body.clientHeight - scroll_pos); if (pixels_needed > 0) { div_tag = document.createElement("div"); div_tag.style.height = (pixels_needed + 10) + 'px'; viewPort.insertBefore(div_tag, null); padding_interval = setInterval(function () { if (doc_docEl.scrollHeight - (window.pageYOffset + doc_docEl.clientHeight) > pixels_needed + 10) { viewPort.removeChild(div_tag); clearInterval(padding_interval); } }, 1000); } window.scrollTo(0, scroll_pos); | content_manager.scrollViewTo(0, get_top_position(verse_obj) - topLoader.offsetHeight); | function scroll_to_verse(verse_id) { var div_tag, padding_interval, pixels_needed, ///FIXME: This will not get the correct element if the verse is verse 1 (i.e., is at the beginning of a chapter or book). verse_obj = document.getElementById(verse_id + "_verse"); if (!verse_obj) { return false; } /// Calculate the verse's Y coordinate. ///NOTE: "- topLoader.offsetHeight" subtracts off the height of the top bar. scroll_pos = get_top_position(verse_obj) - topLoader.offsetHeight; /// Calculate how many pixels (if any) need to be added in order to be able to scroll to that verse /// (i.e., if the verse is near the bottom (e.g., Revelation 22:21 or Proverbs 28:28) there needs to be extra space on the bottom of the screen in order to scroll down to the verse). pixels_needed = doc_docEl.clientHeight - (document.body.clientHeight - scroll_pos); if (pixels_needed > 0) { div_tag = document.createElement("div"); div_tag.style.height = (pixels_needed + 10) + 'px'; viewPort.insertBefore(div_tag, null); padding_interval = setInterval(function () { if (doc_docEl.scrollHeight - (window.pageYOffset + doc_docEl.clientHeight) > pixels_needed + 10) { viewPort.removeChild(div_tag); clearInterval(padding_interval); } }, 1000); } window.scrollTo(0, scroll_pos); ///TODO: Determine if there is any value to returning TRUE and FALSE. return true; } |
} | self.seekTo(0, 0); } | function Scrollable(root, conf) { // current instance var self = this, fire = root.add(self), itemWrap = root.children(), index = 0, forward, vertical = conf.vertical; if (!current) { current = self; } if (itemWrap.length > 1) { itemWrap = $(conf.items, root); } // methods $.extend(self, { getConf: function() { return conf; }, getIndex: function() { return index; }, getSize: function() { return self.getItems().size(); }, getNaviButtons: function() { return prev.add(next); }, getRoot: function() { return root; }, getItemWrap: function() { return itemWrap; }, getItems: function() { return itemWrap.children(conf.item).not("." + conf.clonedClass); }, move: function(offset, time) { return self.seekTo(index + offset, time); }, next: function(time) { return self.move(1, time); }, prev: function(time) { return self.move(-1, time); }, begin: function(time) { return self.seekTo(0, time); }, end: function(time) { return self.seekTo(self.getSize() -1, time); }, focus: function() { current = self; return self; }, addItem: function(item) { item = $(item); if (!conf.circular) { itemWrap.append(item); } else { $(".cloned:last").before(item); $(".cloned:first").replaceWith(item.clone().addClass(conf.clonedClass)); } fire.trigger("onAddItem", [item]); return self; }, /* all seeking functions depend on this */ seekTo: function(i, time, fn) { // check that index is sane if (!conf.circular && i < 0 || i > self.getSize()) { return self; } var item = i; if (i.jquery) { i = self.getItems().index(i); } else { item = self.getItems().eq(i); } // onBeforeSeek var e = $.Event("onBeforeSeek"); if (!fn) { fire.trigger(e, [i, time]); if (e.isDefaultPrevented() || !item.length) { return self; } } var props = vertical ? {top: -item.position().top} : {left: -item.position().left}; itemWrap.animate(props, time, conf.easing, fn || function() { fire.trigger("onSeek", [i]); }); current = self; index = i; return self; } }); // callbacks $.each(['onBeforeSeek', 'onSeek', 'onAddItem'], function(i, name) { // configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); // circular loop if (conf.circular) { var cloned1 = self.getItems().slice(-1).clone().prependTo(itemWrap), cloned2 = self.getItems().eq(1).clone().appendTo(itemWrap); cloned1.add(cloned2).addClass(conf.clonedClass); self.onBeforeSeek(function(e, i, time) { if (e.isDefaultPrevented()) { return; } /* 1. animate to the clone without event triggering 2. seek to correct position with 0 speed */ if (i == -1) { self.seekTo(cloned1, time, function() { self.end(0); }); return e.preventDefault(); } else if (i == self.getSize()) { self.seekTo(cloned2, time, function() { self.begin(0); }); } }); } // next/prev buttons var prev = find(root, conf.prev).click(function() { self.prev(); }), next = find(root, conf.next).click(function() { self.next(); }); if (!conf.circular && self.getSize() > 2) { self.onBeforeSeek(function(e, i) { prev.toggleClass(conf.disabledClass, i <= 0); next.toggleClass(conf.disabledClass, i >= self.getSize() -1); }); } // mousewheel support if (conf.mousewheel && $.fn.mousewheel) { root.mousewheel(function(e, delta) { if (conf.mousewheel) { self.move(delta < 0 ? 1 : -1, conf.wheelSpeed || 50); return false; } }); } if (conf.keyboard) { $(document).bind("keydown.scrollable", function(evt) { // skip certain conditions if (!conf.keyboard || evt.altKey || evt.ctrlKey || $(evt.target).is(":input")) { return; } // does this instance have focus? if (conf.keyboard != 'static' && current != self) { return; } var key = evt.keyCode; if (vertical && (key == 38 || key == 40)) { self.move(key == 38 ? -1 : 1); return evt.preventDefault(); } if (!vertical && (key == 37 || key == 39)) { self.move(key == 37 ? -1 : 1); return evt.preventDefault(); } }); } // initial index $(self).trigger("onBeforeSeek", [conf.initialIndex]); } |
vertical = conf.vertical || dim(root, "height") > dim(root, "width"); | vertical = conf.vertical; | function Scrollable(root, conf) { // current instance var self = this, fire = root.add(self), itemWrap = root.children(), index = 0, forward, vertical = conf.vertical || dim(root, "height") > dim(root, "width"); if (!current) { current = self; } if (itemWrap.length > 1) { itemWrap = $(conf.items, root); } // methods $.extend(self, { getConf: function() { return conf; }, getIndex: function() { return index; }, getSize: function() { return self.getItems().size(); }, getNaviButtons: function() { return prev.add(next); }, getRoot: function() { return root; }, getItemWrap: function() { return itemWrap; }, getItems: function() { return itemWrap.children(conf.item).not("." + conf.clonedClass); }, move: function(offset, time) { return self.seekTo(index + offset, time); }, next: function(time) { return self.move(1, time); }, prev: function(time) { return self.move(-1, time); }, begin: function(time) { return self.seekTo(0, time); }, end: function(time) { return self.seekTo(self.getSize() -1, time); }, focus: function() { current = self; return self; }, addItem: function(item) { item = $(item); if (!conf.circular) { itemWrap.append(item); } else { $(".cloned:last").before(item); $(".cloned:first").replaceWith(item.clone().addClass(conf.clonedClass)); } fire.trigger("onAddItem", [item]); return self; }, /* all seeking functions depend on this */ seekTo: function(i, time, fn) { // check that index is sane if (!conf.circular && i < 0 || i > self.getSize()) { return self; } var item = i; if (i.jquery) { i = self.getItems().index(i); } else { item = self.getItems().eq(i); } // onBeforeSeek var e = $.Event("onBeforeSeek"); if (!fn) { fire.trigger(e, [i, time]); if (e.isDefaultPrevented() || !item.length) { return self; } } var props = vertical ? {top: -item.position().top} : {left: -item.position().left}; itemWrap.animate(props, time, conf.easing, fn || function() { fire.trigger("onSeek", [i]); }); current = self; index = i; return self; } }); // callbacks $.each("onBeforeSeek,onSeek,onAddItem".split(","), function(i, name) { // configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); // circular loop if (conf.circular) { var cloned1 = self.getItems().slice(-1).clone().prependTo(itemWrap), cloned2 = self.getItems().eq(1).clone().appendTo(itemWrap); cloned1.add(cloned2).addClass(conf.clonedClass); self.onBeforeSeek(function(e, i, time) { if (e.isDefaultPrevented()) { return; } /* 1. animate to the clone without event triggering 2. seek to correct position with 0 speed */ if (i == -1) { self.seekTo(cloned1, time, function() { self.end(0); }); return e.preventDefault(); } else if (i == self.getSize()) { self.seekTo(cloned2, time, function() { self.begin(0); }); } }); } // next/prev buttons var prev = find(root, conf.prev).click(function() { self.prev(); }), next = find(root, conf.next).click(function() { self.next(); }); if (!conf.circular && self.getSize() > 2) { self.onBeforeSeek(function(e, i) { prev.toggleClass(conf.disabledClass, i <= 0); next.toggleClass(conf.disabledClass, i >= self.getSize() -1); }); } // mousewheel support if (conf.mousewheel && $.fn.mousewheel) { root.mousewheel(function(e, delta) { if (conf.mousewheel) { self.move(delta < 0 ? 1 : -1, conf.wheelSpeed || 50); return false; } }); } if (conf.keyboard) { $(document).bind("keydown.scrollable", function(evt) { // skip certain conditions if (!conf.keyboard || evt.altKey || evt.ctrlKey || $(evt.target).is(":input")) { return; } // does this instance have focus? if (conf.keyboard != 'static' && current != self) { return; } var key = evt.keyCode; if (vertical && (key == 38 || key == 40)) { self.move(key == 38 ? -1 : 1); return evt.preventDefault(); } if (!vertical && (key == 37 || key == 39)) { self.move(key == 37 ? -1 : 1); return evt.preventDefault(); } }); } // initial index $(self).trigger("onBeforeSeek", [conf.initialIndex]); self.seekTo(conf.initialIndex, 0, true); } |
$.each("onBeforeSeek,onSeek,onAddItem".split(","), function(i, name) { | $.each(['onBeforeSeek', 'onSeek', 'onAddItem'], function(i, name) { | function Scrollable(root, conf) { // current instance var self = this, fire = root.add(self), itemWrap = root.children(), index = 0, forward, vertical = conf.vertical || dim(root, "height") > dim(root, "width"); if (!current) { current = self; } if (itemWrap.length > 1) { itemWrap = $(conf.items, root); } // methods $.extend(self, { getConf: function() { return conf; }, getIndex: function() { return index; }, getSize: function() { return self.getItems().size(); }, getNaviButtons: function() { return prev.add(next); }, getRoot: function() { return root; }, getItemWrap: function() { return itemWrap; }, getItems: function() { return itemWrap.children(conf.item).not("." + conf.clonedClass); }, move: function(offset, time) { return self.seekTo(index + offset, time); }, next: function(time) { return self.move(1, time); }, prev: function(time) { return self.move(-1, time); }, begin: function(time) { return self.seekTo(0, time); }, end: function(time) { return self.seekTo(self.getSize() -1, time); }, focus: function() { current = self; return self; }, addItem: function(item) { item = $(item); if (!conf.circular) { itemWrap.append(item); } else { $(".cloned:last").before(item); $(".cloned:first").replaceWith(item.clone().addClass(conf.clonedClass)); } fire.trigger("onAddItem", [item]); return self; }, /* all seeking functions depend on this */ seekTo: function(i, time, fn) { // check that index is sane if (!conf.circular && i < 0 || i > self.getSize()) { return self; } var item = i; if (i.jquery) { i = self.getItems().index(i); } else { item = self.getItems().eq(i); } // onBeforeSeek var e = $.Event("onBeforeSeek"); if (!fn) { fire.trigger(e, [i, time]); if (e.isDefaultPrevented() || !item.length) { return self; } } var props = vertical ? {top: -item.position().top} : {left: -item.position().left}; itemWrap.animate(props, time, conf.easing, fn || function() { fire.trigger("onSeek", [i]); }); current = self; index = i; return self; } }); // callbacks $.each("onBeforeSeek,onSeek,onAddItem".split(","), function(i, name) { // configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); // circular loop if (conf.circular) { var cloned1 = self.getItems().slice(-1).clone().prependTo(itemWrap), cloned2 = self.getItems().eq(1).clone().appendTo(itemWrap); cloned1.add(cloned2).addClass(conf.clonedClass); self.onBeforeSeek(function(e, i, time) { if (e.isDefaultPrevented()) { return; } /* 1. animate to the clone without event triggering 2. seek to correct position with 0 speed */ if (i == -1) { self.seekTo(cloned1, time, function() { self.end(0); }); return e.preventDefault(); } else if (i == self.getSize()) { self.seekTo(cloned2, time, function() { self.begin(0); }); } }); } // next/prev buttons var prev = find(root, conf.prev).click(function() { self.prev(); }), next = find(root, conf.next).click(function() { self.next(); }); if (!conf.circular && self.getSize() > 2) { self.onBeforeSeek(function(e, i) { prev.toggleClass(conf.disabledClass, i <= 0); next.toggleClass(conf.disabledClass, i >= self.getSize() -1); }); } // mousewheel support if (conf.mousewheel && $.fn.mousewheel) { root.mousewheel(function(e, delta) { if (conf.mousewheel) { self.move(delta < 0 ? 1 : -1, conf.wheelSpeed || 50); return false; } }); } if (conf.keyboard) { $(document).bind("keydown.scrollable", function(evt) { // skip certain conditions if (!conf.keyboard || evt.altKey || evt.ctrlKey || $(evt.target).is(":input")) { return; } // does this instance have focus? if (conf.keyboard != 'static' && current != self) { return; } var key = evt.keyCode; if (vertical && (key == 38 || key == 40)) { self.move(key == 38 ? -1 : 1); return evt.preventDefault(); } if (!vertical && (key == 37 || key == 39)) { self.move(key == 37 ? -1 : 1); return evt.preventDefault(); } }); } // initial index $(self).trigger("onBeforeSeek", [conf.initialIndex]); self.seekTo(conf.initialIndex, 0, true); } |
self.seekTo(conf.initialIndex, 0, true); | function Scrollable(root, conf) { // current instance var self = this, fire = root.add(self), itemWrap = root.children(), index = 0, forward, vertical = conf.vertical || dim(root, "height") > dim(root, "width"); if (!current) { current = self; } if (itemWrap.length > 1) { itemWrap = $(conf.items, root); } // methods $.extend(self, { getConf: function() { return conf; }, getIndex: function() { return index; }, getSize: function() { return self.getItems().size(); }, getNaviButtons: function() { return prev.add(next); }, getRoot: function() { return root; }, getItemWrap: function() { return itemWrap; }, getItems: function() { return itemWrap.children(conf.item).not("." + conf.clonedClass); }, move: function(offset, time) { return self.seekTo(index + offset, time); }, next: function(time) { return self.move(1, time); }, prev: function(time) { return self.move(-1, time); }, begin: function(time) { return self.seekTo(0, time); }, end: function(time) { return self.seekTo(self.getSize() -1, time); }, focus: function() { current = self; return self; }, addItem: function(item) { item = $(item); if (!conf.circular) { itemWrap.append(item); } else { $(".cloned:last").before(item); $(".cloned:first").replaceWith(item.clone().addClass(conf.clonedClass)); } fire.trigger("onAddItem", [item]); return self; }, /* all seeking functions depend on this */ seekTo: function(i, time, fn) { // check that index is sane if (!conf.circular && i < 0 || i > self.getSize()) { return self; } var item = i; if (i.jquery) { i = self.getItems().index(i); } else { item = self.getItems().eq(i); } // onBeforeSeek var e = $.Event("onBeforeSeek"); if (!fn) { fire.trigger(e, [i, time]); if (e.isDefaultPrevented() || !item.length) { return self; } } var props = vertical ? {top: -item.position().top} : {left: -item.position().left}; itemWrap.animate(props, time, conf.easing, fn || function() { fire.trigger("onSeek", [i]); }); current = self; index = i; return self; } }); // callbacks $.each("onBeforeSeek,onSeek,onAddItem".split(","), function(i, name) { // configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); // circular loop if (conf.circular) { var cloned1 = self.getItems().slice(-1).clone().prependTo(itemWrap), cloned2 = self.getItems().eq(1).clone().appendTo(itemWrap); cloned1.add(cloned2).addClass(conf.clonedClass); self.onBeforeSeek(function(e, i, time) { if (e.isDefaultPrevented()) { return; } /* 1. animate to the clone without event triggering 2. seek to correct position with 0 speed */ if (i == -1) { self.seekTo(cloned1, time, function() { self.end(0); }); return e.preventDefault(); } else if (i == self.getSize()) { self.seekTo(cloned2, time, function() { self.begin(0); }); } }); } // next/prev buttons var prev = find(root, conf.prev).click(function() { self.prev(); }), next = find(root, conf.next).click(function() { self.next(); }); if (!conf.circular && self.getSize() > 2) { self.onBeforeSeek(function(e, i) { prev.toggleClass(conf.disabledClass, i <= 0); next.toggleClass(conf.disabledClass, i >= self.getSize() -1); }); } // mousewheel support if (conf.mousewheel && $.fn.mousewheel) { root.mousewheel(function(e, delta) { if (conf.mousewheel) { self.move(delta < 0 ? 1 : -1, conf.wheelSpeed || 50); return false; } }); } if (conf.keyboard) { $(document).bind("keydown.scrollable", function(evt) { // skip certain conditions if (!conf.keyboard || evt.altKey || evt.ctrlKey || $(evt.target).is(":input")) { return; } // does this instance have focus? if (conf.keyboard != 'static' && current != self) { return; } var key = evt.keyCode; if (vertical && (key == 38 || key == 40)) { self.move(key == 38 ? -1 : 1); return evt.preventDefault(); } if (!vertical && (key == 37 || key == 39)) { self.move(key == 37 ? -1 : 1); return evt.preventDefault(); } }); } // initial index $(self).trigger("onBeforeSeek", [conf.initialIndex]); self.seekTo(conf.initialIndex, 0, true); } |
|
}); } var lconf = $.tools.lazyload && conf.lazyload, loader, doLoad = function (ev, i) { loader.load(self.getItems().eq(i).find(":unloaded").andSelf()); }; if (lconf) { if (typeof lconf != 'object') { lconf = { select: lconf }; } if (typeof lconf.select != 'string') { lconf.select = "img, :backgroundImage"; } loader = itemWrap.find(lconf.select).lazyload(lconf).data("lazyload"); self.onBeforeSeek(doLoad); } | }); } | function Scrollable(root, conf) { // current instance var self = this, fire = root.add(self), itemWrap = root.children(), index = 0, forward, vertical = conf.vertical; if (!current) { current = self; } if (itemWrap.length > 1) { itemWrap = $(conf.items, root); } // methods $.extend(self, { getConf: function() { return conf; }, getIndex: function() { return index; }, getSize: function() { return self.getItems().size(); }, getNaviButtons: function() { return prev.add(next); }, getRoot: function() { return root; }, getItemWrap: function() { return itemWrap; }, getItems: function() { return itemWrap.children(conf.item).not("." + conf.clonedClass); }, move: function(offset, time) { return self.seekTo(index + offset, time); }, next: function(time) { return self.move(1, time); }, prev: function(time) { return self.move(-1, time); }, begin: function(time) { return self.seekTo(0, time); }, end: function(time) { return self.seekTo(self.getSize() -1, time); }, focus: function() { current = self; return self; }, addItem: function(item) { item = $(item); if (!conf.circular) { itemWrap.append(item); } else { $(".cloned:last").before(item); $(".cloned:first").replaceWith(item.clone().addClass(conf.clonedClass)); } fire.trigger("onAddItem", [item]); return self; }, /* all seeking functions depend on this */ seekTo: function(i, time, fn) { // check that index is sane if (!conf.circular && i < 0 || i > self.getSize()) { return self; } var item = i; if (i.jquery) { i = self.getItems().index(i); } else { item = self.getItems().eq(i); } // onBeforeSeek var e = $.Event("onBeforeSeek"); if (!fn) { fire.trigger(e, [i, time]); if (e.isDefaultPrevented() || !item.length) { return self; } } var props = vertical ? {top: -item.position().top} : {left: -item.position().left}; itemWrap.animate(props, time, conf.easing, fn || function() { fire.trigger("onSeek", [i]); }); current = self; index = i; return self; } }); // callbacks $.each("onBeforeSeek,onSeek,onAddItem".split(","), function(i, name) { // configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); // circular loop if (conf.circular) { var cloned1 = self.getItems().slice(-1).clone().prependTo(itemWrap), cloned2 = self.getItems().eq(1).clone().appendTo(itemWrap); cloned1.add(cloned2).addClass(conf.clonedClass); self.onBeforeSeek(function(e, i, time) { if (e.isDefaultPrevented()) { return; } /* 1. animate to the clone without event triggering 2. seek to correct position with 0 speed */ if (i == -1) { self.seekTo(cloned1, time, function() { self.end(0); }); return e.preventDefault(); } else if (i == self.getSize()) { self.seekTo(cloned2, time, function() { self.begin(0); }); } }); } // next/prev buttons var prev = root.parent().find(conf.prev).click(function() { self.prev(); }), next = root.parent().find(conf.next).click(function() { self.next(); }); if (!conf.circular && self.getSize() > 2) { self.onBeforeSeek(function(e, i) { prev.toggleClass(conf.disabledClass, i <= 0); next.toggleClass(conf.disabledClass, i >= self.getSize() -1); }); } // mousewheel support if (conf.mousewheel && $.fn.mousewheel) { root.mousewheel(function(e, delta) { if (conf.mousewheel) { self.move(delta < 0 ? 1 : -1, conf.wheelSpeed || 50); return false; } }); } if (conf.clickable) { root.click(function() { if (conf.clickable) { self.next(); } }); } if (conf.keyboard) { $(document).bind("keydown.scrollable", function(evt) { // skip certain conditions if (!conf.keyboard || evt.altKey || evt.ctrlKey || $(evt.target).is(":input")) { return; } // does this instance have focus? if (conf.keyboard != 'static' && current != self) { return; } var key = evt.keyCode; if (vertical && (key == 38 || key == 40)) { self.move(key == 38 ? -1 : 1); return evt.preventDefault(); } if (!vertical && (key == 37 || key == 39)) { self.move(key == 37 ? -1 : 1); return evt.preventDefault(); } }); } // lazyload support. all logic is here. var lconf = $.tools.lazyload && conf.lazyload, loader, doLoad = function (ev, i) { loader.load(self.getItems().eq(i).find(":unloaded").andSelf()); }; if (lconf) { // lazyload configuration if (typeof lconf != 'object') { lconf = { select: lconf }; } if (typeof lconf.select != 'string') { lconf.select = "img, :backgroundImage"; } // initialize lazyload loader = itemWrap.find(lconf.select).lazyload(lconf).data("lazyload"); self.onBeforeSeek(doLoad); } // initial index $(self).trigger("onBeforeSeek", [conf.initialIndex]); self.seekTo(conf.initialIndex, 0, true); } |
$(self).bind(name, fn); | if (fn) { $(self).bind(name, fn); } | function Scrollable(root, conf) { // current instance var self = this, fire = root.add(self), itemWrap = root.children(), index = 0, vertical = conf.vertical; if (!current) { current = self; } if (itemWrap.length > 1) { itemWrap = $(conf.items, root); } // methods $.extend(self, { getConf: function() { return conf; }, getIndex: function() { return index; }, getSize: function() { return self.getItems().size(); }, getNaviButtons: function() { return prev.add(next); }, getRoot: function() { return root; }, getItemWrap: function() { return itemWrap; }, getItems: function() { return itemWrap.children(conf.item).not("." + conf.clonedClass); }, move: function(offset, time) { return self.seekTo(index + offset, time); }, next: function(time) { return self.move(1, time); }, prev: function(time) { return self.move(-1, time); }, begin: function(time) { return self.seekTo(0, time); }, end: function(time) { return self.seekTo(self.getSize() -1, time); }, focus: function() { current = self; return self; }, addItem: function(item) { item = $(item); if (!conf.circular) { itemWrap.append(item); } else { itemWrap.children("." + conf.clonedClass + ":last").before(item); itemWrap.children("." + conf.clonedClass + ":first").replaceWith(item.clone().addClass(conf.clonedClass)); } fire.trigger("onAddItem", [item]); return self; }, /* all seeking functions depend on this */ seekTo: function(i, time, fn) { // ensure numeric index if (!i.jquery) { i *= 1; } // avoid seeking from end clone to the beginning if (conf.circular && i === 0 && index == -1 && time !== 0) { return self; } // check that index is sane if (!conf.circular && i < 0 || i > self.getSize() || i < -1) { return self; } var item = i; if (i.jquery) { i = self.getItems().index(i); } else { item = self.getItems().eq(i); } // onBeforeSeek var e = $.Event("onBeforeSeek"); if (!fn) { fire.trigger(e, [i, time]); if (e.isDefaultPrevented() || !item.length) { return self; } } var props = vertical ? {top: -item.position().top} : {left: -item.position().left}; index = i; current = self; if (time === undefined) { time = conf.speed; } itemWrap.animate(props, time, conf.easing, fn || function() { fire.trigger("onSeek", [i]); }); return self; } }); // callbacks $.each(['onBeforeSeek', 'onSeek', 'onAddItem'], function(i, name) { // configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); // circular loop if (conf.circular) { var cloned1 = self.getItems().slice(-1).clone().prependTo(itemWrap), cloned2 = self.getItems().eq(1).clone().appendTo(itemWrap); cloned1.add(cloned2).addClass(conf.clonedClass); self.onBeforeSeek(function(e, i, time) { if (e.isDefaultPrevented()) { return; } /* 1. animate to the clone without event triggering 2. seek to correct position with 0 speed */ if (i == -1) { self.seekTo(cloned1, time, function() { self.end(0); }); return e.preventDefault(); } else if (i == self.getSize()) { self.seekTo(cloned2, time, function() { self.begin(0); }); } }); // seek over the cloned item self.seekTo(0, 0, function() {}); } // next/prev buttons var prev = find(root, conf.prev).click(function() { self.prev(); }), next = find(root, conf.next).click(function() { self.next(); }); if (!conf.circular && self.getSize() > 1) { self.onBeforeSeek(function(e, i) { setTimeout(function() { if (!e.isDefaultPrevented()) { prev.toggleClass(conf.disabledClass, i <= 0); next.toggleClass(conf.disabledClass, i >= self.getSize() -1); } }, 1); }); } // mousewheel support if (conf.mousewheel && $.fn.mousewheel) { root.mousewheel(function(e, delta) { if (conf.mousewheel) { self.move(delta < 0 ? 1 : -1, conf.wheelSpeed || 50); return false; } }); } if (conf.keyboard) { $(document).bind("keydown.scrollable", function(evt) { // skip certain conditions if (!conf.keyboard || evt.altKey || evt.ctrlKey || $(evt.target).is(":input")) { return; } // does this instance have focus? if (conf.keyboard != 'static' && current != self) { return; } var key = evt.keyCode; if (vertical && (key == 38 || key == 40)) { self.move(key == 38 ? -1 : 1); return evt.preventDefault(); } if (!vertical && (key == 37 || key == 39)) { self.move(key == 37 ? -1 : 1); return evt.preventDefault(); } }); } // initial index if (conf.initialIndex) { self.seekTo(conf.initialIndex, 0, function() {}); } } |
lazies = lconf === true ? self.getItems() : root.find(lconf.select || lconf); | if (lconf === true) { lconf = "img, :backgroundImage"; } lazies = root.find(lconf.select || lconf); | function Scrollable(root, conf) { // current instance var self = this, $self = $(this), horizontal = !conf.vertical, wrap = root.children(), index = 0, forward; if (!current) { current = self; } // bind all callbacks from configuration $.each(conf, function(name, fn) { if ($.isFunction(fn)) { $self.bind(name, fn); } }); if (wrap.length > 1) { wrap = $(conf.items, root); } // navigational items can be anywhere when globalNav = true function find(query) { var els = $(query); return conf.globalNav ? els : root.parent().find(query); } // to be used by plugins root.data("finder", find); // get handle to navigational elements var prev = find(conf.prev), next = find(conf.next), prevPage = find(conf.prevPage), nextPage = find(conf.nextPage); // methods $.extend(self, { getIndex: function() { return index; }, getClickIndex: function() { var items = self.getItems(); return items.index(items.filter("." + conf.activeClass)); }, getConf: function() { return conf; }, getSize: function() { return self.getItems().size(); }, getPageAmount: function() { return Math.ceil(this.getSize() / conf.size); }, getPageIndex: function() { return Math.ceil(index / conf.size); }, getNaviButtons: function() { return prev.add(next).add(prevPage).add(nextPage); }, getRoot: function() { return root; }, getItemWrap: function() { return wrap; }, getItems: function() { return wrap.children(conf.item); }, getVisibleItems: function() { return self.getItems().slice(index, index + conf.size); }, /* all seeking functions depend on this */ seekTo: function(i, time, fn) { if (i < 0) { i = 0; } // nothing happens if (index === i) { return self; } // function given as second argument if ($.isFunction(time)) { fn = time; } // seeking exceeds the end if (i > self.getSize() - conf.size) { return conf.loop ? self.begin() : this.end(); } var item = self.getItems().eq(i); if (!item.length) { return self; } // onBeforeSeek var e = $.Event("onBeforeSeek"); $self.trigger(e, [i]); if (e.isDefaultPrevented()) { return self; } // get the (possibly altered) speed if (time === undefined || $.isFunction(time)) { time = conf.speed; } function callback() { if (fn) { fn.call(self, i); } $self.trigger("onSeek", [i]); } if (horizontal) { wrap.animate({left: -item.position().left}, time, conf.easing, callback); } else { wrap.animate({top: -item.position().top}, time, conf.easing, callback); } current = self; index = i; // onStart e = $.Event("onStart"); $self.trigger(e, [i]); if (e.isDefaultPrevented()) { return self; } /* default behaviour */ // prev/next buttons disabled flags prev.add(prevPage).toggleClass(conf.disabledClass, i === 0); next.add(nextPage).toggleClass(conf.disabledClass, i >= self.getSize() - conf.size); return self; }, move: function(offset, time, fn) { forward = offset > 0; return this.seekTo(index + offset, time, fn); }, next: function(time, fn) { return this.move(1, time, fn); }, prev: function(time, fn) { return this.move(-1, time, fn); }, movePage: function(offset, time, fn) { forward = offset > 0; var steps = conf.size * offset; var i = index % conf.size; if (i > 0) { steps += (offset > 0 ? -i : conf.size - i); } return this.move(steps, time, fn); }, prevPage: function(time, fn) { return this.movePage(-1, time, fn); }, nextPage: function(time, fn) { return this.movePage(1, time, fn); }, setPage: function(page, time, fn) { return this.seekTo(page * conf.size, time, fn); }, begin: function(time, fn) { forward = false; return this.seekTo(0, time, fn); }, end: function(time, fn) { forward = true; var to = this.getSize() - conf.size; return to > 0 ? this.seekTo(to, time, fn) : self; }, reload: function() { $self.trigger("onReload"); return self; }, focus: function() { current = self; return self; }, getLoader: function() { return loader; }, click: function(i) { var item = self.getItems().eq(i), klass = conf.activeClass, size = conf.size; // check that i is sane if (i < 0 || i >= self.getSize()) { return self; } // size == 1 if (size == 1) { if (conf.loop) { return self.next(); } if (i === 0 || i == self.getSize() -1) { forward = (forward === undefined) ? true : !forward; } return forward === false ? self.prev() : self.next(); } // size == 2 if (size == 2) { if (i == index) { i--; } self.getItems().removeClass(klass); item.addClass(klass); return self.seekTo(i, time, fn); } if (!item.hasClass(klass)) { self.getItems().removeClass(klass); item.addClass(klass); var delta = Math.floor(size / 2); var to = i - delta; // next to last item must work if (to > self.getSize() - size) { to = self.getSize() - size; } if (to !== i) { return self.seekTo(to); } } return self; }, // bind / unbind bind: function(name, fn) { $self.bind(name, fn); return self; }, unbind: function(name) { $self.unbind(name); return self; } }); // callbacks $.each("onBeforeSeek,onStart,onSeek,onReload".split(","), function(i, ev) { self[ev] = function(fn) { return self.bind(ev, fn); }; }); // prev button prev.addClass(conf.disabledClass).click(function() { self.prev(); }); // next button next.click(function() { self.next(); }); // prev page button nextPage.click(function() { self.nextPage(); }); if (self.getSize() < conf.size) { next.add(nextPage).addClass(conf.disabledClass); } // next page button prevPage.addClass(conf.disabledClass).click(function() { self.prevPage(); }); // hover var hc = conf.hoverClass, keyId = "keydown." + Math.random().toString().substring(10); self.onReload(function() { // hovering if (hc) { self.getItems().hover(function() { $(this).addClass(hc); }, function() { $(this).removeClass(hc); }); } // clickable if (conf.clickable) { self.getItems().each(function(i) { $(this).unbind("click.scrollable").bind("click.scrollable", function(e) { if ($(e.target).is("a")) { return; } return self.click(i); }); }); } // keyboard if (conf.keyboard) { // keyboard works on one instance at the time. thus we need to unbind first $(document).unbind(keyId).bind(keyId, function(evt) { // do nothing with CTRL / ALT buttons if (evt.altKey || evt.ctrlKey) { return; } // do nothing for unstatic and unfocused instances if (conf.keyboard != 'static' && current != self) { return; } var s = conf.keyboardSteps; if (horizontal && (evt.keyCode == 37 || evt.keyCode == 39)) { self.move(evt.keyCode == 37 ? -s : s); return evt.preventDefault(); } if (!horizontal && (evt.keyCode == 38 || evt.keyCode == 40)) { self.move(evt.keyCode == 38 ? -s : s); return evt.preventDefault(); } return true; }); } else { $(document).unbind(keyId); } // mousewheel support if (conf.mousewheel && $.fn.mousewheel) { root.mousewheel(function(e, delta) { self.move(delta < 0 ? 1 : -1, conf.wheelSpeed || 50); return false; }); } }); // lazyload support. all logic is here. var lconf = $.tools.lazyload && conf.lazyload, loader, lazies; if (lconf) { lazies = lconf === true ? self.getItems() : root.find(lconf.select || lconf); if (typeof lconf != 'object') { lconf = {}; } $.extend(lconf, { growParent: root, api: true}, lconf); loader = lazies.lazyload(lconf); function load(ev, i) { var els = self.getItems().slice(i, i + conf.size); els.each(function() { els = els.add($(this).find(":unloaded")); }); loader.load(els); } self.onBeforeSeek(load); load(null, 0); } self.reload(); } |
return self.seekTo(i, time, fn); | return self.seekTo(i); | function Scrollable(root, conf) { // current instance var self = this, $self = $(this), horizontal = !conf.vertical, wrap = root.children(), index = 0, forward; if (!current) { current = self; } // bind all callbacks from configuration $.each(conf, function(name, fn) { if ($.isFunction(fn)) { $self.bind(name, fn); } }); if (wrap.length > 1) { wrap = $(conf.items, root); } // navigational items can be anywhere when globalNav = true function find(query) { var els = $(query); return conf.globalNav ? els : root.parent().find(query); } // to be used by plugins root.data("finder", find); // get handle to navigational elements var prev = find(conf.prev), next = find(conf.next), prevPage = find(conf.prevPage), nextPage = find(conf.nextPage); // methods $.extend(self, { getIndex: function() { return index; }, getClickIndex: function() { var items = self.getItems(); return items.index(items.filter("." + conf.activeClass)); }, getConf: function() { return conf; }, getSize: function() { return self.getItems().size(); }, getPageAmount: function() { return Math.ceil(this.getSize() / conf.size); }, getPageIndex: function() { return Math.ceil(index / conf.size); }, getNaviButtons: function() { return prev.add(next).add(prevPage).add(nextPage); }, getRoot: function() { return root; }, getItemWrap: function() { return wrap; }, getItems: function() { return wrap.children(conf.item); }, getVisibleItems: function() { return self.getItems().slice(index, index + conf.size); }, /* all seeking functions depend on this */ seekTo: function(i, time, fn) { if (i < 0) { i = 0; } // nothing happens if (index === i) { return self; } // function given as second argument if ($.isFunction(time)) { fn = time; } // seeking exceeds the end if (i > self.getSize() - conf.size) { return conf.loop ? self.begin() : this.end(); } var item = self.getItems().eq(i); if (!item.length) { return self; } // onBeforeSeek var e = $.Event("onBeforeSeek"); $self.trigger(e, [i]); if (e.isDefaultPrevented()) { return self; } // get the (possibly altered) speed if (time === undefined || $.isFunction(time)) { time = conf.speed; } function callback() { if (fn) { fn.call(self, i); } $self.trigger("onSeek", [i]); } if (horizontal) { wrap.animate({left: -item.position().left}, time, conf.easing, callback); } else { wrap.animate({top: -item.position().top}, time, conf.easing, callback); } current = self; index = i; // onStart e = $.Event("onStart"); $self.trigger(e, [i]); if (e.isDefaultPrevented()) { return self; } /* default behaviour */ // prev/next buttons disabled flags prev.add(prevPage).toggleClass(conf.disabledClass, i === 0); next.add(nextPage).toggleClass(conf.disabledClass, i >= self.getSize() - conf.size); return self; }, move: function(offset, time, fn) { forward = offset > 0; return this.seekTo(index + offset, time, fn); }, next: function(time, fn) { return this.move(1, time, fn); }, prev: function(time, fn) { return this.move(-1, time, fn); }, movePage: function(offset, time, fn) { forward = offset > 0; var steps = conf.size * offset; var i = index % conf.size; if (i > 0) { steps += (offset > 0 ? -i : conf.size - i); } return this.move(steps, time, fn); }, prevPage: function(time, fn) { return this.movePage(-1, time, fn); }, nextPage: function(time, fn) { return this.movePage(1, time, fn); }, setPage: function(page, time, fn) { return this.seekTo(page * conf.size, time, fn); }, begin: function(time, fn) { forward = false; return this.seekTo(0, time, fn); }, end: function(time, fn) { forward = true; var to = this.getSize() - conf.size; return to > 0 ? this.seekTo(to, time, fn) : self; }, reload: function() { $self.trigger("onReload"); return self; }, focus: function() { current = self; return self; }, getLoader: function() { return loader; }, click: function(i) { var item = self.getItems().eq(i), klass = conf.activeClass, size = conf.size; // check that i is sane if (i < 0 || i >= self.getSize()) { return self; } // size == 1 if (size == 1) { if (conf.loop) { return self.next(); } if (i === 0 || i == self.getSize() -1) { forward = (forward === undefined) ? true : !forward; } return forward === false ? self.prev() : self.next(); } // size == 2 if (size == 2) { if (i == index) { i--; } self.getItems().removeClass(klass); item.addClass(klass); return self.seekTo(i, time, fn); } if (!item.hasClass(klass)) { self.getItems().removeClass(klass); item.addClass(klass); var delta = Math.floor(size / 2); var to = i - delta; // next to last item must work if (to > self.getSize() - size) { to = self.getSize() - size; } if (to !== i) { return self.seekTo(to); } } return self; }, // bind / unbind bind: function(name, fn) { $self.bind(name, fn); return self; }, unbind: function(name) { $self.unbind(name); return self; } }); // callbacks $.each("onBeforeSeek,onStart,onSeek,onReload".split(","), function(i, ev) { self[ev] = function(fn) { return self.bind(ev, fn); }; }); // prev button prev.addClass(conf.disabledClass).click(function() { self.prev(); }); // next button next.click(function() { self.next(); }); // prev page button nextPage.click(function() { self.nextPage(); }); if (self.getSize() < conf.size) { next.add(nextPage).addClass(conf.disabledClass); } // next page button prevPage.addClass(conf.disabledClass).click(function() { self.prevPage(); }); // hover var hc = conf.hoverClass, keyId = "keydown." + Math.random().toString().substring(10); self.onReload(function() { // hovering if (hc) { self.getItems().hover(function() { $(this).addClass(hc); }, function() { $(this).removeClass(hc); }); } // clickable if (conf.clickable) { self.getItems().each(function(i) { $(this).unbind("click.scrollable").bind("click.scrollable", function(e) { if ($(e.target).is("a")) { return; } return self.click(i); }); }); } // keyboard if (conf.keyboard) { // keyboard works on one instance at the time. thus we need to unbind first $(document).unbind(keyId).bind(keyId, function(evt) { // do nothing with CTRL / ALT buttons if (evt.altKey || evt.ctrlKey) { return; } // do nothing for unstatic and unfocused instances if (conf.keyboard != 'static' && current != self) { return; } var s = conf.keyboardSteps; if (horizontal && (evt.keyCode == 37 || evt.keyCode == 39)) { self.move(evt.keyCode == 37 ? -s : s); return evt.preventDefault(); } if (!horizontal && (evt.keyCode == 38 || evt.keyCode == 40)) { self.move(evt.keyCode == 38 ? -s : s); return evt.preventDefault(); } return true; }); } else { $(document).unbind(keyId); } // mousewheel support if (conf.mousewheel && $.fn.mousewheel) { root.mousewheel(function(e, delta) { self.move(delta < 0 ? 1 : -1, conf.wheelSpeed || 50); return false; }); } }); // lazyload support. all logic is here. var lconf = $.tools.lazyload && conf.lazyload, loader, lazies; if (lconf) { lazies = lconf === true ? self.getItems() : root.find(lconf.select || lconf); if (typeof lconf != 'object') { lconf = {}; } $.extend(lconf, { growParent: root, api: true}, lconf); loader = lazies.lazyload(lconf); function load(ev, i) { var els = self.getItems().slice(i, i + conf.size); els.each(function() { els = els.add($(this).find(":unloaded")); }); loader.load(els); } self.onBeforeSeek(load); load(null, 0); } self.reload(); } |
if (!conf.circular && self.getSize() > 2) { | if (!conf.circular && self.getSize() > 1) { | function Scrollable(root, conf) { // current instance var self = this, fire = root.add(self), itemWrap = root.children(), index = 0, forward, vertical = conf.vertical; if (!current) { current = self; } if (itemWrap.length > 1) { itemWrap = $(conf.items, root); } // methods $.extend(self, { getConf: function() { return conf; }, getIndex: function() { return index; }, getSize: function() { return self.getItems().size(); }, getNaviButtons: function() { return prev.add(next); }, getRoot: function() { return root; }, getItemWrap: function() { return itemWrap; }, getItems: function() { return itemWrap.children(conf.item).not("." + conf.clonedClass); }, move: function(offset, time) { return self.seekTo(index + offset, time); }, next: function(time) { return self.move(1, time); }, prev: function(time) { return self.move(-1, time); }, begin: function(time) { return self.seekTo(0, time); }, end: function(time) { return self.seekTo(self.getSize() -1, time); }, focus: function() { current = self; return self; }, addItem: function(item) { item = $(item); if (!conf.circular) { itemWrap.append(item); } else { $(".cloned:last").before(item); $(".cloned:first").replaceWith(item.clone().addClass(conf.clonedClass)); } fire.trigger("onAddItem", [item]); return self; }, /* all seeking functions depend on this */ seekTo: function(i, time, fn) { // check that index is sane if (!conf.circular && i < 0 || i > self.getSize()) { return self; } var item = i; if (i.jquery) { i = self.getItems().index(i); } else { item = self.getItems().eq(i); } // onBeforeSeek var e = $.Event("onBeforeSeek"); if (!fn) { fire.trigger(e, [i, time]); if (e.isDefaultPrevented() || !item.length) { return self; } } var props = vertical ? {top: -item.position().top} : {left: -item.position().left}; itemWrap.animate(props, time, conf.easing, fn || function() { fire.trigger("onSeek", [i]); }); current = self; index = i; return self; } }); // callbacks $.each(['onBeforeSeek', 'onSeek', 'onAddItem'], function(i, name) { // configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); // circular loop if (conf.circular) { var cloned1 = self.getItems().slice(-1).clone().prependTo(itemWrap), cloned2 = self.getItems().eq(1).clone().appendTo(itemWrap); cloned1.add(cloned2).addClass(conf.clonedClass); self.onBeforeSeek(function(e, i, time) { if (e.isDefaultPrevented()) { return; } /* 1. animate to the clone without event triggering 2. seek to correct position with 0 speed */ if (i == -1) { self.seekTo(cloned1, time, function() { self.end(0); }); return e.preventDefault(); } else if (i == self.getSize()) { self.seekTo(cloned2, time, function() { self.begin(0); }); } }); // seek over the cloned item self.seekTo(0, 0); } // next/prev buttons var prev = find(root, conf.prev).click(function() { self.prev(); }), next = find(root, conf.next).click(function() { self.next(); }); if (!conf.circular && self.getSize() > 2) { self.onBeforeSeek(function(e, i) { prev.toggleClass(conf.disabledClass, i <= 0); next.toggleClass(conf.disabledClass, i >= self.getSize() -1); }); } // mousewheel support if (conf.mousewheel && $.fn.mousewheel) { root.mousewheel(function(e, delta) { if (conf.mousewheel) { self.move(delta < 0 ? 1 : -1, conf.wheelSpeed || 50); return false; } }); } if (conf.keyboard) { $(document).bind("keydown.scrollable", function(evt) { // skip certain conditions if (!conf.keyboard || evt.altKey || evt.ctrlKey || $(evt.target).is(":input")) { return; } // does this instance have focus? if (conf.keyboard != 'static' && current != self) { return; } var key = evt.keyCode; if (vertical && (key == 38 || key == 40)) { self.move(key == 38 ? -1 : 1); return evt.preventDefault(); } if (!vertical && (key == 37 || key == 39)) { self.move(key == 37 ? -1 : 1); return evt.preventDefault(); } }); } // initial index $(self).trigger("onBeforeSeek", [conf.initialIndex]); } |
prev.toggleClass(conf.disabledClass, i <= 0); next.toggleClass(conf.disabledClass, i >= self.getSize() -1); | setTimeout(function() { if (!e.isDefaultPrevented()) { prev.toggleClass(conf.disabledClass, i <= 0); next.toggleClass(conf.disabledClass, i >= self.getSize() -1); } }, 1); | function Scrollable(root, conf) { // current instance var self = this, fire = root.add(self), itemWrap = root.children(), index = 0, vertical = conf.vertical; if (!current) { current = self; } if (itemWrap.length > 1) { itemWrap = $(conf.items, root); } // methods $.extend(self, { getConf: function() { return conf; }, getIndex: function() { return index; }, getSize: function() { return self.getItems().size(); }, getNaviButtons: function() { return prev.add(next); }, getRoot: function() { return root; }, getItemWrap: function() { return itemWrap; }, getItems: function() { return itemWrap.children(conf.item).not("." + conf.clonedClass); }, move: function(offset, time) { return self.seekTo(index + offset, time); }, next: function(time) { return self.move(1, time); }, prev: function(time) { return self.move(-1, time); }, begin: function(time) { return self.seekTo(0, time); }, end: function(time) { return self.seekTo(self.getSize() -1, time); }, focus: function() { current = self; return self; }, addItem: function(item) { item = $(item); if (!conf.circular) { itemWrap.append(item); } else { $(".cloned:last").before(item); $(".cloned:first").replaceWith(item.clone().addClass(conf.clonedClass)); } fire.trigger("onAddItem", [item]); return self; }, /* all seeking functions depend on this */ seekTo: function(i, time, fn) { // avoid seeking from end clone to the beginning if (conf.circular && i === 0 && index == -1 && time !== 0) { return self; } // check that index is sane if (!conf.circular && i < 0 || i > self.getSize() || i < -1) { return self; } var item = i; if (i.jquery) { i = self.getItems().index(i); } else { item = self.getItems().eq(i); } // onBeforeSeek var e = $.Event("onBeforeSeek"); if (!fn) { fire.trigger(e, [i, time]); if (e.isDefaultPrevented() || !item.length) { return self; } } var props = vertical ? {top: -item.position().top} : {left: -item.position().left}; index = i; current = self; if (time === undefined) { time = conf.speed; } itemWrap.animate(props, time, conf.easing, fn || function() { fire.trigger("onSeek", [i]); }); return self; } }); // callbacks $.each(['onBeforeSeek', 'onSeek', 'onAddItem'], function(i, name) { // configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); // circular loop if (conf.circular) { var cloned1 = self.getItems().slice(-1).clone().prependTo(itemWrap), cloned2 = self.getItems().eq(1).clone().appendTo(itemWrap); cloned1.add(cloned2).addClass(conf.clonedClass); self.onBeforeSeek(function(e, i, time) { if (e.isDefaultPrevented()) { return; } /* 1. animate to the clone without event triggering 2. seek to correct position with 0 speed */ if (i == -1) { self.seekTo(cloned1, time, function() { self.end(0); }); return e.preventDefault(); } else if (i == self.getSize()) { self.seekTo(cloned2, time, function() { self.begin(0); }); } }); // seek over the cloned item self.seekTo(0, 0); } // next/prev buttons var prev = find(root, conf.prev).click(function() { self.prev(); }), next = find(root, conf.next).click(function() { self.next(); }); if (!conf.circular && self.getSize() > 1) { self.onBeforeSeek(function(e, i) { prev.toggleClass(conf.disabledClass, i <= 0); next.toggleClass(conf.disabledClass, i >= self.getSize() -1); }); } // mousewheel support if (conf.mousewheel && $.fn.mousewheel) { root.mousewheel(function(e, delta) { if (conf.mousewheel) { self.move(delta < 0 ? 1 : -1, conf.wheelSpeed || 50); return false; } }); } if (conf.keyboard) { $(document).bind("keydown.scrollable", function(evt) { // skip certain conditions if (!conf.keyboard || evt.altKey || evt.ctrlKey || $(evt.target).is(":input")) { return; } // does this instance have focus? if (conf.keyboard != 'static' && current != self) { return; } var key = evt.keyCode; if (vertical && (key == 38 || key == 40)) { self.move(key == 38 ? -1 : 1); return evt.preventDefault(); } if (!vertical && (key == 37 || key == 39)) { self.move(key == 37 ? -1 : 1); return evt.preventDefault(); } }); } // initial index $(self).trigger("onBeforeSeek", [conf.initialIndex]); } |
seekTo: function(i, time, fn) { | seekTo: function(i, time, fn) { if (conf.circular && i === 0 && index == -1 && time !== 0) { return self; } | function Scrollable(root, conf) { // current instance var self = this, fire = root.add(self), itemWrap = root.children(), index = 0, vertical = conf.vertical; if (!current) { current = self; } if (itemWrap.length > 1) { itemWrap = $(conf.items, root); } // methods $.extend(self, { getConf: function() { return conf; }, getIndex: function() { return index; }, getSize: function() { return self.getItems().size(); }, getNaviButtons: function() { return prev.add(next); }, getRoot: function() { return root; }, getItemWrap: function() { return itemWrap; }, getItems: function() { return itemWrap.children(conf.item).not("." + conf.clonedClass); }, move: function(offset, time) { return self.seekTo(index + offset, time); }, next: function(time) { return self.move(1, time); }, prev: function(time) { return self.move(-1, time); }, begin: function(time) { return self.seekTo(0, time); }, end: function(time) { return self.seekTo(self.getSize() -1, time); }, focus: function() { current = self; return self; }, addItem: function(item) { item = $(item); if (!conf.circular) { itemWrap.append(item); } else { $(".cloned:last").before(item); $(".cloned:first").replaceWith(item.clone().addClass(conf.clonedClass)); } fire.trigger("onAddItem", [item]); return self; }, /* all seeking functions depend on this */ seekTo: function(i, time, fn) { // check that index is sane if (!conf.circular && i < 0 || i > self.getSize()) { return self; } var item = i; if (i.jquery) { i = self.getItems().index(i); } else { item = self.getItems().eq(i); } // onBeforeSeek var e = $.Event("onBeforeSeek"); if (!fn) { fire.trigger(e, [i, time]); if (e.isDefaultPrevented() || !item.length) { return self; } } var props = vertical ? {top: -item.position().top} : {left: -item.position().left}; index = i; current = self; time = time || conf.speed; itemWrap.animate(props, time, conf.easing, fn || function() { fire.trigger("onSeek", [i]); }); return self; } }); // callbacks $.each(['onBeforeSeek', 'onSeek', 'onAddItem'], function(i, name) { // configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); // circular loop if (conf.circular) { var cloned1 = self.getItems().slice(-1).clone().prependTo(itemWrap), cloned2 = self.getItems().eq(1).clone().appendTo(itemWrap); cloned1.add(cloned2).addClass(conf.clonedClass); self.onBeforeSeek(function(e, i, time) { if (e.isDefaultPrevented()) { return; } /* 1. animate to the clone without event triggering 2. seek to correct position with 0 speed */ if (i == -1) { self.seekTo(cloned1, time, function() { self.end(0); }); return e.preventDefault(); } else if (i == self.getSize()) { self.seekTo(cloned2, time, function() { self.begin(0); }); } }); // seek over the cloned item self.seekTo(0, 0); } // next/prev buttons var prev = find(root, conf.prev).click(function() { self.prev(); }), next = find(root, conf.next).click(function() { self.next(); }); if (!conf.circular && self.getSize() > 1) { self.onBeforeSeek(function(e, i) { prev.toggleClass(conf.disabledClass, i <= 0); next.toggleClass(conf.disabledClass, i >= self.getSize() -1); }); } // mousewheel support if (conf.mousewheel && $.fn.mousewheel) { root.mousewheel(function(e, delta) { if (conf.mousewheel) { self.move(delta < 0 ? 1 : -1, conf.wheelSpeed || 50); return false; } }); } if (conf.keyboard) { $(document).bind("keydown.scrollable", function(evt) { // skip certain conditions if (!conf.keyboard || evt.altKey || evt.ctrlKey || $(evt.target).is(":input")) { return; } // does this instance have focus? if (conf.keyboard != 'static' && current != self) { return; } var key = evt.keyCode; if (vertical && (key == 38 || key == 40)) { self.move(key == 38 ? -1 : 1); return evt.preventDefault(); } if (!vertical && (key == 37 || key == 39)) { self.move(key == 37 ? -1 : 1); return evt.preventDefault(); } }); } // initial index $(self).trigger("onBeforeSeek", [conf.initialIndex]); } |
if (!conf.circular && i < 0 || i > self.getSize()) { return self; } | if (!conf.circular && i < 0 || i > self.getSize() || i < -1) { return self; } | function Scrollable(root, conf) { // current instance var self = this, fire = root.add(self), itemWrap = root.children(), index = 0, vertical = conf.vertical; if (!current) { current = self; } if (itemWrap.length > 1) { itemWrap = $(conf.items, root); } // methods $.extend(self, { getConf: function() { return conf; }, getIndex: function() { return index; }, getSize: function() { return self.getItems().size(); }, getNaviButtons: function() { return prev.add(next); }, getRoot: function() { return root; }, getItemWrap: function() { return itemWrap; }, getItems: function() { return itemWrap.children(conf.item).not("." + conf.clonedClass); }, move: function(offset, time) { return self.seekTo(index + offset, time); }, next: function(time) { return self.move(1, time); }, prev: function(time) { return self.move(-1, time); }, begin: function(time) { return self.seekTo(0, time); }, end: function(time) { return self.seekTo(self.getSize() -1, time); }, focus: function() { current = self; return self; }, addItem: function(item) { item = $(item); if (!conf.circular) { itemWrap.append(item); } else { $(".cloned:last").before(item); $(".cloned:first").replaceWith(item.clone().addClass(conf.clonedClass)); } fire.trigger("onAddItem", [item]); return self; }, /* all seeking functions depend on this */ seekTo: function(i, time, fn) { // check that index is sane if (!conf.circular && i < 0 || i > self.getSize()) { return self; } var item = i; if (i.jquery) { i = self.getItems().index(i); } else { item = self.getItems().eq(i); } // onBeforeSeek var e = $.Event("onBeforeSeek"); if (!fn) { fire.trigger(e, [i, time]); if (e.isDefaultPrevented() || !item.length) { return self; } } var props = vertical ? {top: -item.position().top} : {left: -item.position().left}; index = i; current = self; time = time || conf.speed; itemWrap.animate(props, time, conf.easing, fn || function() { fire.trigger("onSeek", [i]); }); return self; } }); // callbacks $.each(['onBeforeSeek', 'onSeek', 'onAddItem'], function(i, name) { // configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); // circular loop if (conf.circular) { var cloned1 = self.getItems().slice(-1).clone().prependTo(itemWrap), cloned2 = self.getItems().eq(1).clone().appendTo(itemWrap); cloned1.add(cloned2).addClass(conf.clonedClass); self.onBeforeSeek(function(e, i, time) { if (e.isDefaultPrevented()) { return; } /* 1. animate to the clone without event triggering 2. seek to correct position with 0 speed */ if (i == -1) { self.seekTo(cloned1, time, function() { self.end(0); }); return e.preventDefault(); } else if (i == self.getSize()) { self.seekTo(cloned2, time, function() { self.begin(0); }); } }); // seek over the cloned item self.seekTo(0, 0); } // next/prev buttons var prev = find(root, conf.prev).click(function() { self.prev(); }), next = find(root, conf.next).click(function() { self.next(); }); if (!conf.circular && self.getSize() > 1) { self.onBeforeSeek(function(e, i) { prev.toggleClass(conf.disabledClass, i <= 0); next.toggleClass(conf.disabledClass, i >= self.getSize() -1); }); } // mousewheel support if (conf.mousewheel && $.fn.mousewheel) { root.mousewheel(function(e, delta) { if (conf.mousewheel) { self.move(delta < 0 ? 1 : -1, conf.wheelSpeed || 50); return false; } }); } if (conf.keyboard) { $(document).bind("keydown.scrollable", function(evt) { // skip certain conditions if (!conf.keyboard || evt.altKey || evt.ctrlKey || $(evt.target).is(":input")) { return; } // does this instance have focus? if (conf.keyboard != 'static' && current != self) { return; } var key = evt.keyCode; if (vertical && (key == 38 || key == 40)) { self.move(key == 38 ? -1 : 1); return evt.preventDefault(); } if (!vertical && (key == 37 || key == 39)) { self.move(key == 37 ? -1 : 1); return evt.preventDefault(); } }); } // initial index $(self).trigger("onBeforeSeek", [conf.initialIndex]); } |
time = time || conf.speed; | if (time === undefined) { time = conf.speed; } | function Scrollable(root, conf) { // current instance var self = this, fire = root.add(self), itemWrap = root.children(), index = 0, vertical = conf.vertical; if (!current) { current = self; } if (itemWrap.length > 1) { itemWrap = $(conf.items, root); } // methods $.extend(self, { getConf: function() { return conf; }, getIndex: function() { return index; }, getSize: function() { return self.getItems().size(); }, getNaviButtons: function() { return prev.add(next); }, getRoot: function() { return root; }, getItemWrap: function() { return itemWrap; }, getItems: function() { return itemWrap.children(conf.item).not("." + conf.clonedClass); }, move: function(offset, time) { return self.seekTo(index + offset, time); }, next: function(time) { return self.move(1, time); }, prev: function(time) { return self.move(-1, time); }, begin: function(time) { return self.seekTo(0, time); }, end: function(time) { return self.seekTo(self.getSize() -1, time); }, focus: function() { current = self; return self; }, addItem: function(item) { item = $(item); if (!conf.circular) { itemWrap.append(item); } else { $(".cloned:last").before(item); $(".cloned:first").replaceWith(item.clone().addClass(conf.clonedClass)); } fire.trigger("onAddItem", [item]); return self; }, /* all seeking functions depend on this */ seekTo: function(i, time, fn) { // check that index is sane if (!conf.circular && i < 0 || i > self.getSize()) { return self; } var item = i; if (i.jquery) { i = self.getItems().index(i); } else { item = self.getItems().eq(i); } // onBeforeSeek var e = $.Event("onBeforeSeek"); if (!fn) { fire.trigger(e, [i, time]); if (e.isDefaultPrevented() || !item.length) { return self; } } var props = vertical ? {top: -item.position().top} : {left: -item.position().left}; index = i; current = self; time = time || conf.speed; itemWrap.animate(props, time, conf.easing, fn || function() { fire.trigger("onSeek", [i]); }); return self; } }); // callbacks $.each(['onBeforeSeek', 'onSeek', 'onAddItem'], function(i, name) { // configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); // circular loop if (conf.circular) { var cloned1 = self.getItems().slice(-1).clone().prependTo(itemWrap), cloned2 = self.getItems().eq(1).clone().appendTo(itemWrap); cloned1.add(cloned2).addClass(conf.clonedClass); self.onBeforeSeek(function(e, i, time) { if (e.isDefaultPrevented()) { return; } /* 1. animate to the clone without event triggering 2. seek to correct position with 0 speed */ if (i == -1) { self.seekTo(cloned1, time, function() { self.end(0); }); return e.preventDefault(); } else if (i == self.getSize()) { self.seekTo(cloned2, time, function() { self.begin(0); }); } }); // seek over the cloned item self.seekTo(0, 0); } // next/prev buttons var prev = find(root, conf.prev).click(function() { self.prev(); }), next = find(root, conf.next).click(function() { self.next(); }); if (!conf.circular && self.getSize() > 1) { self.onBeforeSeek(function(e, i) { prev.toggleClass(conf.disabledClass, i <= 0); next.toggleClass(conf.disabledClass, i >= self.getSize() -1); }); } // mousewheel support if (conf.mousewheel && $.fn.mousewheel) { root.mousewheel(function(e, delta) { if (conf.mousewheel) { self.move(delta < 0 ? 1 : -1, conf.wheelSpeed || 50); return false; } }); } if (conf.keyboard) { $(document).bind("keydown.scrollable", function(evt) { // skip certain conditions if (!conf.keyboard || evt.altKey || evt.ctrlKey || $(evt.target).is(":input")) { return; } // does this instance have focus? if (conf.keyboard != 'static' && current != self) { return; } var key = evt.keyCode; if (vertical && (key == 38 || key == 40)) { self.move(key == 38 ? -1 : 1); return evt.preventDefault(); } if (!vertical && (key == 37 || key == 39)) { self.move(key == 37 ? -1 : 1); return evt.preventDefault(); } }); } // initial index $(self).trigger("onBeforeSeek", [conf.initialIndex]); } |
forward, | function Scrollable(root, conf) { // current instance var self = this, fire = root.add(self), itemWrap = root.children(), index = 0, forward, vertical = conf.vertical; if (!current) { current = self; } if (itemWrap.length > 1) { itemWrap = $(conf.items, root); } // methods $.extend(self, { getConf: function() { return conf; }, getIndex: function() { return index; }, getSize: function() { return self.getItems().size(); }, getNaviButtons: function() { return prev.add(next); }, getRoot: function() { return root; }, getItemWrap: function() { return itemWrap; }, getItems: function() { return itemWrap.children(conf.item).not("." + conf.clonedClass); }, move: function(offset, time) { return self.seekTo(index + offset, time); }, next: function(time) { return self.move(1, time); }, prev: function(time) { return self.move(-1, time); }, begin: function(time) { return self.seekTo(0, time); }, end: function(time) { return self.seekTo(self.getSize() -1, time); }, focus: function() { current = self; return self; }, addItem: function(item) { item = $(item); if (!conf.circular) { itemWrap.append(item); } else { $(".cloned:last").before(item); $(".cloned:first").replaceWith(item.clone().addClass(conf.clonedClass)); } fire.trigger("onAddItem", [item]); return self; }, /* all seeking functions depend on this */ seekTo: function(i, time, fn) { // check that index is sane if (!conf.circular && i < 0 || i > self.getSize()) { return self; } var item = i; if (i.jquery) { i = self.getItems().index(i); } else { item = self.getItems().eq(i); } // onBeforeSeek var e = $.Event("onBeforeSeek"); if (!fn) { fire.trigger(e, [i, time]); if (e.isDefaultPrevented() || !item.length) { return self; } } var props = vertical ? {top: -item.position().top} : {left: -item.position().left}; itemWrap.animate(props, time, conf.easing, fn || function() { fire.trigger("onSeek", [i]); }); current = self; index = i; return self; } }); // callbacks $.each(['onBeforeSeek', 'onSeek', 'onAddItem'], function(i, name) { // configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); // circular loop if (conf.circular) { var cloned1 = self.getItems().slice(-1).clone().prependTo(itemWrap), cloned2 = self.getItems().eq(1).clone().appendTo(itemWrap); cloned1.add(cloned2).addClass(conf.clonedClass); self.onBeforeSeek(function(e, i, time) { if (e.isDefaultPrevented()) { return; } /* 1. animate to the clone without event triggering 2. seek to correct position with 0 speed */ if (i == -1) { self.seekTo(cloned1, time, function() { self.end(0); }); return e.preventDefault(); } else if (i == self.getSize()) { self.seekTo(cloned2, time, function() { self.begin(0); }); } }); // seek over the cloned item self.seekTo(0, 0); } // next/prev buttons var prev = find(root, conf.prev).click(function() { self.prev(); }), next = find(root, conf.next).click(function() { self.next(); }); if (!conf.circular && self.getSize() > 1) { self.onBeforeSeek(function(e, i) { prev.toggleClass(conf.disabledClass, i <= 0); next.toggleClass(conf.disabledClass, i >= self.getSize() -1); }); } // mousewheel support if (conf.mousewheel && $.fn.mousewheel) { root.mousewheel(function(e, delta) { if (conf.mousewheel) { self.move(delta < 0 ? 1 : -1, conf.wheelSpeed || 50); return false; } }); } if (conf.keyboard) { $(document).bind("keydown.scrollable", function(evt) { // skip certain conditions if (!conf.keyboard || evt.altKey || evt.ctrlKey || $(evt.target).is(":input")) { return; } // does this instance have focus? if (conf.keyboard != 'static' && current != self) { return; } var key = evt.keyCode; if (vertical && (key == 38 || key == 40)) { self.move(key == 38 ? -1 : 1); return evt.preventDefault(); } if (!vertical && (key == 37 || key == 39)) { self.move(key == 37 ? -1 : 1); return evt.preventDefault(); } }); } // initial index $(self).trigger("onBeforeSeek", [conf.initialIndex]); } |
|
}); current = self; index = i; | }); | function Scrollable(root, conf) { // current instance var self = this, fire = root.add(self), itemWrap = root.children(), index = 0, forward, vertical = conf.vertical; if (!current) { current = self; } if (itemWrap.length > 1) { itemWrap = $(conf.items, root); } // methods $.extend(self, { getConf: function() { return conf; }, getIndex: function() { return index; }, getSize: function() { return self.getItems().size(); }, getNaviButtons: function() { return prev.add(next); }, getRoot: function() { return root; }, getItemWrap: function() { return itemWrap; }, getItems: function() { return itemWrap.children(conf.item).not("." + conf.clonedClass); }, move: function(offset, time) { return self.seekTo(index + offset, time); }, next: function(time) { return self.move(1, time); }, prev: function(time) { return self.move(-1, time); }, begin: function(time) { return self.seekTo(0, time); }, end: function(time) { return self.seekTo(self.getSize() -1, time); }, focus: function() { current = self; return self; }, addItem: function(item) { item = $(item); if (!conf.circular) { itemWrap.append(item); } else { $(".cloned:last").before(item); $(".cloned:first").replaceWith(item.clone().addClass(conf.clonedClass)); } fire.trigger("onAddItem", [item]); return self; }, /* all seeking functions depend on this */ seekTo: function(i, time, fn) { // check that index is sane if (!conf.circular && i < 0 || i > self.getSize()) { return self; } var item = i; if (i.jquery) { i = self.getItems().index(i); } else { item = self.getItems().eq(i); } // onBeforeSeek var e = $.Event("onBeforeSeek"); if (!fn) { fire.trigger(e, [i, time]); if (e.isDefaultPrevented() || !item.length) { return self; } } var props = vertical ? {top: -item.position().top} : {left: -item.position().left}; itemWrap.animate(props, time, conf.easing, fn || function() { fire.trigger("onSeek", [i]); }); current = self; index = i; return self; } }); // callbacks $.each(['onBeforeSeek', 'onSeek', 'onAddItem'], function(i, name) { // configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); // circular loop if (conf.circular) { var cloned1 = self.getItems().slice(-1).clone().prependTo(itemWrap), cloned2 = self.getItems().eq(1).clone().appendTo(itemWrap); cloned1.add(cloned2).addClass(conf.clonedClass); self.onBeforeSeek(function(e, i, time) { if (e.isDefaultPrevented()) { return; } /* 1. animate to the clone without event triggering 2. seek to correct position with 0 speed */ if (i == -1) { self.seekTo(cloned1, time, function() { self.end(0); }); return e.preventDefault(); } else if (i == self.getSize()) { self.seekTo(cloned2, time, function() { self.begin(0); }); } }); // seek over the cloned item self.seekTo(0, 0); } // next/prev buttons var prev = find(root, conf.prev).click(function() { self.prev(); }), next = find(root, conf.next).click(function() { self.next(); }); if (!conf.circular && self.getSize() > 1) { self.onBeforeSeek(function(e, i) { prev.toggleClass(conf.disabledClass, i <= 0); next.toggleClass(conf.disabledClass, i >= self.getSize() -1); }); } // mousewheel support if (conf.mousewheel && $.fn.mousewheel) { root.mousewheel(function(e, delta) { if (conf.mousewheel) { self.move(delta < 0 ? 1 : -1, conf.wheelSpeed || 50); return false; } }); } if (conf.keyboard) { $(document).bind("keydown.scrollable", function(evt) { // skip certain conditions if (!conf.keyboard || evt.altKey || evt.ctrlKey || $(evt.target).is(":input")) { return; } // does this instance have focus? if (conf.keyboard != 'static' && current != self) { return; } var key = evt.keyCode; if (vertical && (key == 38 || key == 40)) { self.move(key == 38 ? -1 : 1); return evt.preventDefault(); } if (!vertical && (key == 37 || key == 39)) { self.move(key == 37 ? -1 : 1); return evt.preventDefault(); } }); } // initial index $(self).trigger("onBeforeSeek", [conf.initialIndex]); } |
vertical = conf.vertical; | vertical = conf.vertical || dim(root, "height") > dim(root, "width"); | function Scrollable(root, conf) { // current instance var self = this, fire = root.add(self), itemWrap = root.children(), index = 0, forward, vertical = conf.vertical; if (!current) { current = self; } if (itemWrap.length > 1) { itemWrap = $(conf.items, root); } // methods $.extend(self, { getConf: function() { return conf; }, getIndex: function() { return index; }, getSize: function() { return self.getItems().size(); }, getNaviButtons: function() { return prev.add(next); }, getRoot: function() { return root; }, getItemWrap: function() { return itemWrap; }, getItems: function() { return itemWrap.children(conf.item).not("." + conf.clonedClass); }, move: function(offset, time) { return self.seekTo(index + offset, time); }, next: function(time) { return self.move(1, time); }, prev: function(time) { return self.move(-1, time); }, begin: function(time) { return self.seekTo(0, time); }, end: function(time) { return self.seekTo(self.getSize() -1, time); }, focus: function() { current = self; return self; }, addItem: function(item) { item = $(item); if (!conf.circular) { itemWrap.append(item); } else { $(".cloned:last").before(item); $(".cloned:first").replaceWith(item.clone().addClass(conf.clonedClass)); } fire.trigger("onAddItem", [item]); return self; }, /* all seeking functions depend on this */ seekTo: function(i, time, fn) { // check that index is sane if (!conf.circular && i < 0 || i > self.getSize()) { return self; } var item = i; if (i.jquery) { i = self.getItems().index(i); } else { item = self.getItems().eq(i); } // onBeforeSeek var e = $.Event("onBeforeSeek"); if (!fn) { fire.trigger(e, [i, time]); if (e.isDefaultPrevented() || !item.length) { return self; } } var props = vertical ? {top: -item.position().top} : {left: -item.position().left}; itemWrap.animate(props, time, conf.easing, fn || function() { fire.trigger("onSeek", [i]); }); current = self; index = i; return self; } }); // callbacks $.each("onBeforeSeek,onSeek,onAddItem".split(","), function(i, name) { // configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); // circular loop if (conf.circular) { var cloned1 = self.getItems().slice(-1).clone().prependTo(itemWrap), cloned2 = self.getItems().eq(1).clone().appendTo(itemWrap); cloned1.add(cloned2).addClass(conf.clonedClass); self.onBeforeSeek(function(e, i, time) { if (e.isDefaultPrevented()) { return; } /* 1. animate to the clone without event triggering 2. seek to correct position with 0 speed */ if (i == -1) { self.seekTo(cloned1, time, function() { self.end(0); }); return e.preventDefault(); } else if (i == self.getSize()) { self.seekTo(cloned2, time, function() { self.begin(0); }); } }); } // next/prev buttons var prev = root.parent().find(conf.prev).click(function() { self.prev(); }), next = root.parent().find(conf.next).click(function() { self.next(); }); if (!conf.circular && self.getSize() > 2) { self.onBeforeSeek(function(e, i) { prev.toggleClass(conf.disabledClass, i <= 0); next.toggleClass(conf.disabledClass, i >= self.getSize() -1); }); } // mousewheel support if (conf.mousewheel && $.fn.mousewheel) { root.mousewheel(function(e, delta) { if (conf.mousewheel) { self.move(delta < 0 ? 1 : -1, conf.wheelSpeed || 50); return false; } }); } if (conf.clickable) { root.click(function() { if (conf.clickable) { self.next(); } }); } if (conf.keyboard) { $(document).bind("keydown.scrollable", function(evt) { // skip certain conditions if (!conf.keyboard || evt.altKey || evt.ctrlKey || $(evt.target).is(":input")) { return; } // does this instance have focus? if (conf.keyboard != 'static' && current != self) { return; } var key = evt.keyCode; if (vertical && (key == 38 || key == 40)) { self.move(key == 38 ? -1 : 1); return evt.preventDefault(); } if (!vertical && (key == 37 || key == 39)) { self.move(key == 37 ? -1 : 1); return evt.preventDefault(); } }); } // initial index $(self).trigger("onBeforeSeek", [conf.initialIndex]); self.seekTo(conf.initialIndex, 0, true); } |
var prev = root.parent().find(conf.prev).click(function() { self.prev(); }), next = root.parent().find(conf.next).click(function() { self.next(); }); | var prev = find(root, conf.prev).click(function() { self.prev(); }), next = find(root, conf.next).click(function() { self.next(); }); | function Scrollable(root, conf) { // current instance var self = this, fire = root.add(self), itemWrap = root.children(), index = 0, forward, vertical = conf.vertical; if (!current) { current = self; } if (itemWrap.length > 1) { itemWrap = $(conf.items, root); } // methods $.extend(self, { getConf: function() { return conf; }, getIndex: function() { return index; }, getSize: function() { return self.getItems().size(); }, getNaviButtons: function() { return prev.add(next); }, getRoot: function() { return root; }, getItemWrap: function() { return itemWrap; }, getItems: function() { return itemWrap.children(conf.item).not("." + conf.clonedClass); }, move: function(offset, time) { return self.seekTo(index + offset, time); }, next: function(time) { return self.move(1, time); }, prev: function(time) { return self.move(-1, time); }, begin: function(time) { return self.seekTo(0, time); }, end: function(time) { return self.seekTo(self.getSize() -1, time); }, focus: function() { current = self; return self; }, addItem: function(item) { item = $(item); if (!conf.circular) { itemWrap.append(item); } else { $(".cloned:last").before(item); $(".cloned:first").replaceWith(item.clone().addClass(conf.clonedClass)); } fire.trigger("onAddItem", [item]); return self; }, /* all seeking functions depend on this */ seekTo: function(i, time, fn) { // check that index is sane if (!conf.circular && i < 0 || i > self.getSize()) { return self; } var item = i; if (i.jquery) { i = self.getItems().index(i); } else { item = self.getItems().eq(i); } // onBeforeSeek var e = $.Event("onBeforeSeek"); if (!fn) { fire.trigger(e, [i, time]); if (e.isDefaultPrevented() || !item.length) { return self; } } var props = vertical ? {top: -item.position().top} : {left: -item.position().left}; itemWrap.animate(props, time, conf.easing, fn || function() { fire.trigger("onSeek", [i]); }); current = self; index = i; return self; } }); // callbacks $.each("onBeforeSeek,onSeek,onAddItem".split(","), function(i, name) { // configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); // circular loop if (conf.circular) { var cloned1 = self.getItems().slice(-1).clone().prependTo(itemWrap), cloned2 = self.getItems().eq(1).clone().appendTo(itemWrap); cloned1.add(cloned2).addClass(conf.clonedClass); self.onBeforeSeek(function(e, i, time) { if (e.isDefaultPrevented()) { return; } /* 1. animate to the clone without event triggering 2. seek to correct position with 0 speed */ if (i == -1) { self.seekTo(cloned1, time, function() { self.end(0); }); return e.preventDefault(); } else if (i == self.getSize()) { self.seekTo(cloned2, time, function() { self.begin(0); }); } }); } // next/prev buttons var prev = root.parent().find(conf.prev).click(function() { self.prev(); }), next = root.parent().find(conf.next).click(function() { self.next(); }); if (!conf.circular && self.getSize() > 2) { self.onBeforeSeek(function(e, i) { prev.toggleClass(conf.disabledClass, i <= 0); next.toggleClass(conf.disabledClass, i >= self.getSize() -1); }); } // mousewheel support if (conf.mousewheel && $.fn.mousewheel) { root.mousewheel(function(e, delta) { if (conf.mousewheel) { self.move(delta < 0 ? 1 : -1, conf.wheelSpeed || 50); return false; } }); } if (conf.clickable) { root.click(function() { if (conf.clickable) { self.next(); } }); } if (conf.keyboard) { $(document).bind("keydown.scrollable", function(evt) { // skip certain conditions if (!conf.keyboard || evt.altKey || evt.ctrlKey || $(evt.target).is(":input")) { return; } // does this instance have focus? if (conf.keyboard != 'static' && current != self) { return; } var key = evt.keyCode; if (vertical && (key == 38 || key == 40)) { self.move(key == 38 ? -1 : 1); return evt.preventDefault(); } if (!vertical && (key == 37 || key == 39)) { self.move(key == 37 ? -1 : 1); return evt.preventDefault(); } }); } // initial index $(self).trigger("onBeforeSeek", [conf.initialIndex]); self.seekTo(conf.initialIndex, 0, true); } |
if (conf.clickable) { root.click(function() { if (conf.clickable) { self.next(); } }); } | function Scrollable(root, conf) { // current instance var self = this, fire = root.add(self), itemWrap = root.children(), index = 0, forward, vertical = conf.vertical; if (!current) { current = self; } if (itemWrap.length > 1) { itemWrap = $(conf.items, root); } // methods $.extend(self, { getConf: function() { return conf; }, getIndex: function() { return index; }, getSize: function() { return self.getItems().size(); }, getNaviButtons: function() { return prev.add(next); }, getRoot: function() { return root; }, getItemWrap: function() { return itemWrap; }, getItems: function() { return itemWrap.children(conf.item).not("." + conf.clonedClass); }, move: function(offset, time) { return self.seekTo(index + offset, time); }, next: function(time) { return self.move(1, time); }, prev: function(time) { return self.move(-1, time); }, begin: function(time) { return self.seekTo(0, time); }, end: function(time) { return self.seekTo(self.getSize() -1, time); }, focus: function() { current = self; return self; }, addItem: function(item) { item = $(item); if (!conf.circular) { itemWrap.append(item); } else { $(".cloned:last").before(item); $(".cloned:first").replaceWith(item.clone().addClass(conf.clonedClass)); } fire.trigger("onAddItem", [item]); return self; }, /* all seeking functions depend on this */ seekTo: function(i, time, fn) { // check that index is sane if (!conf.circular && i < 0 || i > self.getSize()) { return self; } var item = i; if (i.jquery) { i = self.getItems().index(i); } else { item = self.getItems().eq(i); } // onBeforeSeek var e = $.Event("onBeforeSeek"); if (!fn) { fire.trigger(e, [i, time]); if (e.isDefaultPrevented() || !item.length) { return self; } } var props = vertical ? {top: -item.position().top} : {left: -item.position().left}; itemWrap.animate(props, time, conf.easing, fn || function() { fire.trigger("onSeek", [i]); }); current = self; index = i; return self; } }); // callbacks $.each("onBeforeSeek,onSeek,onAddItem".split(","), function(i, name) { // configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); // circular loop if (conf.circular) { var cloned1 = self.getItems().slice(-1).clone().prependTo(itemWrap), cloned2 = self.getItems().eq(1).clone().appendTo(itemWrap); cloned1.add(cloned2).addClass(conf.clonedClass); self.onBeforeSeek(function(e, i, time) { if (e.isDefaultPrevented()) { return; } /* 1. animate to the clone without event triggering 2. seek to correct position with 0 speed */ if (i == -1) { self.seekTo(cloned1, time, function() { self.end(0); }); return e.preventDefault(); } else if (i == self.getSize()) { self.seekTo(cloned2, time, function() { self.begin(0); }); } }); } // next/prev buttons var prev = root.parent().find(conf.prev).click(function() { self.prev(); }), next = root.parent().find(conf.next).click(function() { self.next(); }); if (!conf.circular && self.getSize() > 2) { self.onBeforeSeek(function(e, i) { prev.toggleClass(conf.disabledClass, i <= 0); next.toggleClass(conf.disabledClass, i >= self.getSize() -1); }); } // mousewheel support if (conf.mousewheel && $.fn.mousewheel) { root.mousewheel(function(e, delta) { if (conf.mousewheel) { self.move(delta < 0 ? 1 : -1, conf.wheelSpeed || 50); return false; } }); } if (conf.clickable) { root.click(function() { if (conf.clickable) { self.next(); } }); } if (conf.keyboard) { $(document).bind("keydown.scrollable", function(evt) { // skip certain conditions if (!conf.keyboard || evt.altKey || evt.ctrlKey || $(evt.target).is(":input")) { return; } // does this instance have focus? if (conf.keyboard != 'static' && current != self) { return; } var key = evt.keyCode; if (vertical && (key == 38 || key == 40)) { self.move(key == 38 ? -1 : 1); return evt.preventDefault(); } if (!vertical && (key == 37 || key == 39)) { self.move(key == 37 ? -1 : 1); return evt.preventDefault(); } }); } // initial index $(self).trigger("onBeforeSeek", [conf.initialIndex]); self.seekTo(conf.initialIndex, 0, true); } |
|
j,b,-2,-1)};this.scrolled=function(a,b,c,d){s=a;t=b;u=c;v=d};var m=null;j.handleDragDrop=function(a,b,c,d,k){if(m){m.className=m.classNameOrig;m=null}if(a!="end"){var g=q(c);if(!g.selected&&g.drop)if(a=="drop")n.emit(j,{name:"dropEvent",eventObject:b,event:c},g.rowIdx,g.columnId,d,k);else{b.className="Wt-valid-drop";m=g.el;m.classNameOrig=m.className;m.className+=" Wt-drop-site"}else b.className=""}};j.onkeydown=function(a){var b=a||window.event;if(b.keyCode==9){i.cancelEvent(b);var c=q(b);if(c.el){a= | f.scrollLeft;if(f.scrollTop<u||f.scrollTop>v||f.scrollLeft<s||f.scrollLeft>t)n.emit(h,"scrolled",f.scrollLeft,f.scrollTop,f.clientWidth,f.clientHeight)};this.mouseDown=function(a,b){i.capture(null);a=q(b);h.getAttribute("drag")==="true"&&a.selected&&n._p_.dragStart(h,b)};this.resizeHandleMDown=function(a,b){var c=a.parentNode.parentNode,d=-(i.pxself(c,"width")-1);new i.SizeHandle(i,"h",a.offsetWidth,h.offsetHeight,d,1E4,"Wt-hsh",function(k){w(c,k)},a,h,b,-2,-1)};this.scrolled=function(a,b,c,d){s= a;t=b;u=c;v=d};var m=null;h.handleDragDrop=function(a,b,c,d,k){if(m){m.className=m.classNameOrig;m=null}if(a!="end"){var g=q(c);if(!g.selected&&g.drop)if(a=="drop")n.emit(h,{name:"dropEvent",eventObject:b,event:c},g.rowIdx,g.columnId,d,k);else{b.className="Wt-valid-drop";m=g.el;m.classNameOrig=m.className;m.className+=" Wt-drop-site"}else b.className=""}};h.onkeydown=function(a){var b=a||window.event;if(b.keyCode==9){i.cancelEvent(b);var c=q(b);if(c.el){a=c.el.parentNode;c=r(c.el);var d=r(a),k=a.parentNode.childNodes.length, | j,b,-2,-1)};this.scrolled=function(a,b,c,d){s=a;t=b;u=c;v=d};var m=null;j.handleDragDrop=function(a,b,c,d,k){if(m){m.className=m.classNameOrig;m=null}if(a!="end"){var g=q(c);if(!g.selected&&g.drop)if(a=="drop")n.emit(j,{name:"dropEvent",eventObject:b,event:c},g.rowIdx,g.columnId,d,k);else{b.className="Wt-valid-drop";m=g.el;m.classNameOrig=m.className;m.className+=" Wt-drop-site"}else b.className=""}};j.onkeydown=function(a){var b=a||window.event;if(b.keyCode==9){i.cancelEvent(b);var c=q(b);if(c.el){a= |
setTimeout(scrolling, 30); | window.setTimeout(scrolling, 30); | function scrolling() { /// Trick IE 8- into understanding pageYOffset. /*@cc_on @if (@_jscript_version < 9) window.pageYOffset = doc_docEl.scrollTop; @end @*/ var new_scroll_pos = window.pageYOffset, scrolling_down; /// Has the scroll position actually not changed? ///NOTE: IE/Opera sometimes don't update scroll position until after this function is run. /// Mozilla/WebKit can have the same problem. if (new_scroll_pos == scroll_pos) { /// Should we wait a moment and see if the scroll position changes. if (++scroll_check_count < 10) { setTimeout(scrolling, 30); } else { /// Reset the counter and do not check anymore. scroll_check_count = 0; } return null; } scroll_check_count = 0; scrolling_down = (new_scroll_pos > scroll_pos); /// This keeps track of the current scroll position so we can tell the direction of the scroll. scroll_pos = new_scroll_pos; /// Find and indicate the range of verses displayed on the screen. update_verse_range(); /// Don't look up more data until the first results come. if (waiting_for_first_search) { return null; } /// Since the page is scrolling, we need to determine if more content needs to be added or if some content should be hidden. if (scrolling_down) { add_content_if_needed(additional); checking_excess_content_top = true; } else { add_content_if_needed(previous); checking_excess_content_bottom = true; } if (checking_excess_content_top) { clearTimeout(remove_content_top_timeout); remove_content_top_timeout = setTimeout(remove_excess_content_top, remove_speed); } if (checking_excess_content_bottom) { clearTimeout(remove_content_bottom_timeout); remove_content_bottom_timeout = setTimeout(remove_excess_content_bottom, remove_speed); } } |
remove_content_top_timeout = setTimeout(remove_excess_content_top, remove_speed); | remove_content_top_timeout = window.setTimeout(remove_excess_content_top, remove_speed); | function scrolling() { /// Trick IE 8- into understanding pageYOffset. /*@cc_on @if (@_jscript_version < 9) window.pageYOffset = doc_docEl.scrollTop; @end @*/ var new_scroll_pos = window.pageYOffset, scrolling_down; /// Has the scroll position actually not changed? ///NOTE: IE/Opera sometimes don't update scroll position until after this function is run. /// Mozilla/WebKit can have the same problem. if (new_scroll_pos == scroll_pos) { /// Should we wait a moment and see if the scroll position changes. if (++scroll_check_count < 10) { setTimeout(scrolling, 30); } else { /// Reset the counter and do not check anymore. scroll_check_count = 0; } return null; } scroll_check_count = 0; scrolling_down = (new_scroll_pos > scroll_pos); /// This keeps track of the current scroll position so we can tell the direction of the scroll. scroll_pos = new_scroll_pos; /// Find and indicate the range of verses displayed on the screen. update_verse_range(); /// Don't look up more data until the first results come. if (waiting_for_first_search) { return null; } /// Since the page is scrolling, we need to determine if more content needs to be added or if some content should be hidden. if (scrolling_down) { add_content_if_needed(additional); checking_excess_content_top = true; } else { add_content_if_needed(previous); checking_excess_content_bottom = true; } if (checking_excess_content_top) { clearTimeout(remove_content_top_timeout); remove_content_top_timeout = setTimeout(remove_excess_content_top, remove_speed); } if (checking_excess_content_bottom) { clearTimeout(remove_content_bottom_timeout); remove_content_bottom_timeout = setTimeout(remove_excess_content_bottom, remove_speed); } } |
remove_content_bottom_timeout = setTimeout(remove_excess_content_bottom, remove_speed); | remove_content_bottom_timeout = window.setTimeout(remove_excess_content_bottom, remove_speed); | function scrolling() { /// Trick IE 8- into understanding pageYOffset. /*@cc_on @if (@_jscript_version < 9) window.pageYOffset = doc_docEl.scrollTop; @end @*/ var new_scroll_pos = window.pageYOffset, scrolling_down; /// Has the scroll position actually not changed? ///NOTE: IE/Opera sometimes don't update scroll position until after this function is run. /// Mozilla/WebKit can have the same problem. if (new_scroll_pos == scroll_pos) { /// Should we wait a moment and see if the scroll position changes. if (++scroll_check_count < 10) { setTimeout(scrolling, 30); } else { /// Reset the counter and do not check anymore. scroll_check_count = 0; } return null; } scroll_check_count = 0; scrolling_down = (new_scroll_pos > scroll_pos); /// This keeps track of the current scroll position so we can tell the direction of the scroll. scroll_pos = new_scroll_pos; /// Find and indicate the range of verses displayed on the screen. update_verse_range(); /// Don't look up more data until the first results come. if (waiting_for_first_search) { return null; } /// Since the page is scrolling, we need to determine if more content needs to be added or if some content should be hidden. if (scrolling_down) { add_content_if_needed(additional); checking_excess_content_top = true; } else { add_content_if_needed(previous); checking_excess_content_bottom = true; } if (checking_excess_content_top) { clearTimeout(remove_content_top_timeout); remove_content_top_timeout = setTimeout(remove_excess_content_top, remove_speed); } if (checking_excess_content_bottom) { clearTimeout(remove_content_bottom_timeout); remove_content_bottom_timeout = setTimeout(remove_excess_content_bottom, remove_speed); } } |
window.pageYOffset = doc_docEl.scrollTop; | @if (@_jscript_version < 9) window.pageYOffset = doc_docEl.scrollTop; @end | function scrolling() { /// Trick IE into understanding pageYOffset. /*@cc_on window.pageYOffset = doc_docEl.scrollTop; @*/ var new_scroll_pos = window.pageYOffset, scrolling_down; /// Has the scroll position actually not changed? ///NOTE: IE/Opera sometimes don't update scroll position until after this function is run. /// Mozilla/WebKit can have the same problem. if (new_scroll_pos == scroll_pos) { /// Should we wait a moment and see if the scroll position changes. if (++scroll_check_count < 10) { setTimeout(scrolling, 30); } else { /// Reset the counter and do not check anymore. scroll_check_count = 0; } return null; } scroll_check_count = 0; scrolling_down = (new_scroll_pos > scroll_pos); /// This keeps track of the current scroll position so we can tell the direction of the scroll. scroll_pos = new_scroll_pos; /// Find and indicate the range of verses displayed on the screen. update_verse_range(); /// Don't look up more data until the first results come. if (waiting_for_first_search) { return null; } /// Since the page is scrolling, we need to determine if more content needs to be added or if some content should be hidden. if (scrolling_down) { add_content_if_needed(additional); checking_excess_content_top = true; } else { add_content_if_needed(previous); checking_excess_content_bottom = true; } if (checking_excess_content_top) { clearTimeout(remove_content_top_timeout); remove_content_top_timeout = setTimeout(remove_excess_content_top, remove_speed); } if (checking_excess_content_bottom) { clearTimeout(remove_content_bottom_timeout); remove_content_bottom_timeout = setTimeout(remove_excess_content_bottom, remove_speed); } } |
0;if(a.wheelDelta)b=a.wheelDelta>0?1:-1;else if(a.detail)b=a.detail<0?1:-1;return b};this.scrollIntoView=function(a){(a=document.getElementById(a))&&a.scrollIntoView&&a.scrollIntoView(true)};this.getSelectionRange=function(a){if(document.selection)if(g.hasTag(a,"TEXTAREA")){var b=document.selection.createRange(),f=b.duplicate();f.moveToElementText(a);var l=0;if(b.text.length>1){l-=b.text.length;if(l<0)l=0}a=-1+l;for(f.moveStart("character",l);f.inRange(b);){f.moveStart("character");a++}b=b.text.replace(/\r/g, | document.body.scrollLeft-document.documentElement.scrollLeft,y:a.y-document.body.scrollTop-document.documentElement.scrollTop}};this.wheelDelta=function(a){var b=0;if(a.wheelDelta)b=a.wheelDelta>0?1:-1;else if(a.detail)b=a.detail<0?1:-1;return b};this.scrollIntoView=function(a){(a=document.getElementById(a))&&a.scrollIntoView&&a.scrollIntoView(true)};this.getSelectionRange=function(a){if(document.selection)if(g.hasTag(a,"TEXTAREA")){var b=document.selection.createRange(),f=b.duplicate();f.moveToElementText(a); | 0;if(a.wheelDelta)b=a.wheelDelta>0?1:-1;else if(a.detail)b=a.detail<0?1:-1;return b};this.scrollIntoView=function(a){(a=document.getElementById(a))&&a.scrollIntoView&&a.scrollIntoView(true)};this.getSelectionRange=function(a){if(document.selection)if(g.hasTag(a,"TEXTAREA")){var b=document.selection.createRange(),f=b.duplicate();f.moveToElementText(a);var l=0;if(b.text.length>1){l-=b.text.length;if(l<0)l=0}a=-1+l;for(f.moveStart("character",l);f.inRange(b);){f.moveStart("character");a++}b=b.text.replace(/\r/g, |
a.wheelDelta>0?1:-1;else if(a.detail)b=a.detail<0?1:-1;return b};this.scrollIntoView=function(a){(a=document.getElementById(a))&&a.scrollIntoView&&a.scrollIntoView(true)};this.getSelectionRange=function(a){if(document.selection)if(g.hasTag(a,"TEXTAREA")){var b=document.selection.createRange(),f=b.duplicate();f.moveToElementText(a);var l=0;if(b.text.length>1){l-=b.text.length;if(l<0)l=0}a=-1+l;for(f.moveStart("character",l);f.inRange(b);){f.moveStart("character");a++}b=b.text.replace(/\r/g,"");return{start:a, | 0;if(a.wheelDelta)b=a.wheelDelta>0?1:-1;else if(a.detail)b=a.detail<0?1:-1;return b};this.scrollIntoView=function(a){(a=document.getElementById(a))&&a.scrollIntoView&&a.scrollIntoView(true)};this.getSelectionRange=function(a){if(document.selection)if(g.hasTag(a,"TEXTAREA")){var b=document.selection.createRange(),f=b.duplicate();f.moveToElementText(a);var l=0;if(b.text.length>1){l-=b.text.length;if(l<0)l=0}a=-1+l;for(f.moveStart("character",l);f.inRange(b);){f.moveStart("character");a++}b=b.text.replace(/\r/g, | a.wheelDelta>0?1:-1;else if(a.detail)b=a.detail<0?1:-1;return b};this.scrollIntoView=function(a){(a=document.getElementById(a))&&a.scrollIntoView&&a.scrollIntoView(true)};this.getSelectionRange=function(a){if(document.selection)if(g.hasTag(a,"TEXTAREA")){var b=document.selection.createRange(),f=b.duplicate();f.moveToElementText(a);var l=0;if(b.text.length>1){l-=b.text.length;if(l<0)l=0}a=-1+l;for(f.moveStart("character",l);f.inRange(b);){f.moveStart("character");a++}b=b.text.replace(/\r/g,"");return{start:a, |
function(a){if(!a)a=window.event;var b=0,f=0;if(a.pageX||a.pageY){b=a.pageX;f=a.pageY}else if(a.clientX||a.clientY){b=a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;f=a.clientY+document.body.scrollTop+document.documentElement.scrollTop}return{x:b,y:f}};this.scrollIntoView=function(a){(a=document.getElementById(a))&&a.scrollIntoView&&a.scrollIntoView(true)};this.getSelectionRange=function(a){if(document.selection)if(g.hasTag(a,"TEXTAREA")){var b=document.selection.createRange(), | function(a){if(!a)a=window.event;var b=0,f=0;if(a.pageX||a.pageY){b=a.pageX;f=a.pageY}else if(a.clientX||a.clientY){b=a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;f=a.clientY+document.body.scrollTop+document.documentElement.scrollTop}return{x:b,y:f}};this.windowCoordinates=function(a){a=g.pageCoordinates(a);return{x:a.x-document.body.scrollLeft-document.documentElement.scrollLeft,y:a.y-document.body.scrollTop-document.documentElement.scrollTop}};this.scrollIntoView=function(a){(a= document.getElementById(a))&&a.scrollIntoView&&a.scrollIntoView(true)};this.getSelectionRange=function(a){if(document.selection)if(g.hasTag(a,"TEXTAREA")){var b=document.selection.createRange(),f=b.duplicate();f.moveToElementText(a);var h=0;if(b.text.length>1){h-=b.text.length;if(h<0)h=0}a=-1+h;for(f.moveStart("character",h);f.inRange(b);){f.moveStart("character");a++}b=b.text.replace(/\r/g,"");return{start:a,end:b.length+a}}else{f=$(a).val();a=document.selection.createRange().duplicate();a.moveEnd("character", | function(a){if(!a)a=window.event;var b=0,f=0;if(a.pageX||a.pageY){b=a.pageX;f=a.pageY}else if(a.clientX||a.clientY){b=a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;f=a.clientY+document.body.scrollTop+document.documentElement.scrollTop}return{x:b,y:f}};this.scrollIntoView=function(a){(a=document.getElementById(a))&&a.scrollIntoView&&a.scrollIntoView(true)};this.getSelectionRange=function(a){if(document.selection)if(g.hasTag(a,"TEXTAREA")){var b=document.selection.createRange(), |
function(a,b){b=k.pageCoordinates(b);a=k.widgetPageCoordinates(a);return{x:b.x-a.x,y:b.y-a.y}};this.pageCoordinates=function(a){if(!a)a=window.event;var b=0,f=0;if(a.pageX||a.pageY){b=a.pageX;f=a.pageY}else if(a.clientX||a.clientY){b=a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;f=a.clientY+document.body.scrollTop+document.documentElement.scrollTop}return{x:b,y:f}};this.scrollIntoView=function(a){(a=document.getElementById(a))&&a.scrollIntoView&&a.scrollIntoView(true)};this.getSelectionRange= | y:f}};this.scrollIntoView=function(a){(a=document.getElementById(a))&&a.scrollIntoView&&a.scrollIntoView(true)};this.getSelectionRange=function(a){if(document.selection){var b=document.selection.createRange(),f=b.duplicate();f.moveToElementText(a);f.setEndPoint("EndToEnd",b);a=f.text.length-b.text.length;return{start:a,end:a+b.text.length}}else return{start:a.selectionStart,end:a.selectionEnd}};this.setSelectionRange=function(a,b,f){if(a.createTextRange){a=a.createTextRange();a.collapse(true);a.moveEnd("character", | function(a,b){b=k.pageCoordinates(b);a=k.widgetPageCoordinates(a);return{x:b.x-a.x,y:b.y-a.y}};this.pageCoordinates=function(a){if(!a)a=window.event;var b=0,f=0;if(a.pageX||a.pageY){b=a.pageX;f=a.pageY}else if(a.clientX||a.clientY){b=a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;f=a.clientY+document.body.scrollTop+document.documentElement.scrollTop}return{x:b,y:f}};this.scrollIntoView=function(a){(a=document.getElementById(a))&&a.scrollIntoView&&a.scrollIntoView(true)};this.getSelectionRange= |
return this;},setOpacity:function(i){if(c){i=Math.round(i*100);this.setStyle('filter',i>=100?'':'progid:DXImageTransform.Microsoft.Alpha(opacity='+i+')');}else this.setStyle('opacity',i);},unselectable:b.gecko?function(){this.$.style.MozUserSelect='none';}:b.webkit?function(){this.$.style.KhtmlUserSelect='none';}:function(){if(c||b.opera){var i=this.$,j,k=0;i.unselectable='on';while(j=i.all[k++])switch(j.tagName.toLowerCase()){case 'iframe':case 'textarea':case 'input':case 'select':break;default:j.unselectable='on';}}},getPositionedAncestor:function(){var i=this;while(i.getName()!='html'){if(i.getComputedStyle('position')!='static')return i;i=i.getParent();}return null;},getDocumentPosition:function(i){var D=this;var j=0,k=0,l=D.getDocument().getBody(),m=D.getDocument().$.compatMode=='BackCompat',n=D.getDocument();if(document.documentElement.getBoundingClientRect){var o=D.$.getBoundingClientRect(),p=n.$,q=p.documentElement,r=q.clientTop||l.$.clientTop||0,s=q.clientLeft||l.$.clientLeft||0,t=true;if(c){var u=n.getDocumentElement().contains(D),v=n.getBody().contains(D);t=m&&v||!m&&u;}if(t){j=o.left+(!m&&q.scrollLeft||l.$.scrollLeft);j-=s;k=o.top+(!m&&q.scrollTop||l.$.scrollTop);k-=r;}}else{var w=D,x=null,y;while(w&&!(w.getName()=='body'||w.getName()=='html')){j+=w.$.offsetLeft-w.$.scrollLeft;k+=w.$.offsetTop-w.$.scrollTop;if(!w.equals(D)){j+=w.$.clientLeft||0;k+=w.$.clientTop||0;}var z=x;while(z&&!z.equals(w)){j-=z.$.scrollLeft;k-=z.$.scrollTop;z=z.getParent();}x=w;w=(y=w.$.offsetParent)?new h(y):null;}}if(i){var A=D.getWindow(),B=i.getWindow();if(!A.equals(B)&&A.$.frameElement){var C=new h(A.$.frameElement).getDocumentPosition(i);j+=C.x;k+=C.y;}}if(!document.documentElement.getBoundingClientRect)if(b.gecko&&!m){j+=D.$.clientLeft?1:0;k+=D.$.clientTop?1:0;}return{x:j,y:k};},scrollIntoView:function(i){var o=this;var j=o.getWindow(),k=j.getViewPaneSize().height,l=k*-1;if(i)l+=k;else{l+=o.$.offsetHeight||0;l+=parseInt(o.getComputedStyle('marginBottom')||0,10)||0;}var m=o.getDocumentPosition();l+=m.y;l=l<0?0:l;var n=j.getScrollPosition().y;if(l>n||l<n-k)j.$.scrollTo(0,l);},setState:function(i){var j=this;switch(i){case 1:j.addClass('cke_on');j.removeClass('cke_off');j.removeClass('cke_disabled');break;case 0:j.addClass('cke_disabled');j.removeClass('cke_off');j.removeClass('cke_on');break;default:j.addClass('cke_off');j.removeClass('cke_on');j.removeClass('cke_disabled');break;}},getFrameDocument:function(){var i=this.$;try{i.contentWindow.document;}catch(j){i.src=i.src; | k-=r;}}else{var w=D,x=null,y;while(w&&!(w.getName()=='body'||w.getName()=='html')){j+=w.$.offsetLeft-w.$.scrollLeft;k+=w.$.offsetTop-w.$.scrollTop;if(!w.equals(D)){j+=w.$.clientLeft||0;k+=w.$.clientTop||0;}var z=x;while(z&&!z.equals(w)){j-=z.$.scrollLeft;k-=z.$.scrollTop;z=z.getParent();}x=w;w=(y=w.$.offsetParent)?new h(y):null;}}if(i){var A=D.getWindow(),B=i.getWindow();if(!A.equals(B)&&A.$.frameElement){var C=new h(A.$.frameElement).getDocumentPosition(i);j+=C.x;k+=C.y;}}if(!document.documentElement.getBoundingClientRect)if(b.gecko&&!m){j+=D.$.clientLeft?1:0;k+=D.$.clientTop?1:0;}return{x:j,y:k};},scrollIntoView:function(i){var o=this;var j=o.getWindow(),k=j.getViewPaneSize().height,l=k*-1;if(i)l+=k;else{l+=o.$.offsetHeight||0;l+=parseInt(o.getComputedStyle('marginBottom')||0,10)||0;}var m=o.getDocumentPosition();l+=m.y;l=l<0?0:l;var n=j.getScrollPosition().y;if(l>n||l<n-k)j.$.scrollTo(0,l);},setState:function(i){var j=this;switch(i){case 1:j.addClass('cke_on');j.removeClass('cke_off');j.removeClass('cke_disabled');break;case 0:j.addClass('cke_disabled');j.removeClass('cke_off');j.removeClass('cke_on');break;default:j.addClass('cke_off');j.removeClass('cke_on');j.removeClass('cke_disabled');break;}},getFrameDocument:function(){var i=this.$;try{i.contentWindow.document;}catch(j){i.src=i.src;if(c&&b.version<7)window.showModalDialog('javascript:document.write("<script>window.setTimeout(function(){window.close();},50);</script>")');}return i&&new g(i.contentWindow.document);},copyAttributes:function(i,j){var p=this;var k=p.$.attributes;j=j||{};for(var l=0;l<k.length;l++){var m=k[l],n=m.nodeName.toLowerCase(),o;if(n in j)continue;if(n=='checked'&&(o=p.getAttribute(n)))i.setAttribute(n,o);else if(m.specified||c&&m.nodeValue&&n=='value'){o=p.getAttribute(n);if(o===null)o=m.nodeValue;i.setAttribute(n,o);}}if(p.$.style.cssText!=='')i.$.style.cssText=p.$.style.cssText;},renameNode:function(i){var l=this;if(l.getName()==i)return;var j=l.getDocument(),k=new h(i,j);l.copyAttributes(k);l.moveChildren(k);l.getParent()&&l.$.parentNode.replaceChild(k.$,l.$);k.$._cke_expando=l.$._cke_expando;l.$=k.$;},getChild:function(i){var j=this.$;if(!i.slice)j=j.childNodes[i];else while(i.length>0&&j)j=j.childNodes[i.shift()];return j?new d.node(j):null;},getChildCount:function(){return this.$.childNodes.length;},disableContextMenu:function(){this.on('contextmenu',function(i){if(!i.data.getTarget().hasClass('cke_enable_context_menu'))i.data.preventDefault();});},setSize:(function(){var i={width:['border-left-width','border-right-width','padding-left','padding-right'],height:['border-top-width','border-bottom-width','padding-top','padding-bottom']}; | return this;},setOpacity:function(i){if(c){i=Math.round(i*100);this.setStyle('filter',i>=100?'':'progid:DXImageTransform.Microsoft.Alpha(opacity='+i+')');}else this.setStyle('opacity',i);},unselectable:b.gecko?function(){this.$.style.MozUserSelect='none';}:b.webkit?function(){this.$.style.KhtmlUserSelect='none';}:function(){if(c||b.opera){var i=this.$,j,k=0;i.unselectable='on';while(j=i.all[k++])switch(j.tagName.toLowerCase()){case 'iframe':case 'textarea':case 'input':case 'select':break;default:j.unselectable='on';}}},getPositionedAncestor:function(){var i=this;while(i.getName()!='html'){if(i.getComputedStyle('position')!='static')return i;i=i.getParent();}return null;},getDocumentPosition:function(i){var D=this;var j=0,k=0,l=D.getDocument().getBody(),m=D.getDocument().$.compatMode=='BackCompat',n=D.getDocument();if(document.documentElement.getBoundingClientRect){var o=D.$.getBoundingClientRect(),p=n.$,q=p.documentElement,r=q.clientTop||l.$.clientTop||0,s=q.clientLeft||l.$.clientLeft||0,t=true;if(c){var u=n.getDocumentElement().contains(D),v=n.getBody().contains(D);t=m&&v||!m&&u;}if(t){j=o.left+(!m&&q.scrollLeft||l.$.scrollLeft);j-=s;k=o.top+(!m&&q.scrollTop||l.$.scrollTop);k-=r;}}else{var w=D,x=null,y;while(w&&!(w.getName()=='body'||w.getName()=='html')){j+=w.$.offsetLeft-w.$.scrollLeft;k+=w.$.offsetTop-w.$.scrollTop;if(!w.equals(D)){j+=w.$.clientLeft||0;k+=w.$.clientTop||0;}var z=x;while(z&&!z.equals(w)){j-=z.$.scrollLeft;k-=z.$.scrollTop;z=z.getParent();}x=w;w=(y=w.$.offsetParent)?new h(y):null;}}if(i){var A=D.getWindow(),B=i.getWindow();if(!A.equals(B)&&A.$.frameElement){var C=new h(A.$.frameElement).getDocumentPosition(i);j+=C.x;k+=C.y;}}if(!document.documentElement.getBoundingClientRect)if(b.gecko&&!m){j+=D.$.clientLeft?1:0;k+=D.$.clientTop?1:0;}return{x:j,y:k};},scrollIntoView:function(i){var o=this;var j=o.getWindow(),k=j.getViewPaneSize().height,l=k*-1;if(i)l+=k;else{l+=o.$.offsetHeight||0;l+=parseInt(o.getComputedStyle('marginBottom')||0,10)||0;}var m=o.getDocumentPosition();l+=m.y;l=l<0?0:l;var n=j.getScrollPosition().y;if(l>n||l<n-k)j.$.scrollTo(0,l);},setState:function(i){var j=this;switch(i){case 1:j.addClass('cke_on');j.removeClass('cke_off');j.removeClass('cke_disabled');break;case 0:j.addClass('cke_disabled');j.removeClass('cke_off');j.removeClass('cke_on');break;default:j.addClass('cke_off');j.removeClass('cke_on');j.removeClass('cke_disabled');break;}},getFrameDocument:function(){var i=this.$;try{i.contentWindow.document;}catch(j){i.src=i.src; |
padding_interval = setInterval(function () | padding_interval = window.setInterval(function () | function scrollViewTo(x, y, smooth) { /// A small amount of extra padding is added just to ensure that the padding element will be large enough. var extra_padding = 10, padding_el, padding_interval, pixels_needed; if (!smooth) { scroll_pos = y; /// Is the scroll position not the top of the page. if (scroll_pos > 0) { /// Calculate how many pixels (if any) need to be added in order to be able to scroll to the specified position. /// If the scroll position is near the bottom (e.g., Revelation 22:21 or Proverbs 28:28) there needs to be extra space on the bottom. pixels_needed = doc_docEl.clientHeight - (document.body.clientHeight - scroll_pos); if (pixels_needed > 0) { padding_el = document.createElement("div"); padding_el.style.height = (pixels_needed + extra_padding) + 'px'; viewPort.insertBefore(padding_el, null); padding_interval = setInterval(function () { if (doc_docEl.scrollHeight - (window.pageYOffset + doc_docEl.clientHeight) > pixels_needed + extra_padding) { viewPort.removeChild(padding_el); clearInterval(padding_interval); } }, 1000); } } window.scrollTo(x, y); } else { ///TODO: Do smooth scrolling. } } |
clearInterval(padding_interval); | window.clearInterval(padding_interval); | function scrollViewTo(x, y, smooth) { /// A small amount of extra padding is added just to ensure that the padding element will be large enough. var extra_padding = 10, padding_el, padding_interval, pixels_needed; if (!smooth) { scroll_pos = y; /// Is the scroll position not the top of the page. if (scroll_pos > 0) { /// Calculate how many pixels (if any) need to be added in order to be able to scroll to the specified position. /// If the scroll position is near the bottom (e.g., Revelation 22:21 or Proverbs 28:28) there needs to be extra space on the bottom. pixels_needed = doc_docEl.clientHeight - (document.body.clientHeight - scroll_pos); if (pixels_needed > 0) { padding_el = document.createElement("div"); padding_el.style.height = (pixels_needed + extra_padding) + 'px'; viewPort.insertBefore(padding_el, null); padding_interval = setInterval(function () { if (doc_docEl.scrollHeight - (window.pageYOffset + doc_docEl.clientHeight) > pixels_needed + extra_padding) { viewPort.removeChild(padding_el); clearInterval(padding_interval); } }, 1000); } } window.scrollTo(x, y); } else { ///TODO: Do smooth scrolling. } } |
if (item && item.url.indexOf("%s") > -1) | if (item && item.url.indexOf("%s") > -1) { | completion.search = function search(context, noSuggest) { let [, keyword, space, args] = context.filter.match(/^\s*(\S*)(\s*)(.*)$/); let keywords = bookmarks.getKeywords(); let engines = bookmarks.getSearchEngines(); context.title = ["Search Keywords"]; context.completions = keywords.concat(engines); context.keys = { text: 0, description: 1, icon: 2 }; if (!space || noSuggest) return; context.fork("suggest", keyword.length + space.length, this, "searchEngineSuggest", keyword, true); let item = keywords.filter(function (k) k.keyword == keyword)[0]; if (item && item.url.indexOf("%s") > -1) context.fork("keyword/" + keyword, keyword.length + space.length, null, function (context) { context.format = history.format; context.title = [keyword + " Quick Search"]; // context.background = true; context.compare = CompletionContext.Sort.unsorted; context.generate = function () { let [begin, end] = item.url.split("%s"); return history.get({ uri: window.makeURI(begin), uriIsPrefix: true }).map(function (item) { let rest = item.url.length - end.length; let query = item.url.substring(begin.length, rest); if (item.url.substr(rest) == end && query.indexOf("&") == -1) { query = query.replace(/#.*/, ""); // Countermeasure for "Error: malformed URI sequence". try { item.url = decodeURIComponent(query); } catch (e) { item.url = query; } return item; } return null; }).filter(util.identity); }; }); }; |
} | completion.search = function search(context, noSuggest) { let [, keyword, space, args] = context.filter.match(/^\s*(\S*)(\s*)(.*)$/); let keywords = bookmarks.getKeywords(); let engines = bookmarks.getSearchEngines(); context.title = ["Search Keywords"]; context.completions = keywords.concat(engines); context.keys = { text: 0, description: 1, icon: 2 }; if (!space || noSuggest) return; context.fork("suggest", keyword.length + space.length, this, "searchEngineSuggest", keyword, true); let item = keywords.filter(function (k) k.keyword == keyword)[0]; if (item && item.url.indexOf("%s") > -1) context.fork("keyword/" + keyword, keyword.length + space.length, null, function (context) { context.format = history.format; context.title = [keyword + " Quick Search"]; // context.background = true; context.compare = CompletionContext.Sort.unsorted; context.generate = function () { let [begin, end] = item.url.split("%s"); return history.get({ uri: window.makeURI(begin), uriIsPrefix: true }).map(function (item) { let rest = item.url.length - end.length; let query = item.url.substring(begin.length, rest); if (item.url.substr(rest) == end && query.indexOf("&") == -1) { query = query.replace(/#.*/, ""); // Countermeasure for "Error: malformed URI sequence". try { item.url = decodeURIComponent(query); } catch (e) { item.url = query; } return item; } return null; }).filter(util.identity); }; }); }; |
|
text : this.searchTypes[0].text, value : this.searchTypes[0].value, | text : this.searchTypes[defaultSearchTypeIndex].text, value : this.searchTypes[defaultSearchTypeIndex].value, | Sonatype.repoServer.SearchPanel = function(config) { var config = config || {}; var defaultConfig = {}; Ext.apply(this, config, defaultConfig); this.grid = new Sonatype.repoServer.SearchResultGrid( { searchPanel : this }); this.searchTypes = []; // fire event for plugins to add their own search items Sonatype.Events.fireEvent('searchTypeInit', this.searchTypes, this); // no items, no page if (this.searchTypes.length < 1) { return; } this.searchTypeButton = new Ext.Button( { text : this.searchTypes[0].text, value : this.searchTypes[0].value, tooltip : 'Click for more search options', handler : this.switchSearchType, scope : this, menu : { items : this.searchTypes } }); this.searchToolbar = new Ext.Toolbar( { ctCls : 'search-all-tbar', items : [ this.searchTypeButton, this.convertToFieldObject(this.searchTypes[0].panelItems[0]) ] }); this.artifactContainer = new Sonatype.repoServer.ArtifactContainer( {}); Sonatype.repoServer.SearchPanel.superclass.constructor.call(this, { layout : 'border', hideMode : 'offsets', tbar : this.searchToolbar, items : [ this.grid, this.artifactContainer ] }); this.grid.getSelectionModel().on('rowselect', this.displayArtifactInformation, this); this.grid.clearButton.on('click', this.clearArtifactInformation, this);}; |
items : [ this.searchTypeButton, this.convertToFieldObject(this.searchTypes[0].panelItems[0]) ] | items : [ this.searchTypeButton, this.convertToFieldObject(this.searchTypes[defaultSearchTypeIndex].panelItems[0]) ] | Sonatype.repoServer.SearchPanel = function(config) { var config = config || {}; var defaultConfig = {}; Ext.apply(this, config, defaultConfig); this.grid = new Sonatype.repoServer.SearchResultGrid( { searchPanel : this }); this.searchTypes = []; // fire event for plugins to add their own search items Sonatype.Events.fireEvent('searchTypeInit', this.searchTypes, this); // no items, no page if (this.searchTypes.length < 1) { return; } this.searchTypeButton = new Ext.Button( { text : this.searchTypes[0].text, value : this.searchTypes[0].value, tooltip : 'Click for more search options', handler : this.switchSearchType, scope : this, menu : { items : this.searchTypes } }); this.searchToolbar = new Ext.Toolbar( { ctCls : 'search-all-tbar', items : [ this.searchTypeButton, this.convertToFieldObject(this.searchTypes[0].panelItems[0]) ] }); this.artifactContainer = new Sonatype.repoServer.ArtifactContainer( {}); Sonatype.repoServer.SearchPanel.superclass.constructor.call(this, { layout : 'border', hideMode : 'offsets', tbar : this.searchToolbar, items : [ this.grid, this.artifactContainer ] }); this.grid.getSelectionModel().on('rowselect', this.displayArtifactInformation, this); this.grid.clearButton.on('click', this.clearArtifactInformation, this);}; |
fn : function(panel) { panel.body.on({ 'mousedown' : function(e, t) { var i = t.getAttribute('index'); this.toggleExtraInfo(parseInt(i, 10)); e.stopEvent(); return false; }, 'click' : function(e, t) { e.stopEvent(); return false; }, delegate : 'a.pom-link', scope : panel }); | fn : function(grid) { grid.body.on({ 'mousedown' : function(e, t) { var i = t.getAttribute('index'); this.toggleExtraInfo(parseInt(i, 10)); e.stopEvent(); return false; }, 'click' : function(e, t) { e.stopEvent(); return false; }, delegate : 'a.pom-link', scope : grid }); var store = grid.getStore (); var view = grid.getView (); grid.tip = new Ext.ToolTip ({ target: view.mainBody, delegate: '.x-grid3-row', maxWidth: 500, trackMouse: true, renderTo: document.body, listeners: { beforeshow: function (tip) { var rowIndex = view.findRowIndex (tip.triggerElement); var record = store.getAt( rowIndex ); var highlightedFragment = record.get('highlightedFragment'); tip.body.dom.innerHTML = highlightedFragment; } } }); | Sonatype.repoServer.SearchResultGrid = function(config) { Ext.apply(this, config); this.sp = Sonatype.lib.Permissions; this.totalRecords = 0; this.defaultStore = new Sonatype.SearchStore({ grid: this }); this.store = this.defaultStore; this.colModel = new Ext.grid.ColumnModel({ columns: [ { id: 'source', header: "Source Index", dataIndex: 'contextId', sortable:true }, { id: 'group', header: "Group", dataIndex: 'groupId', sortable:true }, { id: 'artifact', header: "Artifact", dataIndex: 'artifactId', sortable:true }, { id: 'version', header: "Version", dataIndex: 'version', sortable:true, renderer: this.formatVersionLink }, { id: 'packaging', header: "Packaging", dataIndex: 'packaging', sortable:true }, { id: 'classifier', header: "Classifier", dataIndex: 'classifier', sortable:true } ] }); this.clearButton = new Ext.Button({ text: 'Clear Results', icon: Sonatype.config.resourcePath + '/images/icons/clear.gif', cls: 'x-btn-text-icon', handler: this.clearResults, disabled: true, scope: this }); this.fetchMoreBar = new Ext.Toolbar({ ctCls: 'search-all-tbar', items: [ 'Displaying 0 records', { xtype: 'tbspacer' }, this.clearButton ] }); Sonatype.repoServer.SearchResultGrid.superclass.constructor.call(this, { region: 'center', id: 'search-result-grid', loadMask: {msg:'Loading Results...'}, stripeRows: true, sm: new Ext.grid.RowSelectionModel({ singleSelect: true }), bbar: this.fetchMoreBar, viewConfig: { forceFit:true, enableRowBody:true, getRowClass : this.applyRowClass }, listeners : { render : { fn : function(panel) { panel.body.on({ 'mousedown' : function(e, t) { var i = t.getAttribute('index'); this.toggleExtraInfo(parseInt(i, 10)); e.stopEvent(); return false; }, 'click' : function(e, t) { e.stopEvent(); return false; }, delegate : 'a.pom-link', scope : panel }); }, scope : this }, mouseover : { fn : this.mouseOverHandler, scope : this } } });}; |
scope : this }, mouseover : { fn : this.mouseOverHandler, | Sonatype.repoServer.SearchResultGrid = function(config) { Ext.apply(this, config); this.sp = Sonatype.lib.Permissions; this.totalRecords = 0; this.defaultStore = new Sonatype.SearchStore({ grid: this }); this.store = this.defaultStore; this.colModel = new Ext.grid.ColumnModel({ columns: [ { id: 'source', header: "Source Index", dataIndex: 'contextId', sortable:true }, { id: 'group', header: "Group", dataIndex: 'groupId', sortable:true }, { id: 'artifact', header: "Artifact", dataIndex: 'artifactId', sortable:true }, { id: 'version', header: "Version", dataIndex: 'version', sortable:true, renderer: this.formatVersionLink }, { id: 'packaging', header: "Packaging", dataIndex: 'packaging', sortable:true }, { id: 'classifier', header: "Classifier", dataIndex: 'classifier', sortable:true } ] }); this.clearButton = new Ext.Button({ text: 'Clear Results', icon: Sonatype.config.resourcePath + '/images/icons/clear.gif', cls: 'x-btn-text-icon', handler: this.clearResults, disabled: true, scope: this }); this.fetchMoreBar = new Ext.Toolbar({ ctCls: 'search-all-tbar', items: [ 'Displaying 0 records', { xtype: 'tbspacer' }, this.clearButton ] }); Sonatype.repoServer.SearchResultGrid.superclass.constructor.call(this, { region: 'center', id: 'search-result-grid', loadMask: {msg:'Loading Results...'}, stripeRows: true, sm: new Ext.grid.RowSelectionModel({ singleSelect: true }), bbar: this.fetchMoreBar, viewConfig: { forceFit:true, enableRowBody:true, getRowClass : this.applyRowClass }, listeners : { render : { fn : function(panel) { panel.body.on({ 'mousedown' : function(e, t) { var i = t.getAttribute('index'); this.toggleExtraInfo(parseInt(i, 10)); e.stopEvent(); return false; }, 'click' : function(e, t) { e.stopEvent(); return false; }, delegate : 'a.pom-link', scope : panel }); }, scope : this }, mouseover : { fn : this.mouseOverHandler, scope : this } } });}; |
|
searchUrl: Sonatype.config.repos.urls.index | searchUrl: Sonatype.config.servicePath + '/data_index' | Sonatype.SearchStore = function(config) { var config = config || {}; var defaultConfig = { searchUrl: Sonatype.config.repos.urls.index }; Ext.apply(this, config, defaultConfig); Sonatype.SearchStore.superclass.constructor.call(this, { sortInfo: { field: 'groupId', direction: 'ASC' }, proxy: new Ext.data.HttpProxy({ url: this.searchUrl, method: 'GET' }), reader: new Ext.data.JsonReader( { root: 'data', totalProperty: 'totalCount' }, Ext.data.Record.create([ {name:'groupId'}, {name:'artifactId'}, {name:'version'}, {name:'repoId'}, {name:'resourceURI'}, {name:'contextId'}, {name:'classifier'}, {name:'packaging'}, {name:'extension'}, {name:'pomLink'}, {name:'artifactLink'} ]) ), listeners: { 'beforeload': { fn: function( store, options ) { store.proxy.getConnection().on( 'requestcomplete', function( conn, response, options ) { if ( response.responseText ) { var statusResp = Ext.decode(response.responseText); if ( statusResp ) { this.grid.totalRecords = statusResp.totalCount; if ( statusResp.tooManyResults ) { this.grid.setWarningLabel( 'Too many results, please refine the search condition.' ); } else { this.grid.clearWarningLabel(); } } } }, this, { single: true } ); return true; }, scope: this }, 'load': { fn: function( store, records, options ) { this.grid.updateRowTotals( this.grid ); }, scope: this } } });}; |
name : 'hits' | name : 'artifactHits' | Sonatype.SearchStore = function(config) { var config = config || {}; var defaultConfig = { searchUrl : Sonatype.config.servicePath + '/lucene/search' }; Ext.apply(this, config, defaultConfig); Sonatype.SearchStore.superclass.constructor.call(this, { proxy : new Ext.data.HttpProxy({ url : this.searchUrl, method : 'GET' }), reader : new Ext.data.JsonReader({ root : 'data', totalProperty : 'totalCount' }, Ext.data.Record.create([{ name : 'groupId' }, { name : 'artifactId' }, { name : 'version' }, { name : 'highlightedFragment' }, { name : 'hits' }])), listeners : { 'beforeload' : { fn : function(store, options) { store.proxy.getConnection().on('requestcomplete', function(conn, response, options) { if (response.responseText) { var statusResp = Ext.decode(response.responseText); if (statusResp) { this.grid.totalRecords = statusResp.totalCount; if (statusResp.tooManyResults) { this.grid.setWarningLabel('Too many results, please refine the search condition.'); } else { this.grid.clearWarningLabel(); } } } }, this, { single : true }); return true; }, scope : this }, 'load' : { fn : function(store, records, options) { this.grid.updateRowTotals(this.grid); }, scope : this } } });}; |
var v = round(x / len * range + conf.min, conf.decimals); | var isClick = e && e.originalEvent && e.originalEvent.type == "click", v = round(x / len * range + conf.min, conf.decimals); | function seek(x, e) { // fit inside the slider x = Math.min(Math.max(0, x), len); // increment in steps if (conf.step) { x = toSteps(x, conf.step, len); } // calculate value var v = round(x / len * range + conf.min, conf.decimals); // onSlide e = e || $.Event(); e.type = "onSlide"; fire.trigger(e, [v]); if (e.isDefaultPrevented()) { return self; } if (v != value) { // move handle & resize progress var isClick = e && e.originalEvent && e.originalEvent.type == "click", speed = isClick ? conf.speed : 0, callback = isClick ? function() { e.type = "change"; fire.trigger(e, [v]); } : null; if (conf.vertical) { handle.animate({top: -(x - len)}, speed, callback); progress.animate({height: x}, speed); } else { handle.animate({left: x}, speed, callback); progress.animate({width: x}, speed); } value = v; pos = x; input.val(v); } return self; } |
e = e || $.Event(); e.type = "onSlide"; fire.trigger(e, [v]); if (e.isDefaultPrevented()) { return self; } | if (value !== undefined && !isClick) { e = e || $.Event(); e.type = "onSlide"; fire.trigger(e, [v]); if (e.isDefaultPrevented()) { return self; } } | function seek(x, e) { // fit inside the slider x = Math.min(Math.max(0, x), len); // increment in steps if (conf.step) { x = toSteps(x, conf.step, len); } // calculate value var v = round(x / len * range + conf.min, conf.decimals); // onSlide e = e || $.Event(); e.type = "onSlide"; fire.trigger(e, [v]); if (e.isDefaultPrevented()) { return self; } if (v != value) { // move handle & resize progress var isClick = e && e.originalEvent && e.originalEvent.type == "click", speed = isClick ? conf.speed : 0, callback = isClick ? function() { e.type = "change"; fire.trigger(e, [v]); } : null; if (conf.vertical) { handle.animate({top: -(x - len)}, speed, callback); progress.animate({height: x}, speed); } else { handle.animate({left: x}, speed, callback); progress.animate({width: x}, speed); } value = v; pos = x; input.val(v); } return self; } |
var isClick = e && e.originalEvent && e.originalEvent.type == "click", speed = isClick ? conf.speed : 0, callback = isClick ? function() { | var speed = isClick ? conf.speed : 0, fn = isClick ? function() { | function seek(x, e) { // fit inside the slider x = Math.min(Math.max(0, x), len); // increment in steps if (conf.step) { x = toSteps(x, conf.step, len); } // calculate value var v = round(x / len * range + conf.min, conf.decimals); // onSlide e = e || $.Event(); e.type = "onSlide"; fire.trigger(e, [v]); if (e.isDefaultPrevented()) { return self; } if (v != value) { // move handle & resize progress var isClick = e && e.originalEvent && e.originalEvent.type == "click", speed = isClick ? conf.speed : 0, callback = isClick ? function() { e.type = "change"; fire.trigger(e, [v]); } : null; if (conf.vertical) { handle.animate({top: -(x - len)}, speed, callback); progress.animate({height: x}, speed); } else { handle.animate({left: x}, speed, callback); progress.animate({width: x}, speed); } value = v; pos = x; input.val(v); } return self; } |
handle.animate({top: -(x - len)}, speed, callback); | handle.animate({top: -(x - len)}, speed, fn); | function seek(x, e) { // fit inside the slider x = Math.min(Math.max(0, x), len); // increment in steps if (conf.step) { x = toSteps(x, conf.step, len); } // calculate value var v = round(x / len * range + conf.min, conf.decimals); // onSlide e = e || $.Event(); e.type = "onSlide"; fire.trigger(e, [v]); if (e.isDefaultPrevented()) { return self; } if (v != value) { // move handle & resize progress var isClick = e && e.originalEvent && e.originalEvent.type == "click", speed = isClick ? conf.speed : 0, callback = isClick ? function() { e.type = "change"; fire.trigger(e, [v]); } : null; if (conf.vertical) { handle.animate({top: -(x - len)}, speed, callback); progress.animate({height: x}, speed); } else { handle.animate({left: x}, speed, callback); progress.animate({width: x}, speed); } value = v; pos = x; input.val(v); } return self; } |
handle.animate({left: x}, speed, callback); | handle.animate({left: x}, speed, fn); | function seek(x, e) { // fit inside the slider x = Math.min(Math.max(0, x), len); // increment in steps if (conf.step) { x = toSteps(x, conf.step, len); } // calculate value var v = round(x / len * range + conf.min, conf.decimals); // onSlide e = e || $.Event(); e.type = "onSlide"; fire.trigger(e, [v]); if (e.isDefaultPrevented()) { return self; } if (v != value) { // move handle & resize progress var isClick = e && e.originalEvent && e.originalEvent.type == "click", speed = isClick ? conf.speed : 0, callback = isClick ? function() { e.type = "change"; fire.trigger(e, [v]); } : null; if (conf.vertical) { handle.animate({top: -(x - len)}, speed, callback); progress.animate({height: x}, speed); } else { handle.animate({left: x}, speed, callback); progress.animate({width: x}, speed); } value = v; pos = x; input.val(v); } return self; } |
seekTo: function(i, time, fn) { | seekTo: function(i, time, fn) { if (conf.circular && i === 0 && index == -1 && time !== 0) { return self; } | seekTo: function(i, time, fn) { // check that index is sane if (!conf.circular && i < 0 || i > self.getSize()) { return self; } var item = i; if (i.jquery) { i = self.getItems().index(i); } else { item = self.getItems().eq(i); } // onBeforeSeek var e = $.Event("onBeforeSeek"); if (!fn) { fire.trigger(e, [i, time]); if (e.isDefaultPrevented() || !item.length) { return self; } } var props = vertical ? {top: -item.position().top} : {left: -item.position().left}; index = i; current = self; time = time || conf.speed; itemWrap.animate(props, time, conf.easing, fn || function() { fire.trigger("onSeek", [i]); }); return self; } |
if (!conf.circular && i < 0 || i > self.getSize()) { return self; } | if (!conf.circular && i < 0 || i > self.getSize() || i < -1) { return self; } | seekTo: function(i, time, fn) { // check that index is sane if (!conf.circular && i < 0 || i > self.getSize()) { return self; } var item = i; if (i.jquery) { i = self.getItems().index(i); } else { item = self.getItems().eq(i); } // onBeforeSeek var e = $.Event("onBeforeSeek"); if (!fn) { fire.trigger(e, [i, time]); if (e.isDefaultPrevented() || !item.length) { return self; } } var props = vertical ? {top: -item.position().top} : {left: -item.position().left}; index = i; current = self; time = time || conf.speed; itemWrap.animate(props, time, conf.easing, fn || function() { fire.trigger("onSeek", [i]); }); return self; } |
time = time || conf.speed; | if (time === undefined) { time = conf.speed; } | seekTo: function(i, time, fn) { // check that index is sane if (!conf.circular && i < 0 || i > self.getSize()) { return self; } var item = i; if (i.jquery) { i = self.getItems().index(i); } else { item = self.getItems().eq(i); } // onBeforeSeek var e = $.Event("onBeforeSeek"); if (!fn) { fire.trigger(e, [i, time]); if (e.isDefaultPrevented() || !item.length) { return self; } } var props = vertical ? {top: -item.position().top} : {left: -item.position().left}; index = i; current = self; time = time || conf.speed; itemWrap.animate(props, time, conf.easing, fn || function() { fire.trigger("onSeek", [i]); }); return self; } |
}); current = self; index = i; | }); | seekTo: function(i, time, fn) { // check that index is sane if (!conf.circular && i < 0 || i > self.getSize()) { return self; } var item = i; if (i.jquery) { i = self.getItems().index(i); } else { item = self.getItems().eq(i); } // onBeforeSeek var e = $.Event("onBeforeSeek"); if (!fn) { fire.trigger(e, [i, time]); if (e.isDefaultPrevented() || !item.length) { return self; } } var props = vertical ? {top: -item.position().top} : {left: -item.position().left}; itemWrap.animate(props, time, conf.easing, fn || function() { fire.trigger("onSeek", [i]); }); current = self; index = i; return self; } |
input[0].valueAsDate = date; | function select(date, conf, e) { // current value value = date; currYear = date.getFullYear(); currMonth = date.getMonth(); currDay = date.getDate(); // change e = e || $.Event("api"); e.type = "change"; fire.trigger(e, [date]); if (e.isDefaultPrevented()) { return; } // formatting input.val(format(date, conf.format, conf.lang)); // store value into input input.data("date", date); // HTML5 DOM property input[0].valueAsDate = date; self.hide(e); } |
|
selection['start'] = pos; if (pos != undefined) | selection.start = pos; if (pos !== undefined) | function selectNote(div){ var pos = div.getAttribute("charPos"); selection['start'] = pos; if (pos != undefined) { editArea.setSelection(parseInt(pos), parseInt(pos)+1); } abc_keystroke();} |
data = {result: 'signal=poll' }; | data = {result: '&signal=poll' }; | function sendUpdate() { updateTimeout = null; var feedback; if (WT.isIEMobile) feedback = false; if (quited) { if (norestart) return; if (confirm("The application was quited, do you want to restart?")) { document.location = document.location; norestart = true; return; } else { norestart = true; return; } } var data, tm, poll, query = '&rand=' + Math.round(Math.random(randomSeed) * 100000); if (pendingEvents.length > 0) { data = encodePendingEvents(); tm = data.feedback ? setTimeout(waitFeedback, _$_INDICATOR_TIMEOUT_$_) : null; poll = false; } else { data = {result: 'signal=poll' }; tm = null; poll = true; } responsePending = self._p_.comm.sendUpdate (url + query, 'request=jsupdate&' + data.result + '&ackId=' + ackUpdateId, tm, ackUpdateId, -1); pollTimer = poll ? setTimeout(doPollTimeout, _$_SERVER_PUSH_TIMEOUT_$_) : null;} |
(url + query, 'request=jsupdate&' + data.result + '&ackId=' + ackUpdateId, | (url + query, 'request=jsupdate' + data.result + '&ackId=' + ackUpdateId, | function sendUpdate() { updateTimeout = null; var feedback; if (WT.isIEMobile) feedback = false; if (quited) { if (norestart) return; if (confirm("The application was quited, do you want to restart?")) { document.location = document.location; norestart = true; return; } else { norestart = true; return; } } var data, tm, poll, query = '&rand=' + Math.round(Math.random(randomSeed) * 100000); if (pendingEvents.length > 0) { data = encodePendingEvents(); tm = data.feedback ? setTimeout(waitFeedback, _$_INDICATOR_TIMEOUT_$_) : null; poll = false; } else { data = {result: 'signal=poll' }; tm = null; poll = true; } responsePending = self._p_.comm.sendUpdate (url + query, 'request=jsupdate&' + data.result + '&ackId=' + ackUpdateId, tm, ackUpdateId, -1); pollTimer = poll ? setTimeout(doPollTimeout, _$_SERVER_PUSH_TIMEOUT_$_) : null;} |
this.fastRetries = 0; | function session(){ this.transport = null; this.reconnectionAttemptFrequency = 10000; this.port = 12536; this.address = "127.0.0.1"; this.connectionTimeout = 10000; // short timeout for connections this.activityTimeout = 3600000; // long timeout for activity this.connectLock = false; // protect the connect function so only one event // thread (e.g. timer) can execute it at the same time //this.pendingConnection = false;} |
|
this.connectionTimeout = 1000; | this.connectionTimeout = 10000; | function session(){ this.transport = null; this.reconnectionAttemptFrequency = 10000; this.port = 12536; this.address = "127.0.0.1"; this.connectionTimeout = 1000; // short timeout for connections this.activityTimeout = 3600000; // long timeout for activity} |
this.connectLock = false; | function session(){ this.transport = null; this.reconnectionAttemptFrequency = 10000; this.port = 12536; this.address = "127.0.0.1"; this.connectionTimeout = 1000; // short timeout for connections this.activityTimeout = 3600000; // long timeout for activity} |
|
this.port = 12537; | this.port = 12536; | function session(){ this.transport = null; this.reconnectionAttemptFrequency = 10000; this.port = 12537; this.address = "127.0.0.1"; this.connectionTimeout = 10000; // short timeout for connections this.activityTimeout = 3600000; // long timeout for activity this.connectLock = false; // protect the connect function so only one event // thread (e.g. timer) can execute it at the same time this.fastRetries = 0; //this.pendingConnection = false;} |
if (onchange && typeof onchange != "function") { | if (onchange && typeof onchange == "function") { | }, set: function (new_val) { /// Temporarily store the original value to be sent to the onchange function. var old_val = cur_val; cur_val = new_val; /// Optionally run a function when the value is changed. if (onchange && typeof onchange != "function") { window.setTimeout(function () { onchange({old_val: old_val, new_val: new_val}); }, 0); } }}; |
set : function(str) | this.set = function(str) | set : function(str) { //editAreaLoader.setValue(id, str); $(this._id).value =str; }, |
}, | }; | set : function(str) { //editAreaLoader.setValue(id, str); $(this._id).value =str; }, |
try{ if (win === this.focusedWindow) return; | if (win === document.commandDispatcher.focusedWindow) return; | set focusedWindow(win) { try{ if (win === this.focusedWindow) return; // XXX: if win has frame, win.focus() cannot focus. if (win.frames.length) { let html = win.document.documentElement; let selection = win.getSelection(); let ranges = let(it = (function () {for (let i in util.range(0, selection.rangeCount)) yield selection.getRangeAt(i);})()) [r for(r in it)]; html.focus(); html.blur(); selection.removeAllRanges(); for (let [,r] in Iterator(ranges)) selection.addRange(r); } else win.focus(); }catch(ex){liberator.echoerr(ex);} }, |
if (win.frames.length) { | if (win.frames.length && win !== this.focusedWindow) { | set focusedWindow(win) { try{ if (win === this.focusedWindow) return; // XXX: if win has frame, win.focus() cannot focus. if (win.frames.length) { let html = win.document.documentElement; let selection = win.getSelection(); let ranges = let(it = (function () {for (let i in util.range(0, selection.rangeCount)) yield selection.getRangeAt(i);})()) [r for(r in it)]; html.focus(); html.blur(); selection.removeAllRanges(); for (let [,r] in Iterator(ranges)) selection.addRange(r); } else win.focus(); }catch(ex){liberator.echoerr(ex);} }, |
}catch(ex){liberator.echoerr(ex);} | set focusedWindow(win) { try{ if (win === this.focusedWindow) return; // XXX: if win has frame, win.focus() cannot focus. if (win.frames.length) { let html = win.document.documentElement; let selection = win.getSelection(); let ranges = let(it = (function () {for (let i in util.range(0, selection.rangeCount)) yield selection.getRangeAt(i);})()) [r for(r in it)]; html.focus(); html.blur(); selection.removeAllRanges(); for (let [,r] in Iterator(ranges)) selection.addRange(r); } else win.focus(); }catch(ex){liberator.echoerr(ex);} }, |
|
if (loginButton === undefined || loginButton == null) return; | setAllLogins: function() { KFLog.debug("setAllLogins start"); var loginButton = this._currentWindow.document.getElementById("KeeFox_Logins-Button"); if (keeFoxInst._keeFoxStorage.get("KeePassDatabaseOpen", false)) { // start with the current root group uniqueID try { var rootGroup = this._currentWindow.keeFoxILM.getRootGroup(); if (rootGroup != null && rootGroup != undefined && rootGroup.uniqueID) this.setOneLoginsMenu("KeeFox_Logins-Button-root", rootGroup.uniqueID); } catch (e) { KFLog.error("setAllLogins exception: " + e); return; } loginButton.setAttribute("disabled","false"); } else { loginButton.setAttribute("disabled","true"); //loginButton.setAttribute("disabled","false"); var container = this._currentWindow.document.getElementById("KeeFox_Logins-Button-root"); // Remove all of the existing buttons for (i = container.childNodes.length; i > 0; i--) { container.removeChild(container.childNodes[0]); } } KFLog.debug("setAllLogins end"); return; }, |
|
if (newDir == "-") | if (newDir == "-") { | setCurrentDirectory: function (newDir) { newDir = newDir || "~"; if (newDir == "-") [this._cwd, this._oldcwd] = [this._oldcwd, this.getCurrentDirectory()]; else { let dir = File(newDir); if (!dir.exists() || !dir.isDirectory()) { liberator.echoerr("E344: Can't find directory \"" + dir.path + "\" in path"); return null; } [this._cwd, this._oldcwd] = [dir, this.getCurrentDirectory()]; } return self.getCurrentDirectory(); }, |
else { | } else { | setCurrentDirectory: function (newDir) { newDir = newDir || "~"; if (newDir == "-") [this._cwd, this._oldcwd] = [this._oldcwd, this.getCurrentDirectory()]; else { let dir = File(newDir); if (!dir.exists() || !dir.isDirectory()) { liberator.echoerr("E344: Can't find directory \"" + dir.path + "\" in path"); return null; } [this._cwd, this._oldcwd] = [dir, this.getCurrentDirectory()]; } return self.getCurrentDirectory(); }, |
return self.getCurrentDirectory(); | return this.getCurrentDirectory(); | setCurrentDirectory: function (newDir) { newDir = newDir || "~"; if (newDir == "-") [this._cwd, this._oldcwd] = [this._oldcwd, this.getCurrentDirectory()]; else { let dir = File(newDir); if (!dir.exists() || !dir.isDirectory()) { liberator.echoerr("E344: Can't find directory \"" + dir.path + "\" in path"); return null; } [this._cwd, this._oldcwd] = [dir, this.getCurrentDirectory()]; } return self.getCurrentDirectory(); }, |
setCurrentVoice: function(staffNum, voiceNum) { | this.setCurrentVoice = function(staffNum, voiceNum) { | setCurrentVoice: function(staffNum, voiceNum) { this.staffNum = staffNum; this.voiceNum = voiceNum; for (var i = 0; i < this.lines.length; i++) { if (this.lines[i].staff) { if (this.lines[i].staff[staffNum] === undefined || this.lines[i].staff[staffNum].voices[voiceNum] === undefined || !this.containsNotes(this.lines[i].staff[staffNum].voices[voiceNum] )) { this.lineNum = i; return; } } } this.lineNum = i; }, |
}, | }; | setCurrentVoice: function(staffNum, voiceNum) { this.staffNum = staffNum; this.voiceNum = voiceNum; for (var i = 0; i < this.lines.length; i++) { if (this.lines[i].staff) { if (this.lines[i].staff[staffNum] === undefined || this.lines[i].staff[staffNum].voices[voiceNum] === undefined || !this.containsNotes(this.lines[i].staff[staffNum].voices[voiceNum] )) { this.lineNum = i; return; } } } this.lineNum = i; }, |
weeks.find(".week").each(function() { | weeks.find(css.week).each(function() { | setDate: function(year, month, day) { var date = new Date(year, month, day); // current year / month if (!year) { date = input.data("date") || new Date(); year = date.getYear() % 100 + 2000; month = date.getMonth(); day = date.getDate(); } // strings to numbers year = integer(year); month = integer(month); day = integer(day); // roll year & month if (month == -1) { month = 11; year--; } else if (month == 12) { month = 0; year++; } // variables var tmp = new Date(year, month, 1 - conf.firstDay), begin = tmp.getDay(), days = dayAm(year, month), prevDays = dayAm(year, month - 1), week; // selectors if (conf.selectors) { // month selector monthSelector.empty(); $.each(labels.months, function(i, m) { if (min < new Date(year, i + 1, -1) && max > new Date(year, i, 0)) { monthSelector.append($("<option/>").html(m).attr("value", i)); } }); // year selector yearSelector.empty(); for (var i = year + conf.yearRange[0]; i < year + conf.yearRange[1]; i++) { if (min < new Date(i + 1, -1, 0) && max > new Date(i, 0, 0)) { yearSelector.append($("<option/>").text(i)); } } monthSelector.val(month); yearSelector.val(year); // title } else { title.html(labels.months[month] + " " + year); } // populate weeks weeks.empty(); pm.add(nm).removeClass(css.disabled); for (var j = 0, a, num; j < 35; j++) { a = $("<a/>"); if (j % 7 === 0) { week = $("<div/>").addClass(css.week); weeks.append(week); } if (j < begin) { a.addClass(css.off); num = prevDays - begin + j + 1; date = new Date(year, month-1, num); } else if (j >= begin + days) { a.addClass(css.off); num = j - days - begin + 1; date = new Date(year, month+1, num); } else { num = j - begin + 1; date = new Date(year, month, num); if (num === day) { a.attr("id", css.today).addClass(css.focus); } } // disabled if (min && date < min) { a.add(pm).addClass(css.disabled); } if (max && date > max) { a.add(nm).addClass(css.disabled); } a.attr("href", "#" + num).text(num).data("date", date); week.append(a); // date picking a.click(function(e) { if (!$(this).hasClass(css.disabled)) { pick($(this).data("date"), conf, e); } return false; }); } // sunday if (css.sunday) { weeks.find(".week").each(function() { var beg = conf.firstDay ? 7 - conf.firstDay : 0; $(this).children().slice(beg, beg + 1).addClass(css.sunday); }); } currMonth = month; currYear = year; currDay = day; return self; }, |
var len = line.substring(start, end).gsub(" ", ""); var len_arr = len.split('/'); if (len_arr.length === 2) { var n = parseInt(len_arr[0]); var d = parseInt(len_arr[1]); if (d > 0) { var q = n / d; multilineVars.default_length = q; multilineVars.havent_set_length = false; } | var len = line.substring(start, end).gsub(" ", ""); var len_arr = len.split('/'); if (len_arr.length === 2) { var n = parseInt(len_arr[0]); var d = parseInt(len_arr[1]); if (d > 0) { var q = n / d; multilineVars.default_length = q; multilineVars.havent_set_length = false; | this.setDefaultLength = function(line, start, end) { var len = line.substring(start, end).gsub(" ", ""); var len_arr = len.split('/'); if (len_arr.length === 2) { var n = parseInt(len_arr[0]); var d = parseInt(len_arr[1]); if (d > 0) { var q = n / d; multilineVars.default_length = q; // a whole note is 1 multilineVars.havent_set_length = false; } } }; |
}; | } }; | this.setDefaultLength = function(line, start, end) { var len = line.substring(start, end).gsub(" ", ""); var len_arr = len.split('/'); if (len_arr.length === 2) { var n = parseInt(len_arr[0]); var d = parseInt(len_arr[1]); if (d > 0) { var q = n / d; multilineVars.default_length = q; // a whole note is 1 multilineVars.havent_set_length = false; } } }; |
if (depth == undefined) | if (depth === undefined) { | var setFieldSetDisabled = function (fieldSet, disabled, depth) { if (depth == undefined) depth = 0; //IE workaround if (!Ext.isIE || depth !== 0) { fieldSet.setDisabled(disabled); } for (var i = 0; i < fieldSet.items.length; i++) { var item = fieldSet.items.get(i); if (item.getXType() == 'fieldset') { setFieldSetDisabled(item, disabled, depth + 1); } else { item.setDisabled(disabled); } } }; |
} | var setFieldSetDisabled = function (fieldSet, disabled, depth) { if (depth == undefined) depth = 0; //IE workaround if (!Ext.isIE || depth !== 0) { fieldSet.setDisabled(disabled); } for (var i = 0; i < fieldSet.items.length; i++) { var item = fieldSet.items.get(i); if (item.getXType() == 'fieldset') { setFieldSetDisabled(item, disabled, depth + 1); } else { item.setDisabled(disabled); } } }; |
|
var setFieldSetDisabled = function (fieldSet, disabled) { fieldSet.setDisabled(disabled); | var setFieldSetDisabled = function (fieldSet, disabled, depth) { if (depth == undefined) depth = 0; if (!Ext.isIE || depth !== 0) { fieldSet.setDisabled(disabled); } | var setFieldSetDisabled = function (fieldSet, disabled) { fieldSet.setDisabled(disabled); for (var i = 0; i < fieldSet.items.length; i++) { var item = fieldSet.items.get(i); if (item.getXType() == 'fieldset') { setFieldSetDisabled(item, disabled); } else { item.setDisabled(disabled); } } }; |
setFieldSetDisabled(item, disabled); | setFieldSetDisabled(item, disabled, depth + 1); | var setFieldSetDisabled = function (fieldSet, disabled) { fieldSet.setDisabled(disabled); for (var i = 0; i < fieldSet.items.length; i++) { var item = fieldSet.items.get(i); if (item.getXType() == 'fieldset') { setFieldSetDisabled(item, disabled); } else { item.setDisabled(disabled); } } }; |
null,W=0,ga=false,R=null,aa=null,ja=(new Date).getTime(),ha,da=0,S={};p.prototype.preload=function(d){var c=new Image;this.images.push(c);c.onload=p.prototype.onload;c.onerror=p.prototype.onload;c.onabort=p.prototype.onload;c.imagePreloader=this;c.src=d};p.prototype.onload=function(){var d=this.imagePreloader;--d.work==0&&d.callback(d.images)};o.history.register(_$_INITIAL_HASH_$_,t);this._p_={ieAlternative:r,loadScript:l,onJsLoad:E,setTitle:k,update:A,quit:b,setFormObjects:function(d){U=d},saveDownPos:w, | c.onerror=p.prototype.onload;c.onabort=p.prototype.onload;c.imagePreloader=this;c.src=d};p.prototype.onload=function(){var d=this.imagePreloader;--d.work==0&&d.callback(d.images)};o.history.register(_$_INITIAL_HASH_$_,t);this._p_={ieAlternative:r,loadScript:l,onJsLoad:D,setTitle:j,update:z,quit:b,setFormObjects:function(d){T=d},saveDownPos:v,addTimerEvent:K,load:i,handleResponse:C,setServerPush:u,dragStart:g,dragDrag:X,dragEnd:B,capture:o.capture,onHashChange:t,setHash:A,ImagePreloader:p,autoJavaScript:function(){_$_AUTO_JAVASCRIPT_$_()}, | null,W=0,ga=false,R=null,aa=null,ja=(new Date).getTime(),ha,da=0,S={};p.prototype.preload=function(d){var c=new Image;this.images.push(c);c.onload=p.prototype.onload;c.onerror=p.prototype.onload;c.onabort=p.prototype.onload;c.imagePreloader=this;c.src=d};p.prototype.onload=function(){var d=this.imagePreloader;--d.work==0&&d.callback(d.images)};o.history.register(_$_INITIAL_HASH_$_,t);this._p_={ieAlternative:r,loadScript:l,onJsLoad:E,setTitle:k,update:A,quit:b,setFormObjects:function(d){U=d},saveDownPos:w, |
s);this._p_={loadScript:Y,onJsLoad:Q,setTitle:l,update:H,quit:function(){ba=true;clearTimeout(aa)},setFormObjects:function(d){T=d},saveDownPos:v,addTimerEvent:z,load:o,handleResponse:D,setServerPush:t,dragStart:G,dragDrag:P,dragEnd:a,capture:n.capture,onHashChange:s,setHash:F,ImagePreloader:g,autoJavaScript:function(){with(window)_$_AUTO_JAVASCRIPT_$_()},response:R};this.WT=_$_WT_CLASS_$_;this.emit=I}),WtSignalEmit=_$_APP_CLASS_$_.emit;window.WtScriptLoaded=false; | aa=null,T=0,ea=false,P=null,X=null,ha=(new Date).getTime(),fa,ca=0,Q={};K.prototype.preload=function(d){var c=new Image;this.images.push(c);c.onload=K.prototype.onload;c.onerror=K.prototype.onload;c.onabort=K.prototype.onload;c.imagePreloader=this;c.src=d};K.prototype.onload=function(){var d=this.imagePreloader;--d.work==0&&d.callback(d.images)};g.history.register(_$_INITIAL_HASH_$_,t);this._p_={loadScript:S,onJsLoad:I,setTitle:f,update:A,quit:function(){ba=true;clearTimeout(aa)},setFormObjects:function(d){B= d},saveDownPos:x,addTimerEvent:N,load:m,handleResponse:u,setServerPush:E,dragStart:k,dragDrag:U,dragEnd:D,capture:g.capture,onHashChange:t,setHash:C,ImagePreloader:K,autoJavaScript:function(){with(window)_$_AUTO_JAVASCRIPT_$_()},response:L};this.WT=_$_WT_CLASS_$_;this.emit=O}),WtSignalEmit=_$_APP_CLASS_$_.emit;window.WtScriptLoaded=false; | s);this._p_={loadScript:Y,onJsLoad:Q,setTitle:l,update:H,quit:function(){ba=true;clearTimeout(aa)},setFormObjects:function(d){T=d},saveDownPos:v,addTimerEvent:z,load:o,handleResponse:D,setServerPush:t,dragStart:G,dragDrag:P,dragEnd:a,capture:n.capture,onHashChange:s,setHash:F,ImagePreloader:g,autoJavaScript:function(){with(window)_$_AUTO_JAVASCRIPT_$_()},response:R};this.WT=_$_WT_CLASS_$_;this.emit=I}),WtSignalEmit=_$_APP_CLASS_$_.emit;window.WtScriptLoaded=false; |
} | }, | setHTML: function (value) { let values = [[true, 1, gDisallow_classes_no_html], // plaintext [false, 0, 0], // HTML [false, 3, gDisallow_classes_no_html]]; // sanitized/simple HTML if (typeof value != "number" || value < 0 || value > 2) value = 1; gPrefBranch.setBoolPref("mailnews.display.prefer_plaintext", values[value][0]); gPrefBranch.setIntPref("mailnews.display.html_as", values[value][1]); gPrefBranch.setIntPref("mailnews.display.disallow_mime_handlers", values[value][2]); ReloadMessage(); } |
-1&&navigator.userAgent.toLowerCase().indexOf("opera")==-1)&&navigator.userAgent.toLowerCase().indexOf("msie 6")!=-1;this.isGecko=navigator.userAgent.toLowerCase().indexOf("gecko")!=-1;this.isIEMobile=navigator.userAgent.toLowerCase().indexOf("msie 4")!=-1||navigator.userAgent.toLowerCase().indexOf("msie 5")!=-1;this.isOpera=typeof window.opera!=="undefined";this.updateDelay=this.isIE?10:51;this.setHtml=function(a,b,f){function k(o,E){var u,s,z;switch(o.nodeType){case 1:u=o.namespaceURI==null?document.createElement(o.nodeName): document.createElementNS(o.namespaceURI,o.nodeName);if(o.attributes&&o.attributes.length>0){s=0;for(z=o.attributes.length;s<z;)u.setAttribute(o.attributes[s].nodeName,o.getAttribute(o.attributes[s++].nodeName))}if(E&&o.childNodes.length>0){s=0;for(z=o.childNodes.length;s<z;){var x=k(o.childNodes[s++],E);x&&u.appendChild(x)}}return u;case 3:case 4:case 5:return document.createTextNode(o.nodeValue)}return null}if(g.isIE||_$_INNER_HTML_$_&&!f)if(f)a.innerHTML+=b;else a.innerHTML=b;else{var h;h=new DOMParser; | -1&&navigator.userAgent.toLowerCase().indexOf("opera")==-1)&&navigator.userAgent.toLowerCase().indexOf("msie 6")!=-1;this.isGecko=navigator.userAgent.toLowerCase().indexOf("gecko")!=-1;this.isIEMobile=navigator.userAgent.toLowerCase().indexOf("msie 4")!=-1||navigator.userAgent.toLowerCase().indexOf("msie 5")!=-1;this.isOpera=typeof window.opera!=="undefined";this.updateDelay=this.isIE?10:51;this.setHtml=function(a,b,f){function k(o,E){var v,s,z;switch(o.nodeType){case 1:v=o.namespaceURI==null?document.createElement(o.nodeName): document.createElementNS(o.namespaceURI,o.nodeName);if(o.attributes&&o.attributes.length>0){s=0;for(z=o.attributes.length;s<z;)v.setAttribute(o.attributes[s].nodeName,o.getAttribute(o.attributes[s++].nodeName))}if(E&&o.childNodes.length>0){s=0;for(z=o.childNodes.length;s<z;){var y=k(o.childNodes[s++],E);y&&v.appendChild(y)}}return v;case 3:case 4:case 5:return document.createTextNode(o.nodeValue)}return null}if(g.isIE||_$_INNER_HTML_$_&&!f)if(f)a.innerHTML+=b;else a.innerHTML=b;else{var h;h=new DOMParser; | -1&&navigator.userAgent.toLowerCase().indexOf("opera")==-1)&&navigator.userAgent.toLowerCase().indexOf("msie 6")!=-1;this.isGecko=navigator.userAgent.toLowerCase().indexOf("gecko")!=-1;this.isIEMobile=navigator.userAgent.toLowerCase().indexOf("msie 4")!=-1||navigator.userAgent.toLowerCase().indexOf("msie 5")!=-1;this.isOpera=typeof window.opera!=="undefined";this.updateDelay=this.isIE?10:51;this.setHtml=function(a,b,f){function k(o,E){var u,s,z;switch(o.nodeType){case 1:u=o.namespaceURI==null?document.createElement(o.nodeName):document.createElementNS(o.namespaceURI,o.nodeName);if(o.attributes&&o.attributes.length>0){s=0;for(z=o.attributes.length;s<z;)u.setAttribute(o.attributes[s].nodeName,o.getAttribute(o.attributes[s++].nodeName))}if(E&&o.childNodes.length>0){s=0;for(z=o.childNodes.length;s<z;){var x=k(o.childNodes[s++],E);x&&u.appendChild(x)}}return u;case 3:case 4:case 5:return document.createTextNode(o.nodeValue)}return null}if(g.isIE||_$_INNER_HTML_$_&&!f)if(f)a.innerHTML+=b;else a.innerHTML=b;else{var h;h=new DOMParser;h=h.parseFromString("<div>"+b+"</div>","application/xhtml+xml").documentElement;if(h.nodeType!=1)h=h.nextSibling;if(!f)a.innerHTML="";b=0;for(f=h.childNodes.length;b<f;)a.appendChild(k(h.childNodes[b++],true))}};this.hasTag=function(a,b){return a.nodeType==1&&a.tagName.toUpperCase()===b};this.insertAt=function(a,b,f){a.childNodes.length==0?a.appendChild(b):a.insertBefore(b,a.childNodes[f])};this.remove=function(a){(a=g.getElement(a))&&a.parentNode.removeChild(a)};this.unstub=function(a,b,f){if(f== |
-1||navigator.userAgent.toLowerCase().indexOf("msie 5")!=-1;this.isOpera=window.opera!=="undefined";this.updateDelay=this.isIE?10:51;this.setHtml=function(a,b,f){function l(o,L){var u,q,B;switch(o.nodeType){case 1:u=o.namespaceURI==null?document.createElement(o.nodeName):document.createElementNS(o.namespaceURI,o.nodeName);if(o.attributes&&o.attributes.length>0){q=0;for(B=o.attributes.length;q<B;)u.setAttribute(o.attributes[q].nodeName,o.getAttribute(o.attributes[q++].nodeName))}if(L&&o.childNodes.length> | -1||navigator.userAgent.toLowerCase().indexOf("msie 5")!=-1;this.isOpera=typeof window.opera!=="undefined";this.updateDelay=this.isIE?10:51;this.setHtml=function(a,b,f){function l(o,L){var u,q,B;switch(o.nodeType){case 1:u=o.namespaceURI==null?document.createElement(o.nodeName):document.createElementNS(o.namespaceURI,o.nodeName);if(o.attributes&&o.attributes.length>0){q=0;for(B=o.attributes.length;q<B;)u.setAttribute(o.attributes[q].nodeName,o.getAttribute(o.attributes[q++].nodeName))}if(L&&o.childNodes.length> | -1||navigator.userAgent.toLowerCase().indexOf("msie 5")!=-1;this.isOpera=window.opera!=="undefined";this.updateDelay=this.isIE?10:51;this.setHtml=function(a,b,f){function l(o,L){var u,q,B;switch(o.nodeType){case 1:u=o.namespaceURI==null?document.createElement(o.nodeName):document.createElementNS(o.namespaceURI,o.nodeName);if(o.attributes&&o.attributes.length>0){q=0;for(B=o.attributes.length;q<B;)u.setAttribute(o.attributes[q].nodeName,o.getAttribute(o.attributes[q++].nodeName))}if(L&&o.childNodes.length>0){q=0;for(B=o.childNodes.length;q<B;){var r=l(o.childNodes[q++],L);r&&u.appendChild(r)}}return u;case 3:case 4:case 5:return document.createTextNode(o.nodeValue)}return null}if(g.isIE||_$_INNER_HTML_$_&&!f)if(f)a.innerHTML+=b;else a.innerHTML=b;else{var n;n=new DOMParser;n=n.parseFromString("<div>"+b+"</div>","application/xhtml+xml").documentElement;if(n.nodeType!=1)n=n.nextSibling;if(!f)a.innerHTML="";b=0;for(f=n.childNodes.length;b<f;)a.appendChild(l(n.childNodes[b++],true))}};this.hasTag=function(a, |
this.updateDelay=this.isIE?10:51;this.setHtml=function(a,b,e){function k(n,K){var u,q,D;switch(n.nodeType){case 1:u=n.namespaceURI==null?document.createElement(n.nodeName):document.createElementNS(n.namespaceURI,n.nodeName);if(n.attributes&&n.attributes.length>0){q=0;for(D=n.attributes.length;q<D;)u.setAttribute(n.attributes[q].nodeName,n.getAttribute(n.attributes[q++].nodeName))}if(K&&n.childNodes.length>0){q=0;for(D=n.childNodes.length;q<D;){var x=k(n.childNodes[q++],K);x&&u.appendChild(x)}}return u; case 3:case 4:case 5:return document.createTextNode(n.nodeValue)}return null}if(h.isIE||_$_INNER_HTML_$_&&!e)if(e)a.innerHTML+=b;else a.innerHTML=b;else{var i;i=new DOMParser;i=i.parseFromString("<div>"+b+"</div>","application/xhtml+xml").documentElement;if(i.nodeType!=1)i=i.nextSibling;if(!e)a.innerHTML="";b=0;for(e=i.childNodes.length;b<e;)a.appendChild(k(i.childNodes[b++],true))}};this.hasTag=function(a,b){return a.nodeType==1&&a.tagName.toUpperCase()===b};this.insertAt=function(a,b,e){a.childNodes.length== | this.updateDelay=this.isIE?10:51;this.setHtml=function(a,b,e){function j(n,J){var u,q,C;switch(n.nodeType){case 1:u=n.namespaceURI==null?document.createElement(n.nodeName):document.createElementNS(n.namespaceURI,n.nodeName);if(n.attributes&&n.attributes.length>0){q=0;for(C=n.attributes.length;q<C;)u.setAttribute(n.attributes[q].nodeName,n.getAttribute(n.attributes[q++].nodeName))}if(J&&n.childNodes.length>0){q=0;for(C=n.childNodes.length;q<C;){var w=j(n.childNodes[q++],J);w&&u.appendChild(w)}}return u; case 3:case 4:case 5:return document.createTextNode(n.nodeValue)}return null}if(g.isIE||_$_INNER_HTML_$_&&!e)if(e)a.innerHTML+=b;else a.innerHTML=b;else{var i;i=new DOMParser;i=i.parseFromString("<div>"+b+"</div>","application/xhtml+xml").documentElement;if(i.nodeType!=1)i=i.nextSibling;if(!e)a.innerHTML="";b=0;for(e=i.childNodes.length;b<e;)a.appendChild(j(i.childNodes[b++],true))}};this.hasTag=function(a,b){return a.nodeType==1&&a.tagName.toUpperCase()===b};this.insertAt=function(a,b,e){a.childNodes.length== | this.updateDelay=this.isIE?10:51;this.setHtml=function(a,b,e){function k(n,K){var u,q,D;switch(n.nodeType){case 1:u=n.namespaceURI==null?document.createElement(n.nodeName):document.createElementNS(n.namespaceURI,n.nodeName);if(n.attributes&&n.attributes.length>0){q=0;for(D=n.attributes.length;q<D;)u.setAttribute(n.attributes[q].nodeName,n.getAttribute(n.attributes[q++].nodeName))}if(K&&n.childNodes.length>0){q=0;for(D=n.childNodes.length;q<D;){var x=k(n.childNodes[q++],K);x&&u.appendChild(x)}}return u;case 3:case 4:case 5:return document.createTextNode(n.nodeValue)}return null}if(h.isIE||_$_INNER_HTML_$_&&!e)if(e)a.innerHTML+=b;else a.innerHTML=b;else{var i;i=new DOMParser;i=i.parseFromString("<div>"+b+"</div>","application/xhtml+xml").documentElement;if(i.nodeType!=1)i=i.nextSibling;if(!e)a.innerHTML="";b=0;for(e=i.childNodes.length;b<e;)a.appendChild(k(i.childNodes[b++],true))}};this.hasTag=function(a,b){return a.nodeType==1&&a.tagName.toUpperCase()===b};this.insertAt=function(a,b,e){a.childNodes.length== |
-1;this.isIEMobile=navigator.userAgent.toLowerCase().indexOf("msie 4")!=-1||navigator.userAgent.toLowerCase().indexOf("msie 5")!=-1;this.updateDelay=this.isIE?10:51;this.setHtml=function(a,b,f){function m(o,B){var r,t,C;switch(o.nodeType){case 1:r=o.namespaceURI==null?document.createElement(o.nodeName):document.createElementNS(o.namespaceURI,o.nodeName);if(o.attributes&&o.attributes.length>0){t=0;for(C=o.attributes.length;t<C;)r.setAttribute(o.attributes[t].nodeName,o.getAttribute(o.attributes[t++].nodeName))}if(B&& o.childNodes.length>0){t=0;for(C=o.childNodes.length;t<C;){var D=m(o.childNodes[t++],B);D&&r.appendChild(D)}}return r;case 3:case 4:case 5:return document.createTextNode(o.nodeValue)}return null}if(k.isIE||_$_INNER_HTML_$_&&!f)if(f)a.innerHTML+=b;else a.innerHTML=b;else{var l;l=new DOMParser;l=l.parseFromString("<div>"+b+"</div>","application/xhtml+xml").documentElement;if(l.nodeType!=1)l=l.nextSibling;if(!f)a.innerHTML="";b=0;for(f=l.childNodes.length;b<f;)a.appendChild(m(l.childNodes[b++],true))}}; | -1&&navigator.userAgent.toLowerCase().indexOf("opera")==-1)&&navigator.userAgent.toLowerCase().indexOf("msie 6")!=-1;this.isGecko=navigator.userAgent.toLowerCase().indexOf("gecko")!=-1;this.isIEMobile=navigator.userAgent.toLowerCase().indexOf("msie 4")!=-1||navigator.userAgent.toLowerCase().indexOf("msie 5")!=-1;this.updateDelay=this.isIE?10:51;this.setHtml=function(a,b,f){function m(n,E){var q,u,H;switch(n.nodeType){case 1:q=n.namespaceURI==null?document.createElement(n.nodeName):document.createElementNS(n.namespaceURI, n.nodeName);if(n.attributes&&n.attributes.length>0){u=0;for(H=n.attributes.length;u<H;)q.setAttribute(n.attributes[u].nodeName,n.getAttribute(n.attributes[u++].nodeName))}if(E&&n.childNodes.length>0){u=0;for(H=n.childNodes.length;u<H;){var A=m(n.childNodes[u++],E);A&&q.appendChild(A)}}return q;case 3:case 4:case 5:return document.createTextNode(n.nodeValue)}return null}if(k.isIE||_$_INNER_HTML_$_&&!f)if(f)a.innerHTML+=b;else a.innerHTML=b;else{var l;l=new DOMParser;l=l.parseFromString("<div>"+b+"</div>", "application/xhtml+xml").documentElement;if(l.nodeType!=1)l=l.nextSibling;if(!f)a.innerHTML="";b=0;for(f=l.childNodes.length;b<f;)a.appendChild(m(l.childNodes[b++],true))}};this.hasTag=function(a,b){return a.tagName.toUpperCase()===b};this.insertAt=function(a,b,f){a.childNodes.length==0?a.appendChild(b):a.insertBefore(b,a.childNodes[f])};this.unstub=function(a,b,f){if(f==1){if(a.style.display!="none")b.style.display=a.style.display}else{b.style.position=a.style.position;b.style.left=a.style.left; | -1;this.isIEMobile=navigator.userAgent.toLowerCase().indexOf("msie 4")!=-1||navigator.userAgent.toLowerCase().indexOf("msie 5")!=-1;this.updateDelay=this.isIE?10:51;this.setHtml=function(a,b,f){function m(o,B){var r,t,C;switch(o.nodeType){case 1:r=o.namespaceURI==null?document.createElement(o.nodeName):document.createElementNS(o.namespaceURI,o.nodeName);if(o.attributes&&o.attributes.length>0){t=0;for(C=o.attributes.length;t<C;)r.setAttribute(o.attributes[t].nodeName,o.getAttribute(o.attributes[t++].nodeName))}if(B&&o.childNodes.length>0){t=0;for(C=o.childNodes.length;t<C;){var D=m(o.childNodes[t++],B);D&&r.appendChild(D)}}return r;case 3:case 4:case 5:return document.createTextNode(o.nodeValue)}return null}if(k.isIE||_$_INNER_HTML_$_&&!f)if(f)a.innerHTML+=b;else a.innerHTML=b;else{var l;l=new DOMParser;l=l.parseFromString("<div>"+b+"</div>","application/xhtml+xml").documentElement;if(l.nodeType!=1)l=l.nextSibling;if(!f)a.innerHTML="";b=0;for(f=l.childNodes.length;b<f;)a.appendChild(m(l.childNodes[b++],true))}}; |
if (!lastId) { lastId = lid; pollerId = pollPresence.periodical(pollInterval,MBchat.updateables); if (fullPoll) pollRequest.post(myRequestOptions); } else { lastId = (lastId > lid)? lid : lastId; } | lastId = (lastId > lid)? lid : lastId; | setLastId : function(lid) { if (!lastId) { lastId = lid; pollerId = pollPresence.periodical(pollInterval,MBchat.updateables); if (fullPoll) pollRequest.post(myRequestOptions); } else { lastId = (lastId > lid)? lid : lastId; //set to earliest value } }, |
WT_DECLARE_WT_MEMBER(1,"WGLWidget",function(p,j){jQuery.data(j,"obj",this);var h=p.WT;this.ctx=null;this.initializeGL=function(){};this.paintGL=function(){};var f=null,g=null,k=null,l=0,m=0,c=null,n=0,o=0;this.discoverContext=function(){if(j.getContext){this.ctx=j.getContext("experimental-webgl");if(this.ctx==null)this.ctx=j.getContext("webgl");this.ctx==null&&console.log("WGLWidget: failed to get a webgl context")}console.log("ctx: "+this.ctx);return this.ctx};this.setLookAtParams=function(a,b,d, e,i){c=a;g=b;k=d;l=e;m=i};this.mouseDragLookAt=function(a,b){var d=h.pageCoordinates(b);a=d.x-f.x;d=d.y-f.y;var e=vec3.create();e[0]=c[0];e[1]=c[4];e[2]=c[8];var i=mat4.create();mat4.identity(i);mat4.translate(i,g);mat4.rotate(i,d*l,e);mat4.rotate(i,a*m,k);vec3.negate(g);mat4.translate(i,g);vec3.negate(g);mat4.multiply(c,i,c);console.log("mouseDragLookAt after: "+mat4.str(c));console.log("mouseDragLookAt: repaint");this.paintGl();f=h.pageCoordinates(b)};this.mouseWheelLookAt=function(a,b){a=h.wheelDelta(b); | WT_DECLARE_WT_MEMBER(1,"WGLWidget",function(r,l){jQuery.data(l,"obj",this);var f=r.WT,k=f.glMatrix.vec3,b=f.glMatrix.mat4;this.ctx=null;this.initializeGL=function(){};this.paintGL=function(){};var h=null,i=null,m=null,n=0,o=0,e=null,p=0,q=0;this.discoverContext=function(){if(l.getContext){this.ctx=l.getContext("experimental-webgl");if(this.ctx==null)this.ctx=l.getContext("webgl");this.ctx==null&&console.log("WGLWidget: failed to get a webgl context")}return this.ctx};this.setLookAtParams=function(a, c,d,g,j){e=a;i=c;m=d;n=g;o=j};this.mouseDragLookAt=function(a,c){var d=f.pageCoordinates(c);a=d.x-h.x;d=d.y-h.y;var g=k.create();g[0]=e[0];g[1]=e[4];g[2]=e[8];var j=b.create();b.identity(j);b.translate(j,i);b.rotate(j,d*n,g);b.rotate(j,a*o,m);k.negate(i);b.translate(j,i);k.negate(i);b.multiply(e,j,e);this.paintGl();h=f.pageCoordinates(c)};this.mouseWheelLookAt=function(a,c){f.cancelEvent(c);a=f.wheelDelta(c);a=Math.pow(1.2,a);b.translate(e,i);b.scale(e,[a,a,a]);k.negate(i);b.translate(e,i);k.negate(i); | WT_DECLARE_WT_MEMBER(1,"WGLWidget",function(p,j){jQuery.data(j,"obj",this);var h=p.WT;this.ctx=null;this.initializeGL=function(){};this.paintGL=function(){};var f=null,g=null,k=null,l=0,m=0,c=null,n=0,o=0;this.discoverContext=function(){if(j.getContext){this.ctx=j.getContext("experimental-webgl");if(this.ctx==null)this.ctx=j.getContext("webgl");this.ctx==null&&console.log("WGLWidget: failed to get a webgl context")}console.log("ctx: "+this.ctx);return this.ctx};this.setLookAtParams=function(a,b,d,e,i){c=a;g=b;k=d;l=e;m=i};this.mouseDragLookAt=function(a,b){var d=h.pageCoordinates(b);a=d.x-f.x;d=d.y-f.y;var e=vec3.create();e[0]=c[0];e[1]=c[4];e[2]=c[8];var i=mat4.create();mat4.identity(i);mat4.translate(i,g);mat4.rotate(i,d*l,e);mat4.rotate(i,a*m,k);vec3.negate(g);mat4.translate(i,g);vec3.negate(g);mat4.multiply(c,i,c);console.log("mouseDragLookAt after: "+mat4.str(c));console.log("mouseDragLookAt: repaint");this.paintGl();f=h.pageCoordinates(b)};this.mouseWheelLookAt=function(a,b){a=h.wheelDelta(b); |
WT_DECLARE_WT_MEMBER(1,"WGLWidget",function(r,j){jQuery.data(j,"obj",this);var f=r.WT,l=f.glMatrix.vec3,b=f.glMatrix.mat4;this.ctx=null;this.initializeGL=function(){};this.paintGL=function(){};var h=null,i=null,m=null,n=0,o=0,e=null,p=0,q=0;this.discoverContext=function(a){if(j.getContext){try{this.ctx=j.getContext("webgl")}catch(c){}if(this.ctx==null)try{this.ctx=j.getContext("experimental-webgl")}catch(d){}if(this.ctx==null){j.parentNode.replaceChild(j.firstChild,j);a()}}return this.ctx};this.setLookAtParams= function(a,c,d,g,k){e=a;i=c;m=d;n=g;o=k};this.mouseDragLookAt=function(a,c){if(this.ctx!=null){var d=f.pageCoordinates(c);a=d.x-h.x;d=d.y-h.y;var g=l.create();g[0]=e[0];g[1]=e[4];g[2]=e[8];var k=b.create();b.identity(k);b.translate(k,i);b.rotate(k,d*n,g);b.rotate(k,a*o,m);l.negate(i);b.translate(k,i);l.negate(i);b.multiply(e,k,e);this.paintGL();h=f.pageCoordinates(c)}};this.mouseWheelLookAt=function(a,c){if(this.ctx!=null){f.cancelEvent(c);a=f.wheelDelta(c);a=Math.pow(1.2,a);b.translate(e,i);b.scale(e, | null){j.parentNode.replaceChild(j.firstChild,j);a()}}return this.ctx};this.setLookAtParams=function(a,c,d,g,k){e=a;i=c;m=d;n=g;o=k};this.mouseDragLookAt=function(a,c){if(this.ctx!=null){var d=f.pageCoordinates(c);a=d.x-h.x;d=d.y-h.y;var g=l.create();g[0]=e[0];g[1]=e[4];g[2]=e[8];var k=b.create();b.identity(k);b.translate(k,i);b.rotate(k,d*n,g);b.rotate(k,a*o,m);l.negate(i);b.translate(k,i);l.negate(i);b.multiply(e,k,e);this.paintGL();h=f.pageCoordinates(c)}};this.mouseWheelLookAt=function(a,c){if(this.ctx!= | WT_DECLARE_WT_MEMBER(1,"WGLWidget",function(r,j){jQuery.data(j,"obj",this);var f=r.WT,l=f.glMatrix.vec3,b=f.glMatrix.mat4;this.ctx=null;this.initializeGL=function(){};this.paintGL=function(){};var h=null,i=null,m=null,n=0,o=0,e=null,p=0,q=0;this.discoverContext=function(a){if(j.getContext){try{this.ctx=j.getContext("webgl")}catch(c){}if(this.ctx==null)try{this.ctx=j.getContext("experimental-webgl")}catch(d){}if(this.ctx==null){j.parentNode.replaceChild(j.firstChild,j);a()}}return this.ctx};this.setLookAtParams=function(a,c,d,g,k){e=a;i=c;m=d;n=g;o=k};this.mouseDragLookAt=function(a,c){if(this.ctx!=null){var d=f.pageCoordinates(c);a=d.x-h.x;d=d.y-h.y;var g=l.create();g[0]=e[0];g[1]=e[4];g[2]=e[8];var k=b.create();b.identity(k);b.translate(k,i);b.rotate(k,d*n,g);b.rotate(k,a*o,m);l.negate(i);b.translate(k,i);l.negate(i);b.multiply(e,k,e);this.paintGL();h=f.pageCoordinates(c)}};this.mouseWheelLookAt=function(a,c){if(this.ctx!=null){f.cancelEvent(c);a=f.wheelDelta(c);a=Math.pow(1.2,a);b.translate(e,i);b.scale(e, |
WT_DECLARE_WT_MEMBER(1,"WGLWidget",function(r,l){jQuery.data(l,"obj",this);var f=r.WT,k=f.glMatrix.vec3,b=f.glMatrix.mat4;this.ctx=null;this.initializeGL=function(){};this.paintGL=function(){};var h=null,i=null,m=null,n=0,o=0,e=null,p=0,q=0;this.discoverContext=function(){if(l.getContext){this.ctx=l.getContext("experimental-webgl");if(this.ctx==null)this.ctx=l.getContext("webgl")}return this.ctx};this.setLookAtParams=function(a,c,d,g,j){e=a;i=c;m=d;n=g;o=j};this.mouseDragLookAt=function(a,c){var d= | WT_DECLARE_WT_MEMBER(1,"WGLWidget",function(r,j){jQuery.data(j,"obj",this);var f=r.WT,l=f.glMatrix.vec3,b=f.glMatrix.mat4;this.ctx=null;this.initializeGL=function(){};this.paintGL=function(){};var h=null,i=null,m=null,n=0,o=0,e=null,p=0,q=0;this.discoverContext=function(a){if(j.getContext){try{this.ctx=j.getContext("webgl")}catch(c){}if(this.ctx==null)try{this.ctx=j.getContext("experimental-webgl")}catch(d){}if(this.ctx==null){j.parentNode.replaceChild(j.firstChild,j);a()}}return this.ctx};this.setLookAtParams= function(a,c,d,g,k){e=a;i=c;m=d;n=g;o=k};this.mouseDragLookAt=function(a,c){if(this.ctx!=null){var d=f.pageCoordinates(c);a=d.x-h.x;d=d.y-h.y;var g=l.create();g[0]=e[0];g[1]=e[4];g[2]=e[8];var k=b.create();b.identity(k);b.translate(k,i);b.rotate(k,d*n,g);b.rotate(k,a*o,m);l.negate(i);b.translate(k,i);l.negate(i);b.multiply(e,k,e);this.paintGL();h=f.pageCoordinates(c)}};this.mouseWheelLookAt=function(a,c){if(this.ctx!=null){f.cancelEvent(c);a=f.wheelDelta(c);a=Math.pow(1.2,a);b.translate(e,i);b.scale(e, | WT_DECLARE_WT_MEMBER(1,"WGLWidget",function(r,l){jQuery.data(l,"obj",this);var f=r.WT,k=f.glMatrix.vec3,b=f.glMatrix.mat4;this.ctx=null;this.initializeGL=function(){};this.paintGL=function(){};var h=null,i=null,m=null,n=0,o=0,e=null,p=0,q=0;this.discoverContext=function(){if(l.getContext){this.ctx=l.getContext("experimental-webgl");if(this.ctx==null)this.ctx=l.getContext("webgl")}return this.ctx};this.setLookAtParams=function(a,c,d,g,j){e=a;i=c;m=d;n=g;o=j};this.mouseDragLookAt=function(a,c){var d= |
WT_DECLARE_WT_MEMBER(1,"WGLWidget",function(r,l){jQuery.data(l,"obj",this);var f=r.WT,k=f.glMatrix.vec3,b=f.glMatrix.mat4;this.ctx=null;this.initializeGL=function(){};this.paintGL=function(){};var h=null,i=null,m=null,n=0,o=0,e=null,p=0,q=0;this.discoverContext=function(){if(l.getContext){this.ctx=l.getContext("experimental-webgl");if(this.ctx==null)this.ctx=l.getContext("webgl");this.ctx==null&&console.log("WGLWidget: failed to get a webgl context")}return this.ctx};this.setLookAtParams=function(a, c,d,g,j){e=a;i=c;m=d;n=g;o=j};this.mouseDragLookAt=function(a,c){var d=f.pageCoordinates(c);a=d.x-h.x;d=d.y-h.y;var g=k.create();g[0]=e[0];g[1]=e[4];g[2]=e[8];var j=b.create();b.identity(j);b.translate(j,i);b.rotate(j,d*n,g);b.rotate(j,a*o,m);k.negate(i);b.translate(j,i);k.negate(i);b.multiply(e,j,e);this.paintGl();h=f.pageCoordinates(c)};this.mouseWheelLookAt=function(a,c){f.cancelEvent(c);a=f.wheelDelta(c);a=Math.pow(1.2,a);b.translate(e,i);b.scale(e,[a,a,a]);k.negate(i);b.translate(e,i);k.negate(i); | WT_DECLARE_WT_MEMBER(1,"WGLWidget",function(r,l){jQuery.data(l,"obj",this);var f=r.WT,k=f.glMatrix.vec3,b=f.glMatrix.mat4;this.ctx=null;this.initializeGL=function(){};this.paintGL=function(){};var h=null,i=null,m=null,n=0,o=0,e=null,p=0,q=0;this.discoverContext=function(){if(l.getContext){this.ctx=l.getContext("experimental-webgl");if(this.ctx==null)this.ctx=l.getContext("webgl")}return this.ctx};this.setLookAtParams=function(a,c,d,g,j){e=a;i=c;m=d;n=g;o=j};this.mouseDragLookAt=function(a,c){var d= | WT_DECLARE_WT_MEMBER(1,"WGLWidget",function(r,l){jQuery.data(l,"obj",this);var f=r.WT,k=f.glMatrix.vec3,b=f.glMatrix.mat4;this.ctx=null;this.initializeGL=function(){};this.paintGL=function(){};var h=null,i=null,m=null,n=0,o=0,e=null,p=0,q=0;this.discoverContext=function(){if(l.getContext){this.ctx=l.getContext("experimental-webgl");if(this.ctx==null)this.ctx=l.getContext("webgl");this.ctx==null&&console.log("WGLWidget: failed to get a webgl context")}return this.ctx};this.setLookAtParams=function(a,c,d,g,j){e=a;i=c;m=d;n=g;o=j};this.mouseDragLookAt=function(a,c){var d=f.pageCoordinates(c);a=d.x-h.x;d=d.y-h.y;var g=k.create();g[0]=e[0];g[1]=e[4];g[2]=e[8];var j=b.create();b.identity(j);b.translate(j,i);b.rotate(j,d*n,g);b.rotate(j,a*o,m);k.negate(i);b.translate(j,i);k.negate(i);b.multiply(e,j,e);this.paintGl();h=f.pageCoordinates(c)};this.mouseWheelLookAt=function(a,c){f.cancelEvent(c);a=f.wheelDelta(c);a=Math.pow(1.2,a);b.translate(e,i);b.scale(e,[a,a,a]);k.negate(i);b.translate(e,i);k.negate(i); |
line = tokenizer.stripComment(line); if (line === 'C') { if (multilineVars.havent_set_length === true) multilineVars.default_length = 0.125; return {type: 'common_time'}; } else if (line === 'C|') { if (multilineVars.havent_set_length === true) multilineVars.default_length = 0.125; return {type: 'cut_time'}; } else if (line.length === 0 || line.toLowerCase() === 'none') { if (multilineVars.havent_set_length === true) multilineVars.default_length = 0.125; return null; | line = tokenizer.stripComment(line); if (line === 'C') { if (multilineVars.havent_set_length === true) multilineVars.default_length = 0.125; return {type: 'common_time'}; } else if (line === 'C|') { if (multilineVars.havent_set_length === true) multilineVars.default_length = 0.125; return {type: 'cut_time'}; } else if (line.length === 0 || line.toLowerCase() === 'none') { if (multilineVars.havent_set_length === true) multilineVars.default_length = 0.125; return null; } else { var tokens = tokenizer.tokenize(line, 0, line.length); try { var parseNum = function() { var ret = { value: 0, num: "" }; var tok = tokens.shift(); if (tok.token === '(') tok = tokens.shift(); while (1) { if (tok.type !== 'number') throw "Expected top number of meter"; ret.value += parseInt(tok.token); ret.num += tok.token; if (tokens.length === 0 || tokens[0].token === '/') return ret; tok = tokens.shift(); if (tok.token === ')') { if (tokens.length === 0 || tokens[0].token === '/') return ret; throw "Unexpected paren in meter"; } if (tok.token !== '.' && tok.token !== '+') throw "Expected top number of meter"; ret.num += tok.token; if (tokens.length === 0) throw "Expected top number of meter"; tok = tokens.shift(); } return ret; }; var parseFraction = function() { var ret = parseNum(); if (tokens.length === 0) throw "Expected slash in meter"; var tok = tokens.shift(); if (tok.token !== '/') throw "Expected slash in meter"; tok = tokens.shift(); if (tok.type !== 'number') throw "Expected bottom number of meter"; ret.den = tok.token; ret.value = ret.value / parseInt(ret.den); return ret; }; if (tokens.length === 0) throw "Expected meter definition in M: line"; var meter = {type: 'specified', value: [ ]}; var totalLength = 0; while (1) { var ret = parseFraction(); totalLength += ret.value; meter.value.push({ num: ret.num, den: ret.den }); if (tokens.length === 0) break; var tok = tokens.shift(); if (tok.token !== '+') throw "Extra characters in M: line"; } if (multilineVars.havent_set_length === true) { multilineVars.default_length = totalLength < 0.75 ? 0.0625 : 0.125; } return meter; } catch (e) { warn(e, line, 0); | this.setMeter = function(line) { line = tokenizer.stripComment(line); if (line === 'C') { if (multilineVars.havent_set_length === true) multilineVars.default_length = 0.125; return {type: 'common_time'}; } else if (line === 'C|') { if (multilineVars.havent_set_length === true) multilineVars.default_length = 0.125; return {type: 'cut_time'}; } else if (line.length === 0 || line.toLowerCase() === 'none') { if (multilineVars.havent_set_length === true) multilineVars.default_length = 0.125; return null; } else { var tokens = tokenizer.tokenize(line, 0, line.length); // the form is [open_paren] decimal [ plus|dot decimal ]... [close_paren] slash decimal [plus same_as_before] try { var parseNum = function() { // handles this much: [open_paren] decimal [ plus|dot decimal ]... [close_paren] var ret = { value: 0, num: "" }; var tok = tokens.shift(); if (tok.token === '(') tok = tokens.shift(); while (1) { if (tok.type !== 'number') throw "Expected top number of meter"; ret.value += parseInt(tok.token); ret.num += tok.token; if (tokens.length === 0 || tokens[0].token === '/') return ret; tok = tokens.shift(); if (tok.token === ')') { if (tokens.length === 0 || tokens[0].token === '/') return ret; throw "Unexpected paren in meter"; } if (tok.token !== '.' && tok.token !== '+') throw "Expected top number of meter"; ret.num += tok.token; if (tokens.length === 0) throw "Expected top number of meter"; tok = tokens.shift(); } return ret; // just to suppress warning }; var parseFraction = function() { // handles this much: parseNum slash decimal var ret = parseNum(); if (tokens.length === 0) throw "Expected slash in meter"; var tok = tokens.shift(); if (tok.token !== '/') throw "Expected slash in meter"; tok = tokens.shift(); if (tok.type !== 'number') throw "Expected bottom number of meter"; ret.den = tok.token; ret.value = ret.value / parseInt(ret.den); return ret; }; if (tokens.length === 0) throw "Expected meter definition in M: line"; var meter = {type: 'specified', value: [ ]}; var totalLength = 0; while (1) { var ret = parseFraction(); totalLength += ret.value; meter.value.push({ num: ret.num, den: ret.den }); if (tokens.length === 0) break; var tok = tokens.shift(); if (tok.token !== '+') throw "Extra characters in M: line"; } if (multilineVars.havent_set_length === true) { multilineVars.default_length = totalLength < 0.75 ? 0.0625 : 0.125; } return meter; } catch (e) { warn(e, line, 0); } } return null; }; |
else { var tokens = tokenizer.tokenize(line, 0, line.length); try { var parseNum = function() { var ret = { value: 0, num: "" }; var tok = tokens.shift(); if (tok.token === '(') tok = tokens.shift(); while (1) { if (tok.type !== 'number') throw "Expected top number of meter"; ret.value += parseInt(tok.token); ret.num += tok.token; if (tokens.length === 0 || tokens[0].token === '/') return ret; tok = tokens.shift(); if (tok.token === ')') { if (tokens.length === 0 || tokens[0].token === '/') return ret; throw "Unexpected paren in meter"; } if (tok.token !== '.' && tok.token !== '+') throw "Expected top number of meter"; ret.num += tok.token; if (tokens.length === 0) throw "Expected top number of meter"; tok = tokens.shift(); } return ret; }; var parseFraction = function() { var ret = parseNum(); if (tokens.length === 0) throw "Expected slash in meter"; var tok = tokens.shift(); if (tok.token !== '/') throw "Expected slash in meter"; tok = tokens.shift(); if (tok.type !== 'number') throw "Expected bottom number of meter"; ret.den = tok.token; ret.value = ret.value / parseInt(ret.den); return ret; }; if (tokens.length === 0) throw "Expected meter definition in M: line"; var meter = {type: 'specified', value: [ ]}; var totalLength = 0; while (1) { var ret = parseFraction(); totalLength += ret.value; meter.value.push({ num: ret.num, den: ret.den }); if (tokens.length === 0) break; var tok = tokens.shift(); if (tok.token !== '+') throw "Extra characters in M: line"; } if (multilineVars.havent_set_length === true) { multilineVars.default_length = totalLength < 0.75 ? 0.0625 : 0.125; } return meter; } catch (e) { warn(e, line, 0); } } return null; }; | } return null; }; | this.setMeter = function(line) { line = tokenizer.stripComment(line); if (line === 'C') { if (multilineVars.havent_set_length === true) multilineVars.default_length = 0.125; return {type: 'common_time'}; } else if (line === 'C|') { if (multilineVars.havent_set_length === true) multilineVars.default_length = 0.125; return {type: 'cut_time'}; } else if (line.length === 0 || line.toLowerCase() === 'none') { if (multilineVars.havent_set_length === true) multilineVars.default_length = 0.125; return null; } else { var tokens = tokenizer.tokenize(line, 0, line.length); // the form is [open_paren] decimal [ plus|dot decimal ]... [close_paren] slash decimal [plus same_as_before] try { var parseNum = function() { // handles this much: [open_paren] decimal [ plus|dot decimal ]... [close_paren] var ret = { value: 0, num: "" }; var tok = tokens.shift(); if (tok.token === '(') tok = tokens.shift(); while (1) { if (tok.type !== 'number') throw "Expected top number of meter"; ret.value += parseInt(tok.token); ret.num += tok.token; if (tokens.length === 0 || tokens[0].token === '/') return ret; tok = tokens.shift(); if (tok.token === ')') { if (tokens.length === 0 || tokens[0].token === '/') return ret; throw "Unexpected paren in meter"; } if (tok.token !== '.' && tok.token !== '+') throw "Expected top number of meter"; ret.num += tok.token; if (tokens.length === 0) throw "Expected top number of meter"; tok = tokens.shift(); } return ret; // just to suppress warning }; var parseFraction = function() { // handles this much: parseNum slash decimal var ret = parseNum(); if (tokens.length === 0) throw "Expected slash in meter"; var tok = tokens.shift(); if (tok.token !== '/') throw "Expected slash in meter"; tok = tokens.shift(); if (tok.type !== 'number') throw "Expected bottom number of meter"; ret.den = tok.token; ret.value = ret.value / parseInt(ret.den); return ret; }; if (tokens.length === 0) throw "Expected meter definition in M: line"; var meter = {type: 'specified', value: [ ]}; var totalLength = 0; while (1) { var ret = parseFraction(); totalLength += ret.value; meter.value.push({ num: ret.num, den: ret.den }); if (tokens.length === 0) break; var tok = tokens.shift(); if (tok.token !== '+') throw "Extra characters in M: line"; } if (multilineVars.havent_set_length === true) { multilineVars.default_length = totalLength < 0.75 ? 0.0625 : 0.125; } return meter; } catch (e) { warn(e, line, 0); } } return null; }; |
var setMeter = function(meter) { meter = tokenizer.stripComment(meter); if (meter === 'C') { | var setMeter = function(line) { line = tokenizer.stripComment(line); if (line === 'C') { | var setMeter = function(meter) { meter = tokenizer.stripComment(meter); if (meter === 'C') { multilineVars.meter = {type: 'common_time'}; multilineVars.havent_set_length = false; } else if (meter === 'C|') { multilineVars.meter = {type: 'cut_time'}; multilineVars.havent_set_length = false; } else if (meter.length === 0 || meter.toLowerCase() === 'none') multilineVars.meter = null; else { var a = meter.split('/'); if (a.length === 2) multilineVars.meter = {type: 'specified', num: a[0].strip(), den: a[1].strip()}; if (multilineVars.havent_set_length === true) { multilineVars.default_length = multilineVars.meter.num/multilineVars.meter.den < 0.75 ? 0.5 : 1; multilineVars.havent_set_length = false; } } }; |
multilineVars.havent_set_length = false; } else if (meter === 'C|') { | if (multilineVars.havent_set_length === true) multilineVars.default_length = 1; } else if (line === 'C|') { | var setMeter = function(meter) { meter = tokenizer.stripComment(meter); if (meter === 'C') { multilineVars.meter = {type: 'common_time'}; multilineVars.havent_set_length = false; } else if (meter === 'C|') { multilineVars.meter = {type: 'cut_time'}; multilineVars.havent_set_length = false; } else if (meter.length === 0 || meter.toLowerCase() === 'none') multilineVars.meter = null; else { var a = meter.split('/'); if (a.length === 2) multilineVars.meter = {type: 'specified', num: a[0].strip(), den: a[1].strip()}; if (multilineVars.havent_set_length === true) { multilineVars.default_length = multilineVars.meter.num/multilineVars.meter.den < 0.75 ? 0.5 : 1; multilineVars.havent_set_length = false; } } }; |
multilineVars.havent_set_length = false; } else if (meter.length === 0 || meter.toLowerCase() === 'none') | if (multilineVars.havent_set_length === true) multilineVars.default_length = 1; } else if (line.length === 0 || line.toLowerCase() === 'none') { | var setMeter = function(meter) { meter = tokenizer.stripComment(meter); if (meter === 'C') { multilineVars.meter = {type: 'common_time'}; multilineVars.havent_set_length = false; } else if (meter === 'C|') { multilineVars.meter = {type: 'cut_time'}; multilineVars.havent_set_length = false; } else if (meter.length === 0 || meter.toLowerCase() === 'none') multilineVars.meter = null; else { var a = meter.split('/'); if (a.length === 2) multilineVars.meter = {type: 'specified', num: a[0].strip(), den: a[1].strip()}; if (multilineVars.havent_set_length === true) { multilineVars.default_length = multilineVars.meter.num/multilineVars.meter.den < 0.75 ? 0.5 : 1; multilineVars.havent_set_length = false; } } }; |
var a = meter.split('/'); if (a.length === 2) multilineVars.meter = {type: 'specified', num: a[0].strip(), den: a[1].strip()}; | var tokens = tokenizer.tokenize(line, 0, line.length); try { var parseNum = function() { var ret = { value: 0, num: "" }; var tok = tokens.shift(); if (tok.token === '(') tok = tokens.shift(); while (1) { if (tok.type !== 'number') throw "Expected top number of meter"; ret.value += parseInt(tok.token); ret.num += tok.token; if (tokens.length === 0 || tokens[0].token === '/') return ret; tok = tokens.shift(); if (tok.token === ')') { if (tokens.length === 0 || tokens[0].token === '/') return ret; throw "Unexpected paren in meter"; } if (tok.token !== '.' && tok.token !== '+') throw "Expected top number of meter"; ret.num += tok.token; if (tokens.length === 0) throw "Expected top number of meter"; tok = tokens.shift(); } return ret; }; var parseFraction = function() { var ret = parseNum(); if (tokens.length === 0) throw "Expected slash in meter"; var tok = tokens.shift(); if (tok.token !== '/') throw "Expected slash in meter"; tok = tokens.shift(); if (tok.type !== 'number') throw "Expected bottom number of meter"; ret.den = tok.token; ret.value = ret.value / parseInt(ret.den); return ret; } if (tokens.length === 0) throw "Expected meter definition in M: line"; var meter = {type: 'specified', value: [ ]}; var totalLength = 0; while (1) { var ret = parseFraction(); totalLength += ret.value; meter.value.push({ num: ret.num, den: ret.den }); if (tokens.length === 0) break; tok = tokens.shift(); if (tok.token !== '+') throw "Extra characters in M: line"; } multilineVars.meter = meter; | var setMeter = function(meter) { meter = tokenizer.stripComment(meter); if (meter === 'C') { multilineVars.meter = {type: 'common_time'}; multilineVars.havent_set_length = false; } else if (meter === 'C|') { multilineVars.meter = {type: 'cut_time'}; multilineVars.havent_set_length = false; } else if (meter.length === 0 || meter.toLowerCase() === 'none') multilineVars.meter = null; else { var a = meter.split('/'); if (a.length === 2) multilineVars.meter = {type: 'specified', num: a[0].strip(), den: a[1].strip()}; if (multilineVars.havent_set_length === true) { multilineVars.default_length = multilineVars.meter.num/multilineVars.meter.den < 0.75 ? 0.5 : 1; multilineVars.havent_set_length = false; } } }; |
multilineVars.default_length = multilineVars.meter.num/multilineVars.meter.den < 0.75 ? 0.5 : 1; multilineVars.havent_set_length = false; | multilineVars.default_length = totalLength < 0.75 ? 0.5 : 1; | var setMeter = function(meter) { meter = tokenizer.stripComment(meter); if (meter === 'C') { multilineVars.meter = {type: 'common_time'}; multilineVars.havent_set_length = false; } else if (meter === 'C|') { multilineVars.meter = {type: 'cut_time'}; multilineVars.havent_set_length = false; } else if (meter.length === 0 || meter.toLowerCase() === 'none') multilineVars.meter = null; else { var a = meter.split('/'); if (a.length === 2) multilineVars.meter = {type: 'specified', num: a[0].strip(), den: a[1].strip()}; if (multilineVars.havent_set_length === true) { multilineVars.default_length = multilineVars.meter.num/multilineVars.meter.den < 0.75 ? 0.5 : 1; multilineVars.havent_set_length = false; } } }; |
} catch (e) { warn(e, line, 0); } | var setMeter = function(meter) { meter = tokenizer.stripComment(meter); if (meter === 'C') { multilineVars.meter = {type: 'common_time'}; multilineVars.havent_set_length = false; } else if (meter === 'C|') { multilineVars.meter = {type: 'cut_time'}; multilineVars.havent_set_length = false; } else if (meter.length === 0 || meter.toLowerCase() === 'none') multilineVars.meter = null; else { var a = meter.split('/'); if (a.length === 2) multilineVars.meter = {type: 'specified', num: a[0].strip(), den: a[1].strip()}; if (multilineVars.havent_set_length === true) { multilineVars.default_length = multilineVars.meter.num/multilineVars.meter.den < 0.75 ? 0.5 : 1; multilineVars.havent_set_length = false; } } }; |
|
if (popupContainer === undefined || popupContainer == null) return; | setMRUdatabases: function() { //return; // alert("set"); // get the popup menu for this list of logins and subgroups // var container = this._currentWindow.document.getElementById("KeeFox_ChangeDB-Button"); var popupContainer = this._currentWindow.document.getElementById("KeeFox_ChangeDB-Popup"); // Remove all of the existing buttons for (i = popupContainer.childNodes.length; i > 0; i--) { popupContainer.removeChild(popupContainer.childNodes[0]); } var mruArray = this._currentWindow.keeFoxInst.getAllDatabaseFileNames(); if (mruArray == null || mruArray.length == 0) { var noItemsButton = null; noItemsButton = this._currentWindow.document.createElement("menuitem"); noItemsButton.setAttribute("label", this.strbundle.getString("changeDBButtonEmpty.label")); noItemsButton.setAttribute("disabled", "true"); noItemsButton.setAttribute("tooltiptext", this.strbundle.getString("changeDBButtonEmpty.tip")); popupContainer.appendChild(noItemsButton); return; } else { for (i = 0; i < mruArray.length; i++) { var tempButton = null; tempButton = this._currentWindow.document.createElement("menuitem"); tempButton.setAttribute("label", mruArray[i]); tempButton.setAttribute("tooltiptext", this.strbundle.getString("changeDBButtonListItem.tip")); tempButton.setAttribute("oncommand", "keeFoxInst.changeDatabase('" + mruArray[i].replace(/[\\]/g,'\\\\') + "',false); event.stopPropagation();"); tempButton.setAttribute("class", "menuitem-iconic"); //tempButton.setAttribute("context", "KeeFox-login-context"); in future this could enable "set to default for this location..." etc. ? tempButton.setAttribute("image", "chrome://mozapps/skin/passwordmgr/key.png"); //TODO: use KeePass database icon popupContainer.appendChild(tempButton); } } }, |
|
d.offset.initialize=d.noop},bodyOffset:function(a){var b=a.offsetTop,e=a.offsetLeft;d.offset.initialize();if(d.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(d.curCSS(a,"marginTop",true))||0;e+=parseFloat(d.curCSS(a,"marginLeft",true))||0}return{top:b,left:e}},setOffset:function(a,b,e){if(/static/.test(d.curCSS(a,"position")))a.style.position="relative";var g=d(a),h=g.offset(),k=parseInt(d.curCSS(a,"top",true),10)||0,l=parseInt(d.curCSS(a,"left",true),10)||0;if(d.isFunction(b))b=b.call(a, e,h);e={top:b.top-h.top+k,left:b.left-h.left+l};"using"in b?b.using.call(a,e):g.css(e)}};d.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),e=this.offset(),g=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();e.top-=parseFloat(d.curCSS(a,"marginTop",true))||0;e.left-=parseFloat(d.curCSS(a,"marginLeft",true))||0;g.top+=parseFloat(d.curCSS(b[0],"borderTopWidth",true))||0;g.left+=parseFloat(d.curCSS(b[0],"borderLeftWidth",true))||0;return{top:e.top- | c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,e=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;e+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:e}},setOffset:function(a,b,e){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),h=f.offset(),k=parseInt(c.curCSS(a,"top",true),10)||0,l=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a, e,h);e={top:b.top-h.top+k,left:b.left-h.left+l};"using"in b?b.using.call(a,e):f.css(e)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),e=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();e.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;e.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:e.top- | d.offset.initialize=d.noop},bodyOffset:function(a){var b=a.offsetTop,e=a.offsetLeft;d.offset.initialize();if(d.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(d.curCSS(a,"marginTop",true))||0;e+=parseFloat(d.curCSS(a,"marginLeft",true))||0}return{top:b,left:e}},setOffset:function(a,b,e){if(/static/.test(d.curCSS(a,"position")))a.style.position="relative";var g=d(a),h=g.offset(),k=parseInt(d.curCSS(a,"top",true),10)||0,l=parseInt(d.curCSS(a,"left",true),10)||0;if(d.isFunction(b))b=b.call(a,e,h);e={top:b.top-h.top+k,left:b.left-h.left+l};"using"in b?b.using.call(a,e):g.css(e)}};d.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),e=this.offset(),g=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();e.top-=parseFloat(d.curCSS(a,"marginTop",true))||0;e.left-=parseFloat(d.curCSS(a,"marginLeft",true))||0;g.top+=parseFloat(d.curCSS(b[0],"borderTopWidth",true))||0;g.left+=parseFloat(d.curCSS(b[0],"borderLeftWidth",true))||0;return{top:e.top- |