This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/ext/handle_static/script.js

74 lines
2.2 KiB
JavaScript
Raw Normal View History

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 */
$(document).ready(function() {
/** Load jQuery extensions **/
//Code via: http://stackoverflow.com/a/13106698
$.fn.highlight = function (fadeOut) {
fadeOut = typeof fadeOut !== 'undefined' ? fadeOut : 5000;
$(this).each(function () {
var el = $(this);
$("<div/>")
.width(el.outerWidth())
.height(el.outerHeight())
.css({
"position": "absolute",
"left": el.offset().left,
"top": el.offset().top,
"background-color": "#ffff99",
"opacity": ".7",
"z-index": "9999999",
"border-top-left-radius": parseInt(el.css("borderTopLeftRadius"), 10),
"border-top-right-radius": parseInt(el.css("borderTopRightRadius"), 10),
"border-bottom-left-radius": parseInt(el.css("borderBottomLeftRadius"), 10),
"border-bottom-right-radius": parseInt(el.css("borderBottomRightRadius"), 10)
}).appendTo('body').fadeOut(fadeOut).queue(function () { $(this).remove(); });
});
};
2016-05-12 14:40:33 +00:00
/** Setup jQuery.timeago **/
$.timeago.settings.cutoff = 365 * 24 * 60 * 60 * 1000; // Display original dates older than 1 year
$("time").timeago();
2016-05-12 20:03:39 +00:00
/** Setup tablesorter **/
$("table.sortable").tablesorter();
try {
2016-06-19 23:24:50 +00:00
var sidebar_hidden = (Cookies.get("ui-sidebar-hidden") || "").split("|");
for(var i in sidebar_hidden) {
2012-06-21 08:06:58 +00:00
if(sidebar_hidden.hasOwnProperty(i) && sidebar_hidden[i].length > 0) {
$(sidebar_hidden[i]+" .blockbody").hide();
}
2014-04-24 03:31:20 +00:00
}
}
catch(err) {
var sidebar_hidden = [];
}
$(".shm-toggler").each(function(idx, elm) {
2012-03-12 02:50:41 +00:00
var tid = $(elm).data("toggle-sel");
var tob = $(tid+" .blockbody");
$(elm).click(function(e) {
tob.slideToggle("slow");
2014-04-24 03:31:20 +00:00
if(sidebar_hidden.indexOf(tid) === -1) {
sidebar_hidden.push(tid);
}
else {
for (var i in sidebar_hidden) {
if (sidebar_hidden[i] === tid) {
sidebar_hidden.splice(i, 1);
}
}
}
2016-06-19 23:24:50 +00:00
Cookies.set("ui-sidebar-hidden", sidebar_hidden.join("|"), {expires: 365});
2014-04-24 03:31:20 +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);
$(elm).click(function(e) {
$(elm).attr("disabled", true);
tob.attr("disabled", false);
});
});
2012-02-07 11:33:42 +00:00
});