2014-04-24 03:31:20 +00:00
|
|
|
/*jshint bitwise:false, curly:true, eqeqeq:true, evil:true, forin:false, noarg:true, noempty:true, nonew:true, undef:false, strict:false, browser:true */
|
2011-08-17 03:14:30 +00:00
|
|
|
|
|
|
|
// Adding jQuery ui stuff
|
|
|
|
$(document).ready(function() {
|
2013-05-18 12:46:27 +00:00
|
|
|
var dayMS = 1000 * 60 * 60 * 24;
|
|
|
|
jQuery.timeago.settings.cutoff = 365 * dayMS;
|
2011-12-31 14:12:05 +00:00
|
|
|
$("time").timeago();
|
2011-08-17 03:14:30 +00:00
|
|
|
|
2014-02-17 03:02:14 +00:00
|
|
|
//TODO: Possibly move to using TextExtJS for autocomplete? - http://textextjs.com/
|
|
|
|
// Also use autocomplete in tag box?
|
2012-02-09 14:45:18 +00:00
|
|
|
$('.autocomplete_tags').autocomplete(base_href + '/api/internal/tag_list/complete', {
|
2014-02-28 02:03:41 +00:00
|
|
|
//extraParams: {limit: 10},
|
2014-02-18 03:32:05 +00:00
|
|
|
queryParamName: 's',
|
2014-02-28 02:03:41 +00:00
|
|
|
minChars: 1,
|
|
|
|
delay: 0,
|
|
|
|
useCache: true,
|
|
|
|
maxCacheLength: 10,
|
|
|
|
matchInside: false,
|
2015-04-18 09:30:51 +00:00
|
|
|
selectFirst: false,
|
2014-02-28 02:03:41 +00:00
|
|
|
selectOnly: false,
|
|
|
|
preventDefaultReturn: 1,
|
|
|
|
preventDefaultTab: 1,
|
|
|
|
useDelimiter: true,
|
|
|
|
delimiterChar : " ",
|
|
|
|
delimiterKeyCode : 48
|
2012-02-07 11:33:42 +00:00
|
|
|
});
|
2007-05-08 21:18:31 +00:00
|
|
|
|
2012-02-11 01:48:07 +00:00
|
|
|
$("TABLE.sortable").tablesorter();
|
|
|
|
|
2012-03-14 03:15:35 +00:00
|
|
|
$(".shm-clink").each(function(idx, elm) {
|
|
|
|
var target_id = $(elm).data("clink-sel");
|
2012-03-14 15:06:30 +00:00
|
|
|
if(target_id && $(target_id).length > 0) {
|
2012-03-14 03:15:35 +00:00
|
|
|
// 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) {
|
2013-05-18 14:30:00 +00:00
|
|
|
// This needs jQuery UI
|
2012-03-14 03:15:35 +00:00
|
|
|
$(target_id).effect('highlight', {}, 5000);
|
|
|
|
});
|
|
|
|
// 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());
|
2012-02-22 13:49:57 +00:00
|
|
|
}
|
|
|
|
});
|
2012-03-02 23:57:27 +00:00
|
|
|
|
2012-03-12 18:04:46 +00:00
|
|
|
try {
|
2012-08-15 20:19:51 +00:00
|
|
|
var sidebar_hidden = ($.cookie("ui-sidebar-hidden") || "").split("|");
|
2012-03-12 18:04:46 +00:00
|
|
|
for(var i in sidebar_hidden) {
|
2012-06-21 08:06:58 +00:00
|
|
|
if(sidebar_hidden.hasOwnProperty(i) && sidebar_hidden[i].length > 0) {
|
2012-03-12 18:04:46 +00:00
|
|
|
$(sidebar_hidden[i]+" .blockbody").hide();
|
|
|
|
}
|
2014-04-24 03:31:20 +00:00
|
|
|
}
|
2012-03-12 18:04:46 +00:00
|
|
|
}
|
|
|
|
catch(err) {
|
|
|
|
var sidebar_hidden = [];
|
|
|
|
}
|
2012-03-02 23:57:27 +00:00
|
|
|
$(".shm-toggler").each(function(idx, elm) {
|
2012-03-12 02:50:41 +00:00
|
|
|
var tid = $(elm).data("toggle-sel");
|
|
|
|
var tob = $(tid+" .blockbody");
|
2012-03-02 23:57:27 +00:00
|
|
|
$(elm).click(function(e) {
|
|
|
|
tob.slideToggle("slow");
|
2014-04-24 03:31:20 +00:00
|
|
|
if(sidebar_hidden.indexOf(tid) === -1) {
|
2012-03-02 23:57:27 +00:00
|
|
|
sidebar_hidden.push(tid);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
for (var i in sidebar_hidden) {
|
|
|
|
if (sidebar_hidden[i] === tid) {
|
|
|
|
sidebar_hidden.splice(i, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-03-24 11:19:24 +00:00
|
|
|
$.cookie("ui-sidebar-hidden", sidebar_hidden.join("|"), {path: '/', expires: 365});
|
2014-04-24 03:31:20 +00:00
|
|
|
});
|
2012-03-02 23:57:27 +00:00
|
|
|
});
|
|
|
|
|
2012-03-10 18:50:10 +00:00
|
|
|
$(".shm-unlocker").each(function(idx, elm) {
|
2012-03-11 15:49:25 +00:00
|
|
|
var tid = $(elm).data("unlock-sel");
|
|
|
|
var tob = $(tid);
|
2012-03-10 18:50:10 +00:00
|
|
|
$(elm).click(function(e) {
|
|
|
|
$(elm).attr("disabled", true);
|
|
|
|
tob.attr("disabled", false);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2012-03-02 23:57:27 +00:00
|
|
|
if(document.location.hash.length > 3) {
|
|
|
|
query = document.location.hash.substring(1);
|
|
|
|
a = document.getElementById("prevlink");
|
|
|
|
a.href = a.href + '?' + query;
|
|
|
|
a = document.getElementById("nextlink");
|
|
|
|
a.href = a.href + '?' + query;
|
|
|
|
}
|
2013-07-05 21:32:01 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2012-02-07 11:33:42 +00:00
|
|
|
});
|
2007-05-08 21:18:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
|
|
|
|
* LibShish-JS *
|
|
|
|
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
|
|
|
2007-04-16 11:58:25 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-02-07 15:15:18 +00:00
|
|
|
// used once in ext/setup/main
|
2007-04-16 11:58:25 +00:00
|
|
|
function getHTTPObject() {
|
|
|
|
if (window.XMLHttpRequest){
|
|
|
|
return new XMLHttpRequest();
|
|
|
|
}
|
|
|
|
else if(window.ActiveXObject){
|
|
|
|
return new ActiveXObject("Microsoft.XMLHTTP");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-03-13 16:04:50 +00:00
|
|
|
function replyTo(imageId, commentId, userId) {
|
2012-02-06 14:41:36 +00:00
|
|
|
var box = $("#comment_on_"+imageId);
|
2012-03-13 16:04:50 +00:00
|
|
|
var text = "[url=site://post/view/"+imageId+"#c"+commentId+"]@"+userId+"[/url]: ";
|
2012-02-06 14:41:36 +00:00
|
|
|
|
|
|
|
box.focus();
|
|
|
|
box.val(box.val() + text);
|
2012-03-13 15:25:04 +00:00
|
|
|
$("#c"+commentId).effect("highlight", {}, 5000);
|
2012-02-06 14:41:36 +00:00
|
|
|
}
|