128 skills found · Page 2 of 5
adamwiggins / QfeedreaderA web-based feed reader, comparing queueing with Delayed::Job, Minion, and Stalker
joenali / Waterfallwaterfall } $("body").addClass("noscroll"); c.show(); g = e.outerHeight(); e.css("margin-bottom", "-" + g / 2 + "px"); setTimeout(function() { c.addClass("visible"); c.css("-webkit-transform", "none") }, 1); this.trigger("show", b); return false }, close: function(b) { var c = $("#" + b); c.data("parent") && c.data("parent").append(c); $("#zoomScroll").length === 0 && $("body").removeClass("noscroll"); c.removeClass("visible"); setTimeout(function() { c.hide(); c.css("-webkit-transform", "translateZ(0)") }, 251); this.trigger("close", b); return false } }; _.extend(Modal, Backbone.Events); var Arrays = { conjunct: function(b) { if (b.length == 1) return b[0]; else { b = b.slice(0); last = b.pop(); b.push("and " + last); return b.join(", ") } } }; $(document).ready(function() { ScrollToTop.setup(); Modal.setup(); $(".tipsyHover").tipsy({ gravity: "n", delayIn: 0.1, delayOut: 0.1, opacity: 0.7, live: true, html: true }); $("#query").focus(function() { cache && $(this).catcomplete("search", $(this).val()) }); $.widget("custom.catcomplete", $.ui.autocomplete, { _renderMenu: function(c, e) { var g = this, f = ""; $.each(e, function(d, h) { if (h.category != f) { c.append("<li class='ui-autocomplete-category'>" + h.category + "</li>"); f = h.category } g._renderItem(c, h) }); e = { link: "/search/?q=" + this.term }; $("<li></li>").data("item.autocomplete", e).append("<a href='/search/?q=" + this.term + "' class='ui-corner-all' tabindex='-1' style='font-weight:bold; min-height:0 !important;'>Search for " + this.term + "</a>").appendTo(c) } }); var b = $("#query").catcomplete({ source: function(c, e) { Tagging.getFriends(c, function(g) { var f = g; if (myboards) { f = tagmate.filter_options(myboards, c.term); f = g.concat(f) } for (g = 0; g < f.length; g++) f[g].value = f[g].label; e(f) }) }, minLength: 1, delay: 0, appendTo: "#SearchAutocompleteHolder", select: function(c, e) { document.location.href = e.item.link } }); if (typeof b.data("catcomplete") != "undefined") b.data("catcomplete")._renderItem = function(c, e) { var g = "<a href='" + e.link + "'><img src='" + e.image + "' class='AutocompletePhoto' alt='Photo of " + e.label + "' width='38px' height='38px'/><span class='AutocompleteName'>" + e.label + "</span></a>"; return $("<li></li>").data("item.autocomplete", e).append(g).appendTo(c) }; $("#query").defaultValue($("#query").attr("placeholder"), "default_value"); $("#Search #query_button").click(function() { $("#Search form").submit(); return false }); $("body").on("click", "a[rel=nofollow]", function(c) { var e = $(this).attr("href"); if (e === "#") return c.isDefaultPrevented(); if (!e.match(/^(http|https):\/\//) || e.match(/(http:\/\/|https:\/\/|\.)pinterest\.com\//gi) || $(this).hasClass("safelink")) return true; c = (c = $(this).parents(".pin").attr("data-id") || $(this).parents(".pin").attr("pin-id") || $(this).attr("data-id")) ? "&pin=" + c: ""; var g = $(this).parents(".comment").attr("comment-id"); g = g ? "&comment_id=" + g: ""; var f = (new jsSHA(getCookie("csrftoken"), "ASCII")).getHash("HEX"); window.open("//" + window.location.host + "/offsite/?url=" + encodeURIComponent(e) + "&shatoken=" + f + c + g); return false }) }); Twitter = new(function() { var b = this; this.startTwitterConnect = function() { b._twitterWindow = window.open("/connect/twitter/", "Pinterest", "location=0,status=0,width=800,height=400"); b._twitterInterval = window.setInterval(b.completeTwitterConnect, 1E3) }; this.completeTwitterConnect = function() { if (b._twitterWindow.closed) { window.clearInterval(b._twitterInterval); window.location.reload() } } }); Facebook = new(function() { var b = this; this.startFacebookConnect = function(c, e, g, f) { g = g == undefined ? true: g; var d = "/connect/facebook/", h = "?"; if (c) { d += h + "scope=" + c; h = "&" } if (e) { d += h + "enable_timeline=1"; h = "&" } if (f) d += h + "ref_page=" + f; b._facebookWindow = window.open(d, "Pinterest", "location=0,status=0,width=800,height=400"); if (g) b._facebookInterval = window.setInterval(this.completeFacebookConnect, 1E3) }; this.completeFacebookConnect = function() { if (b._facebookWindow.closed) { window.clearInterval(b._facebookInterval); window.location.reload() } } }); Google = new(function() { var b = this; this.startGoogleConnect = function() { b._googleWindow = window.open("/connect/google/", "Google", "location=0,status=0,width=800,height=400"); b._googleInterval = window.setInterval(b.completeGoogleConnect, 1E3) }; this.completeGoogleConnect = function() { if (b._googleWindow.closed) { window.clearInterval(b._googleInterval); window.location.reload() } } }); Yahoo = new(function() { var b = this; this.startYahooConnect = function() { b._yahooWindow = window.open("/connect/yahoo/", "Yahoo", "location=0,status=0,width=800,height=400"); b._yahooInterval = window.setInterval(b.completeYahooConnect, 1E3) }; this.completeYahooConnect = function() { if (b._yahooWindow.closed) { window.clearInterval(b._yahooInterval); window.location.reload() } } }); (function(b) { function c(g) { return typeof g == "object" ? g: { top: g, left: g } } var e = b.scrollTo = function(g, f, d) { b(window).scrollTo(g, f, d) }; e.defaults = { axis: "xy", duration: parseFloat(b.fn.jquery) >= 1.3 ? 0 : 1 }; e.window = function() { return b(window)._scrollable() }; b.fn._scrollable = function() { return this.map(function() { var g = this; if (! (!g.nodeName || b.inArray(g.nodeName.toLowerCase(), ["iframe", "#document", "html", "body"]) != -1)) return g; g = (g.contentWindow || g).document || g.ownerDocument || g; return b.browser.safari || g.compatMode == "BackCompat" ? g.body: g.documentElement }) }; b.fn.scrollTo = function(g, f, d) { if (typeof f == "object") { d = f; f = 0 } if (typeof d == "function") d = { onAfter: d }; if (g == "max") g = 9E9; d = b.extend({}, e.defaults, d); f = f || d.speed || d.duration; d.queue = d.queue && d.axis.length > 1; if (d.queue) f /= 2; d.offset = c(d.offset); d.over = c(d.over); return this._scrollable().each(function() { function h(m) { k.animate(u, f, d.easing, m && function() { m.call(this, g, d) }) } var j = this, k = b(j), l = g, r, u = {}, o = k.is("html,body"); switch (typeof l) { case "number": case "string": if (/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(l)) { l = c(l); break } l = b(l, this); case "object": if (l.is || l.style) r = (l = b(l)).offset() } b.each(d.axis.split(""), function(m, q) { var v = q == "x" ? "Left": "Top", w = v.toLowerCase(), B = "scroll" + v, D = j[B], I = e.max(j, q); if (r) { u[B] = r[w] + (o ? 0 : D - k.offset()[w]); if (d.margin) { u[B] -= parseInt(l.css("margin" + v)) || 0; u[B] -= parseInt(l.css("border" + v + "Width")) || 0 } u[B] += d.offset[w] || 0; if (d.over[w]) u[B] += l[q == "x" ? "width": "height"]() * d.over[w] } else { q = l[w]; u[B] = q.slice && q.slice( - 1) == "%" ? parseFloat(q) / 100 * I: q } if (/^\d+$/.test(u[B])) u[B] = u[B] <= 0 ? 0 : Math.min(u[B], I); if (!m && d.queue) { D != u[B] && h(d.onAfterFirst); delete u[B] } }); h(d.onAfter) }).end() }; e.max = function(g, f) { var d = f == "x" ? "Width": "Height"; f = "scroll" + d; if (!b(g).is("html,body")) return g[f] - b(g)[d.toLowerCase()](); d = "client" + d; var h = g.ownerDocument.documentElement; g = g.ownerDocument.body; return Math.max(h[f], g[f]) - Math.min(h[d], g[d]) } })(jQuery); (function() { jQuery.each({ getSelection: function() { var b = this.jquery ? this[0] : this; return ("selectionStart" in b && function() { var c = b.selectionEnd - b.selectionStart; return { start: b.selectionStart, end: b.selectionEnd, length: c, text: b.value.substr(b.selectionStart, c) } } || document.selection && function() { b.focus(); var c = document.selection.createRange(); if (c == null) return { start: 0, end: b.value.length, length: 0 }; var e = b.createTextRange(), g = e.duplicate(); e.moveToBookmark(c.getBookmark()); g.setEndPoint("EndToStart", e); var f = g.text.length, d = f; for (e = 0; e < f; e++) g.text.charCodeAt(e) == 13 && d--; f = g = c.text.length; for (e = 0; e < g; e++) c.text.charCodeAt(e) == 13 && f--; return { start: d, end: d + f, length: f, text: c.text } } || function() { return { start: 0, end: b.value.length, length: 0 } })() }, setSelection: function(b, c) { var e = this.jquery ? this[0] : this, g = b || 0, f = c || 0; return ("selectionStart" in e && function() { e.focus(); e.selectionStart = g; e.selectionEnd = f; return this } || document.selection && function() { e.focus(); var d = e.createTextRange(), h = g; for (i = 0; i < h; i++) if (e.value[i].search(/[\r\n]/) != -1) g -= 0.5; h = f; for (i = 0; i < h; i++) if (e.value[i].search(/[\r\n]/) != -1) f -= 0.5; d.moveEnd("textedit", -1); d.moveStart("character", g); d.moveEnd("character", f - g); d.select(); return this } || function() { return this })() }, replaceSelection: function(b) { var c = this.jquery ? this[0] : this, e = b || ""; return ("selectionStart" in c && function() { c.value = c.value.substr(0, c.selectionStart) + e + c.value.substr(c.selectionEnd, c.value.length); return this } || document.selection && function() { c.focus(); document.selection.createRange().text = e; return this } || function() { c.value += e; return this })() } }, function(b) { jQuery.fn[b] = this }) })(); var tagmate = tagmate || { USER_TAG_EXPR: "@\\w+(?: \\w*)?", HASH_TAG_EXPR: "#\\w+", USD_TAG_EXPR: "\\$(?:(?:\\d{1,3}(?:\\,\\d{3})+)|(?:\\d+))(?:\\.\\d{2})?", GBP_TAG_EXPR: "\\\u00a3(?:(?:\\d{1,3}(?:\\,\\d{3})+)|(?:\\d+))(?:\\.\\d{2})?", filter_options: function(b, c) { for (var e = [], g = 0; g < b.length; g++) { var f = b[g].label.toLowerCase(), d = c.toLowerCase(); d.length <= f.length && f.indexOf(d) == 0 && e.push(b[g]) } return e }, sort_options: function(b) { return b.sort(function(c, e) { c = c.label.toLowerCase(); e = e.label.toLowerCase(); if (c > e) return 1; else if (c < e) return - 1; return 0 }) } }; (function(b) { function c(d, h, j) { d = d.substring(j || 0).search(h); return d >= 0 ? d + (j || 0) : d } function e(d) { return d.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&") } function g(d, h, j) { var k = {}; for (tok in h) if (j && j[tok]) { var l = {}, r = {}; for (key in j[tok]) { var u = j[tok][key].value, o = j[tok][key].label, m = e(tok + o), q = ["(?:^(", ")$|^(", ")\\W|\\W(", ")\\W|\\W(", ")$)"].join(m), v = 0; for (q = new RegExp(q, "gm"); (v = c(d.val(), q, v)) > -1;) { var w = r[v] ? r[v] : null; if (!w || l[w].length < o.length) r[v] = u; l[u] = o; v += o.length + 1 } } for (v in r) k[tok + r[v]] = tok } else { l = null; for (q = new RegExp("(" + h[tok] + ")", "gm"); l = q.exec(d.val());) k[l[1]] = tok } d = []; for (m in k) d.push(m); return d } var f = { "@": tagmate.USER_TAG_EXPR, "#": tagmate.HASH_TAG_EXPR, $: tagmate.USD_TAG_EXPR, "\u00a3": tagmate.GBP_TAG_EXPR }; b.fn.extend({ getTags: function(d, h) { var j = b(this); d = d || j.data("_tagmate_tagchars"); h = h || j.data("_tagmate_sources"); return g(j, d, h) }, tagmate: function(d) { function h(o, m, q) { for (m = new RegExp("[" + m + "]"); q >= 0 && !m.test(o[q]); q--); return q } function j(o) { var m = o.val(), q = o.getSelection(), v = -1; o = null; for (tok in u.tagchars) { var w = h(m, tok, q.start); if (w > v) { v = w; o = tok } } m = m.substring(v + 1, q.start); if ((new RegExp("^" + u.tagchars[o])).exec(o + m)) return o + m; return null } function k(o, m, q) { var v = o.val(), w = o.getSelection(); w = h(v, m[0], w.start); var B = v.substr(0, w); v = v.substr(w + m.length); o.val(B + m[0] + q + v); v = w + q.length + 1; o.setSelection(v, v); u.replace_tag && u.replace_tag(m, q) } function l(o, m) { m = tagmate.sort_options(m); for (var q = 0; q < m.length; q++) { var v = m[q].label, w = m[q].image; q == 0 && o.html(""); var B = "<span>" + v + "</span>"; if (w) B = "<img src='" + w + "' alt='" + v + "'/>" + B; v = u.menu_option_class; if (q == 0) v += " " + u.menu_option_active_class; o.append("<div class='" + v + "'>" + B + "</div>") } } function r(o, m) { var q = m == "down" ? ":first-child": ":last-child", v = m == "down" ? "next": "prev"; m = o.children("." + u.menu_option_active_class); if (m.length == 0) m = o.children(q); else { m.removeClass(u.menu_option_active_class); m = m[v]().length > 0 ? m[v]() : m } m.addClass(u.menu_option_active_class); v = o.children(); var w = Math.floor(b(o).height() / b(v[0]).height()) - 1; if (b(o).height() % b(v[0]).height() > 0) w -= 1; for (q = 0; q < v.length && b(v[q]).html() != b(m).html(); q++); q > w && q - w >= 0 && q - w < v.length && o.scrollTo(v[q - w]) } var u = { tagchars: f, sources: null, capture_tag: null, replace_tag: null, menu: null, menu_class: "tagmate-menu", menu_option_class: "tagmate-menu-option", menu_option_active_class: "tagmate-menu-option-active" }; return this.each(function() { function o() { w.hide(); var D = j(m); if (D) { var I = D[0], p = D.substr(1), n = m.getSelection(), z = h(m.val(), I, n.start); n.start - z <= D.length && function(A) { if (typeof u.sources[I] === "object") A(tagmate.filter_options(u.sources[I], p)); else typeof u.sources[I] === "function" ? u.sources[I]({ term: p }, A) : A() } (function(A) { if (A && A.length > 0) { l(w, A); w.css("top", m.outerHeight() - 1 + "px"); w.show(); for (var E = m.data("_tagmate_sources"), F = 0; F < A.length; F++) { for (var Q = false, H = 0; ! Q && H < E[I].length; H++) Q = E[I][H].value == A[F].value; Q || E[I].push(A[F]) } } D && u.capture_tag && u.capture_tag(D) }) } } d && b.extend(u, d); var m = b(this); m.data("_tagmate_tagchars", u.tagchars); var q = {}; for (var v in u.sources) q[v] = []; m.data("_tagmate_sources", q); var w = u.menu; if (!w) { w = b("<div class='" + u.menu_class + "'></div>"); m.after(w) } m.offset(); w.css("position", "absolute"); w.hide(); var B = false; b(m).unbind(".tagmate").bind("focus.tagmate", function() { o() }).bind("blur.tagmate", function() { setTimeout(function() { w.hide() }, 300) }).bind("click.tagmate", function() { o() }).bind("keydown.tagmate", function(D) { if (w.is(":visible")) if (D.keyCode == 40) { r(w, "down"); B = true; return false } else if (D.keyCode == 38) { r(w, "up"); B = true; return false } else if (D.keyCode == 13) { D = w.children("." + u.menu_option_active_class).text(); var I = j(m); if (I && D) { k(m, I, D); w.hide(); B = true; return false } } else if (D.keyCode == 27) { w.hide(); B = true; return false } }).bind("keyup.tagmate", function() { if (B) { B = false; return true } o() }); b("." + u.menu_class + " ." + u.menu_option_class).die("click.tagmate").live("click.tagmate", function() { var D = b(this).text(), I = j(m); k(m, I, D); w.hide(); B = true; return false }) }) } }) })(jQuery); (function(b) { function c(f) { var d; if (f && f.constructor == Array && f.length == 3) return f; if (d = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(f)) return [parseInt(d[1]), parseInt(d[2]), parseInt(d[3])]; if (d = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(f)) return [parseFloat(d[1]) * 2.55, parseFloat(d[2]) * 2.55, parseFloat(d[3]) * 2.55]; if (d = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(f)) return [parseInt(d[1], 16), parseInt(d[2], 16), parseInt(d[3], 16)]; if (d = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(f)) return [parseInt(d[1] + d[1], 16), parseInt(d[2] + d[2], 16), parseInt(d[3] + d[3], 16)]; return g[b.trim(f).toLowerCase()] } function e(f, d) { var h; do { h = b.curCSS(f, d); if (h != "" && h != "transparent" || b.nodeName(f, "body")) break; d = "backgroundColor" } while ( f = f . parentNode ); return c(h) } b.each(["backgroundColor", "borderBottomColor", "borderLeftColor", "borderRightColor", "borderTopColor", "color", "outlineColor"], function(f, d) { b.fx.step[d] = function(h) { if (h.state == 0) { h.start = e(h.elem, d); h.end = c(h.end) } h.elem.style[d] = "rgb(" + [Math.max(Math.min(parseInt(h.pos * (h.end[0] - h.start[0]) + h.start[0]), 255), 0), Math.max(Math.min(parseInt(h.pos * (h.end[1] - h.start[1]) + h.start[1]), 255), 0), Math.max(Math.min(parseInt(h.pos * (h.end[2] - h.start[2]) + h.start[2]), 255), 0)].join(",") + ")" } }); var g = { aqua: [0, 255, 255], azure: [240, 255, 255], beige: [245, 245, 220], black: [0, 0, 0], blue: [0, 0, 255], brown: [165, 42, 42], cyan: [0, 255, 255], darkblue: [0, 0, 139], darkcyan: [0, 139, 139], darkgrey: [169, 169, 169], darkgreen: [0, 100, 0], darkkhaki: [189, 183, 107], darkmagenta: [139, 0, 139], darkolivegreen: [85, 107, 47], darkorange: [255, 140, 0], darkorchid: [153, 50, 204], darkred: [139, 0, 0], darksalmon: [233, 150, 122], darkviolet: [148, 0, 211], fuchsia: [255, 0, 255], gold: [255, 215, 0], green: [0, 128, 0], indigo: [75, 0, 130], khaki: [240, 230, 140], lightblue: [173, 216, 230], lightcyan: [224, 255, 255], lightgreen: [144, 238, 144], lightgrey: [211, 211, 211], lightpink: [255, 182, 193], lightyellow: [255, 255, 224], lime: [0, 255, 0], magenta: [255, 0, 255], maroon: [128, 0, 0], navy: [0, 0, 128], olive: [128, 128, 0], orange: [255, 165, 0], pink: [255, 192, 203], purple: [128, 0, 128], violet: [128, 0, 128], red: [255, 0, 0], silver: [192, 192, 192], white: [255, 255, 255], yellow: [255, 255, 0] } })(jQuery); jQuery.cookie = function(b, c, e) { if (arguments.length > 1 && String(c) !== "[object Object]") { e = jQuery.extend({}, e); if (c === null || c === undefined) e.expires = -1; if (typeof e.expires === "number") { var g = e.expires, f = e.expires = new Date; f.setDate(f.getDate() + g) } c = String(c); return document.cookie = [encodeURIComponent(b), "=", e.raw ? c: encodeURIComponent(c), e.expires ? "; expires=" + e.expires.toUTCString() : "", e.path ? "; path=" + e.path: "", e.domain ? "; domain=" + e.domain: "", e.secure ? "; secure": ""].join("") } e = c || {}; f = e.raw ? function(d) { return d }: decodeURIComponent; return (g = (new RegExp("(?:^|; )" + encodeURIComponent(b) + "=([^;]*)")).exec(document.cookie)) ? f(g[1]) : null }; if (!window.JSON) window.JSON = {}; (function() { function b(r) { return r < 10 ? "0" + r: r } function c(r) { d.lastIndex = 0; return d.test(r) ? '"' + r.replace(d, function(u) { var o = k[u]; return typeof o === "string" ? o: "\\u" + ("0000" + u.charCodeAt(0).toString(16)).slice( - 4) }) + '"': '"' + r + '"' } function e(r, u) { var o, m, q = h, v, w = u[r]; if (w && typeof w === "object" && typeof w.toJSON === "function") w = w.toJSON(r); if (typeof l === "function") w = l.call(u, r, w); switch (typeof w) { case "string": return c(w); case "number": return isFinite(w) ? String(w) : "null"; case "boolean": case "null": return String(w); case "object": if (!w) return "null"; h += j; v = []; if (Object.prototype.toString.apply(w) === "[object Array]") { m = w.length; for (r = 0; r < m; r += 1) v[r] = e(r, w) || "null"; u = v.length === 0 ? "[]": h ? "[\n" + h + v.join(",\n" + h) + "\n" + q + "]": "[" + v.join(",") + "]"; h = q; return u } if (l && typeof l === "object") { m = l.length; for (r = 0; r < m; r += 1) { o = l[r]; if (typeof o === "string") if (u = e(o, w)) v.push(c(o) + (h ? ": ": ":") + u) } } else { for (o in w) if (Object.hasOwnProperty.call(w, o)) if (u = e(o, w)) { v.push(c(o) + (h ? ": ": ":") + u); } } u = v.length === 0 ? "{}": h ? "{\n" + h + v.join(",\n" + h) + "\n" + q + "}": "{" + v.join(",") + "}"; h = q; return u } } if (typeof Date.prototype.toJSON !== "function") { Date.prototype.toJSON = function() { return isFinite(this.valueOf()) ? this.getUTCFullYear() + "-" + b(this.getUTCMonth() + 1) + "-" + b(this.getUTCDate()) + "T" + b(this.getUTCHours()) + ":" + b(this.getUTCMinutes()) + ":" + b(this.getUTCSeconds()) + "Z": null }; String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function() { return this.valueOf() } } var g = window.JSON, f = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, d = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, h, j, k = { "\u0008": "\\b", "\t": "\\t", "\n": "\\n", "\u000c": "\\f", "\r": "\\r", '"': '\\"', "\\": "\\\\" }, l; if (typeof g.stringify !== "function") g.stringify = function(r, u, o) { var m; j = h = ""; if (typeof o === "number") for (m = 0; m < o; m += 1) j += " "; else if (typeof o === "string") j = o; if ((l = u) && typeof u !== "function" && (typeof u !== "object" || typeof u.length !== "number")) throw new Error("JSON.stringify"); return e("", { "": r }) }; if (typeof g.parse !== "function") g.parse = function(r, u) { function o(m, q) { var v, w, B = m[q]; if (B && typeof B === "object") for (v in B) if (Object.hasOwnProperty.call(B, v)) { w = o(B, v); if (w !== undefined) B[v] = w; else delete B[v] } return u.call(m, q, B) } r = String(r); f.lastIndex = 0; if (f.test(r)) r = r.replace(f, function(m) { return "\\u" + ("0000" + m.charCodeAt(0).toString(16)).slice( - 4) }); if (/^[\],:{}\s]*$/.test(r.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]").replace(/(?:^|:|,)(?:\s*\[)+/g, ""))) { r = eval("(" + r + ")"); return typeof u === "function" ? o({ "": r }, "") : r } throw new SyntaxError("JSON.parse"); } })(); (function() { var b = function(o) { var m = [], q = o.length * 8, v; for (v = 0; v < q; v += 8) m[v >> 5] |= (o.charCodeAt(v / 8) & 255) << 24 - v % 32; return m }, c = function(o) { var m = [], q = o.length, v, w; for (v = 0; v < q; v += 2) { w = parseInt(o.substr(v, 2), 16); if (isNaN(w)) return "INVALID HEX STRING"; else m[v >> 3] |= w << 24 - 4 * (v % 8) } return m }, e = function(o) { var m = "", q = o.length * 4, v, w; for (v = 0; v < q; v += 1) { w = o[v >> 2] >> (3 - v % 4) * 8; m += "0123456789abcdef".charAt(w >> 4 & 15) + "0123456789abcdef".charAt(w & 15) } return m }, g = function(o) { var m = "", q = o.length * 4, v, w, B; for (v = 0; v < q; v += 3) { B = (o[v >> 2] >> 8 * (3 - v % 4) & 255) << 16 | (o[v + 1 >> 2] >> 8 * (3 - (v + 1) % 4) & 255) << 8 | o[v + 2 >> 2] >> 8 * (3 - (v + 2) % 4) & 255; for (w = 0; w < 4; w += 1) m += v * 8 + w * 6 <= o.length * 32 ? "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(B >> 6 * (3 - w) & 63) : "" } return m }, f = function(o, m) { return o << m | o >>> 32 - m }, d = function(o, m, q) { return o ^ m ^ q }, h = function(o, m, q) { return o & m ^ ~o & q }, j = function(o, m, q) { return o & m ^ o & q ^ m & q }, k = function(o, m) { var q = (o & 65535) + (m & 65535); return ((o >>> 16) + (m >>> 16) + (q >>> 16) & 65535) << 16 | q & 65535 }, l = function(o, m, q, v, w) { var B = (o & 65535) + (m & 65535) + (q & 65535) + (v & 65535) + (w & 65535); return ((o >>> 16) + (m >>> 16) + (q >>> 16) + (v >>> 16) + (w >>> 16) + (B >>> 16) & 65535) << 16 | B & 65535 }, r = function(o, m) { var q = [], v, w, B, D, I, p, n, z, A = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], E = [1518500249, 1518500249, 1518500249, 1518500249, 1518500249, 1518500249, 1518500249, 1518500249, 1518500249, 1518500249, 1518500249, 1518500249, 1518500249, 1518500249, 1518500249, 1518500249, 1518500249, 1518500249, 1518500249, 1518500249, 1859775393, 1859775393, 1859775393, 1859775393, 1859775393, 1859775393, 1859775393, 1859775393, 1859775393, 1859775393, 1859775393, 1859775393, 1859775393, 1859775393, 1859775393, 1859775393, 1859775393, 1859775393, 1859775393, 1859775393, 2400959708, 2400959708, 2400959708, 2400959708, 2400959708, 2400959708, 2400959708, 2400959708, 2400959708, 2400959708, 2400959708, 2400959708, 2400959708, 2400959708, 2400959708, 2400959708, 2400959708, 2400959708, 2400959708, 2400959708, 3395469782, 3395469782, 3395469782, 3395469782, 3395469782, 3395469782, 3395469782, 3395469782, 3395469782, 3395469782, 3395469782, 3395469782, 3395469782, 3395469782, 3395469782, 3395469782, 3395469782, 3395469782, 3395469782, 3395469782]; o[m >> 5] |= 128 << 24 - m % 32; o[(m + 65 >> 9 << 4) + 15] = m; z = o.length; for (p = 0; p < z; p += 16) { m = A[0]; v = A[1]; w = A[2]; B = A[3]; D = A[4]; for (n = 0; n < 80; n += 1) { q[n] = n < 16 ? o[n + p] : f(q[n - 3] ^ q[n - 8] ^ q[n - 14] ^ q[n - 16], 1); I = n < 20 ? l(f(m, 5), h(v, w, B), D, E[n], q[n]) : n < 40 ? l(f(m, 5), d(v, w, B), D, E[n], q[n]) : n < 60 ? l(f(m, 5), j(v, w, B), D, E[n], q[n]) : l(f(m, 5), d(v, w, B), D, E[n], q[n]); D = B; B = w; w = f(v, 30); v = m; m = I } A[0] = k(m, A[0]); A[1] = k(v, A[1]); A[2] = k(w, A[2]); A[3] = k(B, A[3]); A[4] = k(D, A[4]) } return A }, u = function(o, m) { this.strToHash = this.strBinLen = this.sha1 = null; if ("HEX" === m) { if (0 !== o.length % 2) return "TEXT MUST BE IN BYTE INCREMENTS"; this.strBinLen = o.length * 4; this.strToHash = c(o) } else if ("ASCII" === m || "undefined" === typeof m) { this.strBinLen = o.length * 8; this.strToHash = b(o) } else return "UNKNOWN TEXT INPUT TYPE" }; u.prototype = { getHash: function(o) { var m = null, q = this.strToHash.slice(); switch (o) { case "HEX": m = e; break; case "B64": m = g; break; default: return "FORMAT NOT RECOGNIZED" } if (null === this.sha1) this.sha1 = r(q, this.strBinLen); return m(this.sha1) }, getHMAC: function(o, m, q) { var v; v = []; var w = []; switch (q) { case "HEX": q = e; break; case "B64": q = g; break; default: return "FORMAT NOT RECOGNIZED" } if ("HEX" === m) { if (0 !== o.length % 2) return "KEY MUST BE IN BYTE INCREMENTS"; m = c(o); o = o.length * 4 } else if ("ASCII" === m) { m = b(o); o = o.length * 8 } else return "UNKNOWN KEY INPUT TYPE"; if (64 < o / 8) { m = r(m, o); m[15] &= 4294967040 } else if (64 > o / 8) m[15] &= 4294967040; for (o = 0; o <= 15; o += 1) { v[o] = m[o] ^ 909522486; w[o] = m[o] ^ 1549556828 } v = r(v.concat(this.strToHash), 512 + this.strBinLen); v = r(w.concat(v), 672); return q(v) } }; window.jsSHA = u })(); var Router = function() { var b; if (!window.history.pushState) return null; b = new Backbone.Router({ routes: { "pin/:pinID/": "zoom", "pin/:pinID/repin/": "repin", ".*": "other" } }); Backbone.history.start({ pushState: true, silent: true }); return b } (); var BoardLayout = function() { return { setup: function(b) { if (!this.setupComplete) { this.setupFlow(); $(function() { if (window.userIsAuthenticated) { Like.gridListeners(); Follow.listeners(); Comment.gridComment(); RepinDialog2.setup() } Zoom.setup() }); this.center = !!b; this.setupComplete = true } }, setupFlow: function(b) { if (!this.flowSetupComplete) { BoardLayout.allPins(); b || $(window).resize(_.throttle(function() { BoardLayout.allPins() }, 200)); this.flowSetupComplete = true } }, pinsContainer: ".BoardLayout", pinArray: [], orderedPins: [], mappedPins: {}, nextPin: function(b) { b = this.orderedPins.indexOf(b) + 1; if (b >= this.orderedPins.length) return 0; return this.orderedPins[b] }, previousPin: function(b) { b = this.orderedPins.indexOf(b) - 1; if (b >= this.orderedPins.length) return 0; return this.orderedPins[b] }, columnCount: 4, columns: 0, columnWidthInner: 192, columnMargin: 15, columnPadding: 30, columnContainerWidth: 0, allPins: function() { var b = $(this.pinsContainer + " .pin"), c = this.getContentArea(); this.columnWidthOuter = this.columnWidthInner + this.columnMargin + this.columnPadding; this.columns = Math.max(this.columnCount, parseInt(c / this.columnWidthOuter, 10)); if (b.length < this.columns) this.columns = Math.max(this.columnCount, b.length); c = this.columnWidthOuter * this.columns - this.columnMargin; var e = document.getElementById("wrapper"); if (e) e.style.width = c + "px"; $(".LiquidContainer").css("width", c + "px"); for (c = 0; c < this.columns; c++) this.pinArray[c] = 0; document.getElementById("SortableButtons") ? this.showPins() : this.flowPins(b, true); if ($("#ColumnContainer .pin").length === 0 && window.location.pathname === "/") { $("#ColumnContainer").addClass("empty"); setTimeout(function() { window.location.reload() }, 5E3) } }, newPins: function() { var b = window.jQuery ? ":last": ":last-of-type", c = $(this.pinsContainer + b + " .pin"); c = c.length > 0 ? c: $(this.pinsContainer + b + " .pin"); this.flowPins(c) }, flowPins: function(b, c) { if (c) { this.mappedPins = {}; this.orderedPins = [] } if (this.pinArray.length > this.columns) this.pinArray = this.pinArray.slice(0, this.columns); for (c = 0; c < b.length; c++) this.positionPin(b[c]); this.updateContainerHeight(); this.showPins(); window.useLazyLoad && LazyLoad.invalidate() }, positionPin: function(b) { var c = $(b).attr("data-id"); if (c && this.mappedPins[c]) $(b).remove(); else { var e = _.indexOf(this.pinArray, Math.min.apply(Math, this.pinArray)), g = this.shortestColumnTop = this.pinArray[e]; b.style.top = g + "px"; b.style.left = e * this.columnWidthOuter + "px"; b.setAttribute("data-col", e); this.pinArray[e] = g + b.offsetHeight + this.columnMargin; this.mappedPins[c] = this.orderedPins.length; this.orderedPins.push(c) } }, showPins: function() { $.browser.msie && parseInt($.browser.version, 10) == 7 || $(this.pinsContainer).css("opacity", 1); var b = $(this.pinsContainer); setTimeout(function() { b.css({ visibility: "visible" }) }, 200) }, imageLoaded: function() { $(this).removeClass("lazy") }, getContentArea: function() { return this.contentArea || document.documentElement.clientWidth }, updateContainerHeight: function() { $("#ColumnContainer").height(Math.max.apply(Math, this.pinArray)) } } } (); var LazyLoad = new(function() { var b = this, c = 0, e = 0, g = 100, f = $(window); b.images = {}; b.invalidate = function() { $("img.lazy").each(function(u, o) { u = $(o); b.images[u.attr("data-id")] = u; h(u) && j(u) }) }; b.check = function() { var u, o = false; return function() { if (!o) { o = true; clearTimeout(u); u = setTimeout(function() { o = false; d() }, 200) } } } (); var d = function() { var u = 0, o = 0; for (var m in b.images) { var q = b.images[m]; u++; if (h(q)) { j(q); o++ } } }; b.stop = function() { f.unbind("scroll", k); f.unbind("resize", l) }; var h = function(u) { return u.offset().top <= g }, j = function(u) { if (u.hasClass("lazy")) { var o = u.attr("data-src"), m = u.attr("data-id"); u.load(function() { if (u[0]) u[0].style.opacity = "1"; delete b.images[m] }); u.attr("src", o); u.removeClass("lazy"); if (u[0]) u[0].style.opacity = "0" } }, k = function() { c = $(window).scrollTop(); r(); b.check() }, l = function() { e = $(window).height(); r(); b.check() }, r = function() { g = c + e + 600 }; if (window.useLazyLoad) { f.ready(function() { k(); l() }); f.scroll(k); f.resize(l) } }); var FancySelect = function() { var b; return { setup: function(c, e, g) { function f() { b.hide(); j.hide() } function d() { j.show(); b.show() } var h = $('<div class="FancySelect"><div class="current"><span class="CurrentSelection"></span><span class="DownArrow"></span></div><div class="FancySelectList"><div class="wrapper"><ul></ul></div></div></div>'), j = $(".FancySelectList", h), k = $("ul", j), l = $(".CurrentSelection", h), r = "", u, o; b || (b = $('<div class="FancySelectOverlay"></div>').appendTo("body")); c = $(c); u = c.prop("selectedIndex"); e = e || function() { return '<li data="' + $(this).val() + '"><span>' + $(this).text() + "</span></li>" }; o = $("option", c); o.each(function(m) { r += e.call(this, m, m === u) }); k.html(r); l.text(o.eq(u).text()); c.before(h); c.hide(); h.click(function() { d() }); b.click(function() { f() }); k.on("click", "li", function() { var m = $(this).prevAll().length; l.text($(this).text()); c.prop("selectedIndex", m); f(); g && g($(this).attr("data")); return false }) } } } (); var boardPicker = function() { return { setup: function(b, c, e) { b = $(b); var g = $(".boardListOverlay", b.parent()), f = $(".boardList", b), d = $(".currentBoard", b), h = $("ul", f); b.click(function() { f.show(); g.show() }); g.click(function() { f.hide(); g.hide() }); $(h).on("click", "li", function() { if (!$(this).hasClass("noSelect")) { d.text($(this).text()); g.hide(); f.hide(); c && c($(this).attr("data")) } return false }); b = $(".createBoard", f); var j = $("input", b), k = $(".Button", b), l = $(".CreateBoardStatus", b); j.defaultValue("Create New Board"); k.click(function() { if (k.attr("disabled") == "disabled") return false; if (j.val() == "Create New Board") { l.html("Enter a board name").css("color", "red").show(); return false } l.html("").hide(); k.addClass("disabled").attr("disabled", "disabled"); $.post("/board/create/", { name: j.val(), pass_category: true }, function(r) { if (r && r.status == "success") { h.append("<li data='" + r.id + "'><span>" + $("<div/>").text(r.name).html() + "</span></li>"); f.hide(); d.text(r.name); j.val("").blur(); k.removeClass("disabled").removeAttr("disabled"); e && e(r.id) } else { l.html(r.message).css("color", "red").show(); k.removeClass("disabled").removeAttr("disabled") } }, "json"); return false }) } } } (); var CropImage = function() { this.initialize.apply(this, arguments) }; (function() { var b = Backbone.View.extend({ el: "#CropImage", events: { "click .cancel": "onClose", "click .save": "onSave", "mousedown .drag": "onStartDrag" }, dragging: false, mousePosition: {}, initialize: function() { _.bindAll(this, "onDragging", "onStopDragging", "onImageLoaded"); _.defaults(this.options, { title: "Crop Image", buttonTitle: "Save", size: { width: 222, height: 150 } }); this.$holder = this.$el.find(".holder"); this.$bg = this.$el.find(".holder .bg"); this.$overlay = this.$el.find(".holder .overlayContent"); this.$frame = this.$el.find(".holder .frame"); this.$mask = this.$el.find(".holder .mask"); this.$footer = this.$el.find(".footer"); this.$button = this.$el.find(".footer .Button.save"); this.$spinner = this.$el.find(".holder .spinner") }, render: function() { this.$el.find(".header span").text(this.options.title); this.$button.text(this.options.buttonTitle).removeClass("disabled"); this.$holder.show().css("height", this.options.size.height + 120 + 40); this.$footer.find(".buttons").css("visibility", "visible"); this.$footer.find(".complete").hide(); this.$bg.html("").show(); this.$spinner.hide(); this.options.className && this.$el.addClass(this.options.className); this.options.overlay && this.$overlay.html("").append(this.options.overlay); var c = this.bounds = { left: this.$holder.width() / 2 - this.options.size.width / 2, width: this.options.size.width, top: 60, height: this.options.size.height }; c.ratio = c.height / c.width; this.$frame.css(c); this.$mask.find("span").each(function(e, g) { e === 0 && $(g).css({ top: 0, left: 0, right: 0, height: c.top }); e === 1 && $(g).css({ top: c.top, left: c.left + c.width, right: 0, height: c.height }); e === 2 && $(g).css({ top: c.top + c.height, left: 0, right: 0, bottom: 0 }); e === 3 && $(g).css({ top: c.top, left: 0, width: c.left, height: c.height }) }); this.options.image && this.setImage(this.options.image) }, onClose: function() { this.trigger("close"); return false }, onSave: function() { this.trigger("save"); return false }, onImageLoaded: function(c) { if (this.$img.height() === 0) return setTimeout(this.onImageLoaded, 200, c); this.$img.removeAttr("width").removeAttr("height"); c = this.imageBounds = { originalWidth: this.$img.width(), originalHeight: this.$img.height() }; c.ratio = c.originalHeight / c.originalWidth; this.$img.css({ visibility: "visible", opacity: 1 }); this.fitImage(); this.centerImage(); this.hideSpinner() }, onStartDrag: function(c) { this.mousePosition = { x: c.pageX, y: c.pageY }; this.startPosition = { x: parseInt(this.$bg.css("left"), 10), y: parseInt(this.$bg.css("top"), 10) }; this.trigger("startDrag"); this.dragging = true; $("body").on({ mousemove: this.onDragging, mouseup: this.onStopDragging }); c.preventDefault() }, onDragging: function(c) { var e = { top: this.startPosition.y + (c.pageY - this.mousePosition.y), left: this.startPosition.x + (c.pageX - this.mousePosition.x) }; if (this.enforceBounds(e)) { this.$bg.css(e); c.preventDefault() } }, onStopDragging: function() { this.trigger("stopDrag"); this.dragging = false; $("body").off({ mousemove: this.onDragging, mouseup: this.onStopDragging }) }, enforceBounds: function(c) { c.top = Math.min(c.top, this.bounds.top); c.left = Math.min(c.left, this.bounds.left); if (c.left + this.imageBounds.width < this.bounds.left + this.bounds.width) c.left = this.bounds.left + this.bounds.width - this.imageBounds.width + 1; if (c.top + this.imageBounds.height < this.bounds.top + this.bounds.height) c.top = this.bounds.top + this.bounds.height - this.imageBounds.height + 1; return c }, showComplete: function() { this.$footer.find(".buttons").css("visibility", "hidden"); this.$footer.find(".complete").fadeIn(300); this.hideSpinner() }, setImage: function(c) { this.showSpinner(); var e = this.$img = $("<img>"); e.load(this.onImageLoaded).css({ opacity: "0.01", visibility: "hidden" }); e.attr("src", c); this.$bg.html(e) }, fitImage: function() { var c = 1; c = this.imageBounds.ratio >= this.bounds.ratio ? this.bounds.width / this.imageBounds.originalWidth: this.bounds.height / this.imageBounds.originalHeight; this.scaleImage(c, 10) }, centerImage: function() { var c = this.$holder.height() - 40, e = this.$holder.width(); this.$bg.css({ top: c / 2 - this.$bg.height() / 2 + 1, left: e / 2 - this.$bg.width() / 2 + 1 }) }, scaleImage: function(c, e) { var g = this.imageBounds.width = this.imageBounds.originalWidth * c + e || 0; c = this.imageBounds.height = this.imageBounds.originalHeight * c + e || 0; this.$img.attr("width", g); this.$img.attr("height", c) }, getOffset: function() { return { x: Math.abs(parseInt(this.$bg.css("left"), 10) - this.bounds.left), y: Math.abs(parseInt(this.$bg.css("top"), 10) - this.bounds.top) } }, getScale: function() { return this.$img.width() / this.imageBounds.originalWidth }, saving: function() { this.showSpinner(); this.$button.addClass("disabled") }, showSpinner: function() { this.$spinner.show() }, hideSpinner: function() { this.$spinner.hide() } }); CropImage.prototype = { initialize: function() { _.bindAll(this, "save", "close") }, show: function(c) { var e = this; c = this.view = new b(c); this.options = this.view.options; c.on("save", this.save); c.on("close", this.close); c.on("stopDrag", function() { e.trigger("dragComplete") }); Modal.show("CropImage"); c.render() }, setImage: function(c) { this.view.setImage(c) }, setParams: function(c) { this.options.params = c }, save: function() { var c = this, e = this.view.getOffset(), g = this.view.getScale(); e = _.extend({ x: e.x, y: e.y, width: this.options.size.width, height: this.options.size.height, scale: g }, this.options.params || {}); this.view.saving(); this.trigger("saving", e); $.ajax({ url: this.options.url, data: e, dataType: "json", type: "POST", success: function(f) { c.view.hideSpinner(); c.trigger("save", f); c.options.delay !== 0 && c.view.showComplete(); setTimeout(c.close, c.options.delay || 1200) } }) }, close: function() { Modal.close("CropImage"); this.view.undelegateEvents(); this.trigger("close"); delete this.view; delete this.options } }; _.extend(CropImage.prototype, Backbone.Events) })(); var BoardCoverSelector = function() { this.initialize.apply(this, arguments) }; (function() { var b = null; BoardCoverSelector.prototype = { pins: null, index: null, boardURL: null, initialize: function() { if (b) { b.cancel(); b = null } _.bindAll(this, "onKeyup", "onPinsLoaded", "onSave", "onSaving", "removeListeners", "next", "previous"); b = this; this.options = {}; this.imageCrop = new CropImage; this.imageCrop.on("close", this.removeListeners); this.imageCrop.on("save", this.onSave); this.imageCrop.on("saving", this.onSaving); this.imageCrop.on("dragComplete", function() { trackGAEvent("board_cover", "dragged") }); this.$img = $("<img>") }, loadPins: function() { $.ajax({ url: this.options.boardURL + "pins/", dataType: "json", success: this.onPinsLoaded }); this.boardURL = this.options.boardURL }, show: function(c) { this.options = c; this.imageCrop.show({ className: "BoardCover", overlay: this.overlayContent(), params: { pin: c.pin }, image: this.options.image, size: { width: 222, height: 150 }, title: c.title || "Select a cover photo and drag to position it.", buttonTitle: c.buttonTitle || "Set Cover", url: this.options.boardURL + "cover/", delay: c.delay }); if (!this.pins || this.boardURL != this.options.boardURL) this.loadPins(); else this.options.image || this.setIndex(0); trackGAEvent("board_cover", "show"); $("body").keyup(this.onKeyup) }, onPinsLoaded: function(c) { var e = null; if (this.options.image) { var g = this.options.image; _.each(c.pins, function(f, d) { if (e == null && g.match(new RegExp(f.image_key, "gi"))) e = d }) } this.index = e || 0; this.pins = c.pins; if (this.pins.length !== 0) { this.pins.length === 1 ? this.hideArrows() : this.preload([e - 1, e + 1]); e === null && this.setIndex(0) } }, onKeyup: function(c) { if (this.index !== null) { c.keyCode === 37 && this.previous(); c.keyCode === 39 && this.next(); c.keyCode === 27 && this.imageCrop.close(); c.keyCode === 13 && this.imageCrop.save() } }, overlayContent: function() { var c = this.$holder = $("<div class='BoardOverlay'></div>"), e = $('<button class="prev Button WhiteButton Button13" type="button"><em></em></button>').click(this.previous), g = $('<button class="next Button WhiteButton Button13" type="button"><em></em></button>').click(this.next); c.append("<h3 class='serif'>" + this.options.boardName + "</h3>"); c.append(e, g); return c }, next: function() { this.index === this.pins.length - 1 ? this.setIndex(0) : this.setIndex(this.index + 1); trackGAEvent("board_cover", "toggle_pin"); return false }, previous: function() { this.index === 0 ? this.setIndex(this.pins.length - 1) : this.setIndex(this.index - 1); trackGAEvent("board_cover", "toggle_pin"); return false }, setIndex: function(c) { var e = this.pins[c]; if (e) { this.imageCrop.setImage(e.url); this.imageCrop.setParams({ pin: e.id }); this.index = c; this.preload([this.index - 2, this.index - 1, this.index + 1, this.index + 2]) } }, preload: function(c) { var e = this; _.each(c, function(g) { if (g = e.pins[g])(new Image).src = g.url }) }, hideArrows: function() { this.$holder.find(".arrow").hide() }, removeListeners: function() { $("body").unbind("keyup", this.onKeyup) }, onSaving: function() { this.hideArrows() }, onSave: function(c) { this.options.success && this.options.success(c); trackGAEvent("board_cover", "saved") } }; _.extend(BoardCoverSelector.prototype, Backbone.Events) })(); var AddDialog = function() { return { setup: function(b) { var c = "#" + b, e = $(c), g = $(".Buttons .RedButton", e), f = $(".mainerror", e), d = $(".DescriptionTextarea", e); BoardPicker.setup(c + " .BoardPicker", function(h) { $(c + " #id_board").val(h) }, function(h) { $(c + " #id_board").val(h) }); AddDialog.shareCheckboxes(b); Tagging.initTextarea(c + " .DescriptionTextarea"); Tagging.priceTag(c + " .DescriptionTextarea", c + " .ImagePicker"); CharacterCount.setup(c + " .DescriptionTextarea", c + " .CharacterCount", c + " .Button"); g.click(function() { if (g.hasClass("disabled")) return false; trackGAEvent("pin", "clicked", "add_dialogue"); if (d.val() === "" || d.val() === "Describe your pin...") { f.html("Please describe your pin").slideDown(300); return false } else f.slideUp(300, function() { f.html("") }); g.addClass("disabled").html("Pinning..."); $("#id_details", e).val(d.val()); Tagging.loadTags(c + " .DescriptionTextarea", c + " #peeps_holder", c + " #id_tags", c + " #currency_holder"); $("form", e).ajaxSubmit({ url: "/pin/create/", type: "POST", dataType: "json", iframe: true, success: function(h) { if (h.status == "success") { trackGAEvent("pin", "success", "add_dialogue"); window.location = h.url } else if (h.captcha) { RecaptchaDialog.challenge(); AddDialog.reset(b) } else f.html(h.message).slideDown(300) } }); return false }) }, reset: function(b) { b === "CreateBoard" && CreateBoardDialog.reset(); b === "ScrapePin" && ScrapePinDialog.reset(); b === "UploadPin" && UploadPinDialog.reset(); AddDialog._resets[b] && AddDialog._resets[b]() }, close: function(b, c) { $("#" + b).addClass("super"); Modal.show(c) }, childClose: function(b, c) { var e = this, g = $("#" + c); $(".ModalContainer", g); e.reset(c); $("#" + b).removeClass("super"); Modal.close(b); Modal.close(c) }, pinBottom: function(b) { var c = $("#" + b); $(".PinBottom", c).slideDown(300, function() { var e = $(".modal:first", c);
elucid / Resque DelayedDelayed job queueing for Resque
raymondmars / Go DelayqueueA delay queue implemented in go language
bsphere / Nsqdelaynsqdelay - a delayed message queue for NSQ
MFrank2016 / Delayed Queue Demo延时队列 demo
peachyy / Sdmqis a simple delay message queue, based on redis and kotlin
lyl41 / Delay Queue延时队列,利用redis zset和list实现,提供grpc接口
hookdeck / Hookdeck VercelAuthenticate, delay, filter, queue, throttle, and retry asynchronous HTTP requests (e.g., webhooks) made to a Vercel application via a middleware integration with Hookdeck
xuqinghua91 / Awesome Delay Queue分布式延时队列,支持延时触发和计数触发。基于spi技术实现消息持久方案的扩展性,目前已实现基于redis的持久化方案。
Mythra / CoworkerA reasonably-good delayed job queue for the JVM.
whatvn / DqueueA golang delay queue on top of all well known message queue server: nats, nats streaming, kafka.... more to come
btfak / LaterA redis base delay queue
michealbalogun / Horizon DashboardCopyright 2012 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import glob import logging import os import sys import warnings from django.utils.translation import pgettext_lazy from django.utils.translation import ugettext_lazy as _ from horizon.utils.escape import monkeypatch_escape from openstack_dashboard import enabled from openstack_dashboard import exceptions from openstack_dashboard.local import enabled as local_enabled from openstack_dashboard import theme_settings from openstack_dashboard.utils import config from openstack_dashboard.utils import settings as settings_utils monkeypatch_escape() _LOG = logging.getLogger(__name__) warnings.formatwarning = lambda message, category, *args, **kwargs: \ '%s: %s' % (category.__name__, message) ROOT_PATH = os.path.dirname(os.path.abspath(__file__)) if ROOT_PATH not in sys.path: sys.path.append(ROOT_PATH) DEBUG = False SITE_BRANDING = 'OpenStack Dashboard' WEBROOT = '/' LOGIN_URL = None LOGOUT_URL = None LOGIN_ERROR = None LOGIN_REDIRECT_URL = None MEDIA_ROOT = None MEDIA_URL = None STATIC_ROOT = None STATIC_URL = None SELECTABLE_THEMES = None INTEGRATION_TESTS_SUPPORT = False NG_TEMPLATE_CACHE_AGE = 2592000 ROOT_URLCONF = 'openstack_dashboard.urls' HORIZON_CONFIG = { 'user_home': 'openstack_dashboard.views.get_user_home', 'ajax_queue_limit': 10, 'auto_fade_alerts': { 'delay': 3000, 'fade_duration': 1500, 'types': ['alert-success', 'alert-info'] }, 'bug_url': None, 'help_url': "https://docs.openstack.org/", 'exceptions': {'recoverable': exceptions.RECOVERABLE, 'not_found': exceptions.NOT_FOUND, 'unauthorized': exceptions.UNAUTHORIZED}, 'modal_backdrop': 'static', 'angular_modules': [], 'js_files': [], 'js_spec_files': [], 'external_templates': [], 'plugins': [], 'integration_tests_support': INTEGRATION_TESTS_SUPPORT } # The OPENSTACK_IMAGE_BACKEND settings can be used to customize features # in the OpenStack Dashboard related to the Image service, such as the list # of supported image formats. OPENSTACK_IMAGE_BACKEND = { 'image_formats': [ ('', _('Select format')), ('aki', _('AKI - Amazon Kernel Image')), ('ami', _('AMI - Amazon Machine Image')), ('ari', _('ARI - Amazon Ramdisk Image')), ('docker', _('Docker')), ('iso', _('ISO - Optical Disk Image')), ('ova', _('OVA - Open Virtual Appliance')), ('ploop', _('PLOOP - Virtuozzo/Parallels Loopback Disk')), ('qcow2', _('QCOW2 - QEMU Emulator')), ('raw', _('Raw')), ('vdi', _('VDI - Virtual Disk Image')), ('vhd', _('VHD - Virtual Hard Disk')), ('vhdx', _('VHDX - Large Virtual Hard Disk')), ('vmdk', _('VMDK - Virtual Machine Disk')), ] } MIDDLEWARE = ( 'openstack_auth.middleware.OpenstackAuthMonkeyPatchMiddleware', 'debreach.middleware.RandomCommentMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'horizon.middleware.OperationLogMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'horizon.middleware.HorizonMiddleware', 'horizon.themes.ThemeMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'openstack_dashboard.contrib.developer.profiler.middleware.' 'ProfilerClientMiddleware', 'openstack_dashboard.contrib.developer.profiler.middleware.' 'ProfilerMiddleware', ) CACHED_TEMPLATE_LOADERS = [ 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', 'horizon.loaders.TemplateLoader' ] ADD_TEMPLATE_LOADERS = [] ADD_TEMPLATE_DIRS = [] TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(ROOT_PATH, 'templates')], 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.i18n', 'django.template.context_processors.request', 'django.template.context_processors.media', 'django.template.context_processors.static', 'django.contrib.messages.context_processors.messages', 'horizon.context_processors.horizon', 'openstack_dashboard.context_processors.openstack', ], 'loaders': [ 'horizon.themes.ThemeTemplateLoader' ], }, }, ] STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'horizon.contrib.staticfiles.finders.HorizonStaticFinder', 'compressor.finders.CompressorFinder', ) COMPRESS_PRECOMPILERS = ( ('text/scss', 'horizon.utils.scss_filter.HorizonScssFilter'), ) COMPRESS_CSS_FILTERS = ( 'compressor.filters.css_default.CssAbsoluteFilter', ) COMPRESS_ENABLED = True COMPRESS_OUTPUT_DIR = 'dashboard' COMPRESS_CSS_HASHING_METHOD = 'hash' COMPRESS_PARSER = 'compressor.parser.HtmlParser' INSTALLED_APPS = [ 'openstack_dashboard', 'django.contrib.contenttypes', 'django.contrib.auth', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', 'django_pyscss', 'debreach', 'openstack_dashboard.django_pyscss_fix', 'compressor', 'horizon', 'openstack_auth', ] AUTHENTICATION_BACKENDS = ('openstack_auth.backend.KeystoneBackend',) AUTHENTICATION_URLS = ['openstack_auth.urls'] AUTH_USER_MODEL = 'openstack_auth.User' MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage' SESSION_ENGINE = 'django.contrib.sessions.backends.cache' CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', 'LOCATION': '127.0.0.1:11211', }, } SESSION_COOKIE_HTTPONLY = True SESSION_EXPIRE_AT_BROWSER_CLOSE = True SESSION_COOKIE_SECURE = False # Control whether the SESSION_TIMEOUT period is refreshed due to activity. If # False, SESSION_TIMEOUT acts as a hard limit. SESSION_REFRESH = True # This SESSION_TIMEOUT is a method to supercede the token timeout with a # shorter horizon session timeout (in seconds). If SESSION_REFRESH is True (the # default) SESSION_TIMEOUT acts like an idle timeout rather than being a hard # limit, but will never exceed the token expiry. If your token expires in 60 # minutes, a value of 1800 will log users out after 30 minutes of inactivity, # or 60 minutes with activity. Setting SESSION_REFRESH to False will make # SESSION_TIMEOUT act like a hard limit on session times. SESSION_TIMEOUT = 3600 # When using cookie-based sessions, log error when the session cookie exceeds # the following size (common browsers drop cookies above a certain size): SESSION_COOKIE_MAX_SIZE = 4093 # when doing upgrades, it may be wise to stick to PickleSerializer # NOTE(berendt): Check during the K-cycle if this variable can be removed. # https://bugs.launchpad.net/horizon/+bug/1349463 SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer' # MEMOIZED_MAX_SIZE_DEFAULT allows setting a global default to help control # memory usage when caching. It should at least be 2 x the number of threads # with a little bit of extra buffer. MEMOIZED_MAX_SIZE_DEFAULT = 25 CSRF_FAILURE_VIEW = 'openstack_dashboard.views.csrf_failure' LANGUAGES = ( ('cs', 'Czech'), ('de', 'German'), ('en', 'English'), ('en-au', 'Australian English'), ('en-gb', 'British English'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('fr', 'French'), ('id', 'Indonesian'), ('it', 'Italian'), ('ja', 'Japanese'), ('ko', 'Korean (Korea)'), ('pl', 'Polish'), ('pt-br', 'Portuguese (Brazil)'), ('ru', 'Russian'), ('tr', 'Turkish'), ('zh-cn', 'Simplified Chinese'), ('zh-tw', 'Chinese (Taiwan)'), ) LANGUAGE_CODE = 'en' LANGUAGE_COOKIE_NAME = 'horizon_language' USE_I18N = True USE_L10N = True USE_TZ = True # Set OPENSTACK_CLOUDS_YAML_NAME to provide a nicer name for this cloud for # the clouds.yaml file than "openstack". OPENSTACK_CLOUDS_YAML_NAME = 'openstack' # If this cloud has a vendor profile in os-client-config, put it's name here. OPENSTACK_CLOUDS_YAML_PROFILE = '' OPENSTACK_KEYSTONE_DEFAULT_ROLE = '_member_' DEFAULT_EXCEPTION_REPORTER_FILTER = 'horizon.exceptions.HorizonReporterFilter' POLICY_FILES_PATH = os.path.join(ROOT_PATH, "conf") # Map of local copy of service policy files POLICY_FILES = { 'identity': 'keystone_policy.json', 'compute': 'nova_policy.json', 'volume': 'cinder_policy.json', 'image': 'glance_policy.json', 'network': 'neutron_policy.json', } # Services for which horizon has extra policies are defined # in POLICY_DIRS by default. POLICY_DIRS = { 'compute': ['nova_policy.d'], 'volume': ['cinder_policy.d'], } SECRET_KEY = None LOCAL_PATH = None SECURITY_GROUP_RULES = { 'all_tcp': { 'name': _('All TCP'), 'ip_protocol': 'tcp', 'from_port': '1', 'to_port': '65535', }, 'all_udp': { 'name': _('All UDP'), 'ip_protocol': 'udp', 'from_port': '1', 'to_port': '65535', }, 'all_icmp': { 'name': _('All ICMP'), 'ip_protocol': 'icmp', 'from_port': '-1', 'to_port': '-1', }, } ADD_INSTALLED_APPS = [] # NOTE: The default value of USER_MENU_LINKS will be set after loading # local_settings if it is not configured. USER_MENU_LINKS = None # 'key', 'label', 'path' AVAILABLE_THEMES = [ ( 'default', pgettext_lazy('Default style theme', 'Default'), 'themes/default' ), ( 'material', pgettext_lazy("Google's Material Design style theme", "Material"), 'themes/material' ), ] # The default theme if no cookie is present DEFAULT_THEME = 'default' # Theme Static Directory THEME_COLLECTION_DIR = 'themes' # Theme Cookie Name THEME_COOKIE_NAME = 'theme' POLICY_CHECK_FUNCTION = 'openstack_auth.policy.check' CSRF_COOKIE_AGE = None COMPRESS_OFFLINE_CONTEXT = 'horizon.themes.offline_context' SHOW_KEYSTONE_V2_RC = False SHOW_OPENRC_FILE = True SHOW_OPENSTACK_CLOUDS_YAML = True # Dictionary of currently available angular features ANGULAR_FEATURES = { 'images_panel': True, 'key_pairs_panel': True, 'flavors_panel': False, 'domains_panel': False, 'users_panel': False, 'groups_panel': False, 'roles_panel': True } # Notice all customizable configurations should be above this line XSTATIC_MODULES = settings_utils.BASE_XSTATIC_MODULES OPENSTACK_PROFILER = { 'enabled': False } if not LOCAL_PATH: LOCAL_PATH = os.path.join(ROOT_PATH, 'local') LOCAL_SETTINGS_DIR_PATH = os.path.join(LOCAL_PATH, "local_settings.d") _files = glob.glob(os.path.join(LOCAL_PATH, 'local_settings.conf')) _files.extend( sorted(glob.glob(os.path.join(LOCAL_SETTINGS_DIR_PATH, '*.conf')))) _config = config.load_config(_files, ROOT_PATH, LOCAL_PATH) # Apply the general configuration. config.apply_config(_config, globals()) try: from local.local_settings import * # noqa: F403,H303 except ImportError: _LOG.warning("No local_settings file found.") # configure templates if not TEMPLATES[0]['DIRS']: TEMPLATES[0]['DIRS'] = [os.path.join(ROOT_PATH, 'templates')] TEMPLATES[0]['DIRS'] += ADD_TEMPLATE_DIRS # configure template debugging TEMPLATES[0]['OPTIONS']['debug'] = DEBUG # Template loaders if DEBUG: TEMPLATES[0]['OPTIONS']['loaders'].extend( CACHED_TEMPLATE_LOADERS + ADD_TEMPLATE_LOADERS ) else: TEMPLATES[0]['OPTIONS']['loaders'].extend( [('django.template.loaders.cached.Loader', CACHED_TEMPLATE_LOADERS)] + ADD_TEMPLATE_LOADERS ) # allow to drop settings snippets into a local_settings_dir LOCAL_SETTINGS_DIR_PATH = os.path.join(ROOT_PATH, "local", "local_settings.d") if os.path.exists(LOCAL_SETTINGS_DIR_PATH): for (dirpath, dirnames, filenames) in os.walk(LOCAL_SETTINGS_DIR_PATH): for filename in sorted(filenames): if filename.endswith(".py"): try: with open(os.path.join(dirpath, filename)) as f: # pylint: disable=exec-used exec(f.read()) except Exception as e: _LOG.exception( "Can not exec settings snippet %s", filename) # The purpose of OPENSTACK_IMAGE_FORMATS is to provide a simple object # that does not contain the lazy-loaded translations, so the list can # be sent as JSON to the client-side (Angular). OPENSTACK_IMAGE_FORMATS = [fmt for (fmt, name) in OPENSTACK_IMAGE_BACKEND['image_formats']] if USER_MENU_LINKS is None: USER_MENU_LINKS = [] if SHOW_KEYSTONE_V2_RC: USER_MENU_LINKS.append({ 'name': _('OpenStack RC File v2'), 'icon_classes': ['fa-download', ], 'url': 'horizon:project:api_access:openrcv2', }) if SHOW_OPENRC_FILE: USER_MENU_LINKS.append({ 'name': (_('OpenStack RC File v3') if SHOW_KEYSTONE_V2_RC else _('OpenStack RC File')), 'icon_classes': ['fa-download', ], 'url': 'horizon:project:api_access:openrc', }) if not WEBROOT.endswith('/'): WEBROOT += '/' if LOGIN_URL is None: LOGIN_URL = WEBROOT + 'auth/login/' if LOGOUT_URL is None: LOGOUT_URL = WEBROOT + 'auth/logout/' if LOGIN_ERROR is None: LOGIN_ERROR = WEBROOT + 'auth/error/' if LOGIN_REDIRECT_URL is None: LOGIN_REDIRECT_URL = WEBROOT if MEDIA_ROOT is None: MEDIA_ROOT = os.path.abspath(os.path.join(ROOT_PATH, '..', 'media')) if MEDIA_URL is None: MEDIA_URL = WEBROOT + 'media/' if STATIC_ROOT is None: STATIC_ROOT = os.path.abspath(os.path.join(ROOT_PATH, '..', 'static')) if STATIC_URL is None: STATIC_URL = WEBROOT + 'static/' AVAILABLE_THEMES, SELECTABLE_THEMES, DEFAULT_THEME = ( theme_settings.get_available_themes( AVAILABLE_THEMES, DEFAULT_THEME, SELECTABLE_THEMES ) ) # Discover all the directories that contain static files STATICFILES_DIRS = theme_settings.get_theme_static_dirs( AVAILABLE_THEMES, THEME_COLLECTION_DIR, ROOT_PATH) # Ensure that we always have a SECRET_KEY set, even when no local_settings.py # file is present. See local_settings.py.example for full documentation on the # horizon.utils.secret_key module and its use. if not SECRET_KEY: if not LOCAL_PATH: LOCAL_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'local') # pylint: disable=ungrouped-imports from horizon.utils import secret_key SECRET_KEY = secret_key.generate_or_read_from_file(os.path.join(LOCAL_PATH, '.secret_key_store')) # populate HORIZON_CONFIG with auto-discovered JavaScript sources, mock files, # specs files and external templates. settings_utils.find_static_files(HORIZON_CONFIG, AVAILABLE_THEMES, THEME_COLLECTION_DIR, ROOT_PATH) INSTALLED_APPS = list(INSTALLED_APPS) # Make sure it's mutable settings_utils.update_dashboards( [ enabled, local_enabled, ], HORIZON_CONFIG, INSTALLED_APPS, ) INSTALLED_APPS[0:0] = ADD_INSTALLED_APPS NG_TEMPLATE_CACHE_AGE = NG_TEMPLATE_CACHE_AGE if not DEBUG else 0 # Include xstatic_modules specified in plugin XSTATIC_MODULES += HORIZON_CONFIG['xstatic_modules'] # Discover all the xstatic module entry points to embed in our HTML STATICFILES_DIRS += settings_utils.get_xstatic_dirs( XSTATIC_MODULES, HORIZON_CONFIG) # This base context objects gets added to the offline context generator # for each theme configured. HORIZON_COMPRESS_OFFLINE_CONTEXT_BASE = { 'WEBROOT': WEBROOT, 'STATIC_URL': STATIC_URL, 'HORIZON_CONFIG': HORIZON_CONFIG, 'NG_TEMPLATE_CACHE_AGE': NG_TEMPLATE_CACHE_AGE, } if DEBUG: logging.basicConfig(level=logging.DEBUG) # Here comes the Django settings deprecation section. Being at the very end # of settings.py allows it to catch the settings defined in local_settings.py # or inside one of local_settings.d/ snippets.
Joydevelop / Delay Queue基于Redis实现延时队列
Emrran / 5G And New Data Offloading Scheme Over D2DThe idea of offloading 5G cellular data over WiFi is becoming very popular nowadays. Offloading data over active WiFi connection in Handsets may reduce the dependency on small cells in our environment, reduces the traffic at the Base Transceiver Station (BTS) and reduces the cost of setting up 5G infrastructure. Furthermore, offloading over WiFi does not compromise the 5G speed that is the huge amount of 5G data can be offloaded over WiFi connection in Handsets with the speed promised by the 5G cellular network. Many published paper suggested “delayed offloading” in which traffic will be delayed up to an allowed deadline if the WiFi connection is inactive or until the WiFi connection again becomes available. In this paper, we proposed a routing scheme for offloading 5G cellular data where the data at a user’s handset will first collect in WiFi queue to offload over WiFi and if the WiFi connection is inactive in the user’s handset then the data will wait in the queue for a given deadline and while it waits in the WiFi queue, the user’s handset will try to set up a device to device (D2D) connection with a neighboring handset with an active WiFi connection. When the deadline will reach for the data in the WiFi queue, the user data will be sent to the neighboring handset which has an active WiFi connection and which will allow the user’s data to be offloaded through it, otherwise, if no handset with an active WiFi connection is found in the environment, after the deadline the data will be sent in the typical gruesome manner to the BTS through several small cells.
GatewayJ / Delayed Queue延时队列
wsqun / Go Delay Queuego-delay-queue
dlibanori / Sidekiq DelaySidekiq::Delay queues method calls to Sidekiq
zhiweio / PorterPorter is a data cleaning tool designed to assist with full data extraction from MySQL, MongoDB, and text files (CSV/TSV/JSON) and push them into Redis queues. It supports features like resumable uploads, customizable wait delays, and configurable batch sizes.