2014-04-25 02:29:29 +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, jquery:true */
|
|
|
|
|
2012-03-22 13:40:13 +00:00
|
|
|
$(function() {
|
2012-08-15 19:22:25 +00:00
|
|
|
var blocked_tags = ($.cookie("ui-blocked-tags") || "").split(" ");
|
2012-03-22 16:35:44 +00:00
|
|
|
var needs_refresh = false;
|
2012-04-03 02:52:17 +00:00
|
|
|
for(i=0; i<blocked_tags.length; i++) {
|
2012-03-22 13:40:13 +00:00
|
|
|
var tag = blocked_tags[i];
|
2012-03-22 16:35:44 +00:00
|
|
|
if(tag) {
|
2012-08-15 19:42:56 +00:00
|
|
|
$(".shm-thumb[data-tags~='"+tag+"']").hide();
|
2012-03-22 16:35:44 +00:00
|
|
|
needs_refresh = true;
|
|
|
|
}
|
2012-03-22 13:40:13 +00:00
|
|
|
}
|
2012-03-22 15:44:04 +00:00
|
|
|
// need to trigger a reflow in opera, because opera implements
|
2012-03-22 13:40:13 +00:00
|
|
|
// text-align: justify with element margins and doesn't recalculate
|
|
|
|
// these margins when part of the line disappears...
|
2012-03-22 16:35:44 +00:00
|
|
|
if(needs_refresh) {
|
2012-08-15 20:19:51 +00:00
|
|
|
$('.shm-image-list').hide(
|
|
|
|
0,
|
|
|
|
function() {$('.shm-image-list').show();}
|
|
|
|
);
|
2012-03-22 16:35:44 +00:00
|
|
|
}
|
2014-02-24 19:54:15 +00:00
|
|
|
|
|
|
|
//Generate a random seed when using order:random
|
2014-03-08 15:20:50 +00:00
|
|
|
$('form > input[placeholder="Search"]').parent().submit(function(e){
|
|
|
|
var input = $('form > input[placeholder="Search"]');
|
2014-02-24 19:54:15 +00:00
|
|
|
var tagArr = input.val().split(" ");
|
|
|
|
|
|
|
|
var rand = (($.inArray("order:random", tagArr) + 1) || ($.inArray("order=random", tagArr) + 1)) - 1;
|
|
|
|
if(rand !== -1){
|
|
|
|
tagArr[rand] = "order:random_"+Math.floor((Math.random()*9999)+1);
|
|
|
|
input.val(tagArr.join(" "));
|
|
|
|
}
|
|
|
|
});
|
2012-03-22 13:40:13 +00:00
|
|
|
});
|
2012-03-22 14:19:46 +00:00
|
|
|
|
|
|
|
function select_blocked_tags() {
|
2012-03-24 11:23:06 +00:00
|
|
|
var blocked_tags = prompt("Enter tags to ignore", $.cookie("ui-blocked-tags") || "My_Little_Pony");
|
2012-08-15 20:19:51 +00:00
|
|
|
if(blocked_tags !== null) {
|
2012-03-24 11:23:06 +00:00
|
|
|
$.cookie("ui-blocked-tags", blocked_tags.toLowerCase(), {path: '/', expires: 365});
|
2012-03-22 14:19:46 +00:00
|
|
|
location.reload(true);
|
|
|
|
}
|
|
|
|
}
|