diff --git a/ext/bbcode/script.js b/ext/bbcode/script.js new file mode 100644 index 00000000..ff7b3c35 --- /dev/null +++ b/ext/bbcode/script.js @@ -0,0 +1,18 @@ +$(document).ready(function() { + $(".shm-clink").each(function(idx, elm) { + var target_id = $(elm).data("clink-sel"); + if(target_id && $(target_id).length > 0) { + // if the target comment is already on this page, don't bother + // switching pages + $(elm).attr("href", target_id); + // highlight it when clicked + $(elm).click(function(e) { + // This needs jQuery UI + $(target_id).highlight(); + }); + // vanilla target name should already be in the URL tag, but this + // will include the anon ID as displayed on screen + $(elm).html("@"+$(target_id+" .username").html()); + } + }); +}); diff --git a/ext/comment/script.js b/ext/comment/script.js new file mode 100644 index 00000000..47023be7 --- /dev/null +++ b/ext/comment/script.js @@ -0,0 +1,8 @@ +function replyTo(imageId, commentId, userId) { + var box = $("#comment_on_"+imageId); + var text = "[url=site://post/view/"+imageId+"#c"+commentId+"]@"+userId+"[/url]: "; + + box.focus(); + box.val(box.val() + text); + $("#c"+commentId).highlight(); +} diff --git a/ext/index/script.js b/ext/index/script.js index 5f1ab8e2..02113695 100644 --- a/ext/index/script.js +++ b/ext/index/script.js @@ -31,6 +31,21 @@ $(function() { input.val(tagArr.join(" ")); } }); + + /* + * If an image list has a data-query attribute, append + * that query string to all thumb links inside the list. + * This allows us to cache the same thumb for all query + * strings, adding the query in the browser. + */ + $(".shm-image-list").each(function(idx, elm) { + var query = $(this).data("query"); + if(query) { + $(this).find(".shm-thumb-link").each(function(idx2, elm2) { + $(this).attr("href", $(this).attr("href") + query); + }); + } + }); }); function select_blocked_tags() { diff --git a/ext/setup/script.js b/ext/setup/script.js new file mode 100644 index 00000000..55246bbe --- /dev/null +++ b/ext/setup/script.js @@ -0,0 +1,8 @@ +function getHTTPObject() { + if (window.XMLHttpRequest){ + return new XMLHttpRequest(); + } + else if(window.ActiveXObject){ + return new ActiveXObject("Microsoft.XMLHTTP"); + } +} diff --git a/ext/tagger/script.js b/ext/tagger/script.js index 49ad07c3..2fb624a3 100644 --- a/ext/tagger/script.js +++ b/ext/tagger/script.js @@ -6,6 +6,10 @@ * Do not remove this notice. * \* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +function byId(id) { + return document.getElementById(id); +} + var Tagger = { initialize : function (image_id) { // object navigation diff --git a/ext/view/script.js b/ext/view/script.js new file mode 100644 index 00000000..a74f1c7d --- /dev/null +++ b/ext/view/script.js @@ -0,0 +1,12 @@ +$(document).ready(function() { + if(document.location.hash.length > 3) { + var query = document.location.hash.substring(1); + + $('#prevlink').attr('href', function(i, attr) { + return attr + '?' + query; + }); + $('#nextlink').attr('href', function(i, attr) { + return attr + '?' + query; + }); + } +}); diff --git a/lib/shimmie.js b/lib/shimmie.js index ae6b98c5..e06c39c7 100644 --- a/lib/shimmie.js +++ b/lib/shimmie.js @@ -32,23 +32,6 @@ $(document).ready(function() { /** Setup tablesorter **/ $("table.sortable").tablesorter(); - $(".shm-clink").each(function(idx, elm) { - var target_id = $(elm).data("clink-sel"); - if(target_id && $(target_id).length > 0) { - // if the target comment is already on this page, don't bother - // switching pages - $(elm).attr("href", target_id); - // highlight it when clicked - $(elm).click(function(e) { - // This needs jQuery UI - $(target_id).highlight(); - }); - // vanilla target name should already be in the URL tag, but this - // will include the anon ID as displayed on screen - $(elm).html("@"+$(target_id+" .username").html()); - } - }); - try { var sidebar_hidden = (Cookies.get("ui-sidebar-hidden") || "").split("|"); for(var i in sidebar_hidden) { @@ -87,69 +70,4 @@ $(document).ready(function() { tob.attr("disabled", false); }); }); - - if(document.location.hash.length > 3) { - var query = document.location.hash.substring(1); - - $('#prevlink').attr('href', function(i, attr) { - return attr + '?' + query; - }); - $('#nextlink').attr('href', function(i, attr) { - return attr + '?' + query; - }); - } - - /* - * If an image list has a data-query attribute, append - * that query string to all thumb links inside the list. - * This allows us to cache the same thumb for all query - * strings, adding the query in the browser. - */ - $(".shm-image-list").each(function(idx, elm) { - var query = $(this).data("query"); - if(query) { - $(this).find(".shm-thumb-link").each(function(idx2, elm2) { - $(this).attr("href", $(this).attr("href") + query); - }); - } - }); }); - - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\ -* LibShish-JS * -\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -function addEvent(obj, event, func, capture){ - if (obj.addEventListener){ - obj.addEventListener(event, func, capture); - } else if (obj.attachEvent){ - obj.attachEvent("on"+event, func); - } -} - - -function byId(id) { - return document.getElementById(id); -} - - -// used once in ext/setup/main -function getHTTPObject() { - if (window.XMLHttpRequest){ - return new XMLHttpRequest(); - } - else if(window.ActiveXObject){ - return new ActiveXObject("Microsoft.XMLHTTP"); - } -} - - -function replyTo(imageId, commentId, userId) { - var box = $("#comment_on_"+imageId); - var text = "[url=site://post/view/"+imageId+"#c"+commentId+"]@"+userId+"[/url]: "; - - box.focus(); - box.val(box.val() + text); - $("#c"+commentId).highlight(); -}