@@ -8,11 +8,14 @@ | |||||
* | * | ||||
* Usage: | * Usage: | ||||
* $config['additional_javascript'][] = 'js/jquery.min.js'; | * $config['additional_javascript'][] = 'js/jquery.min.js'; | ||||
* //$config['additional_javascript'][] = 'js/options.js'; | |||||
* //$config['additional_javascript'][] = 'js/style-select.js'; | |||||
* //$config['additional_javascript'][] = 'js/options/general.js'; | |||||
* $config['additional_javascript'][] = 'js/forced-anon.js'; | * $config['additional_javascript'][] = 'js/forced-anon.js'; | ||||
* | * | ||||
*/ | */ | ||||
if (active_page == 'ukko' || active_page == 'thread' || active_page == 'index') | |||||
if (active_page == 'ukko' || active_page == 'thread' || active_page == 'index' || (window.Options && Options.get_tab('general'))) | |||||
$(document).ready(function() { | $(document).ready(function() { | ||||
var force_anon = function() { | var force_anon = function() { | ||||
if($(this).children('a.capcode').length == 0) { | if($(this).children('a.capcode').length == 0) { | ||||
@@ -56,11 +59,22 @@ $(document).ready(function() { | |||||
old_info = {}; | old_info = {}; | ||||
forced_anon = localStorage['forcedanon'] ? true : false; | forced_anon = localStorage['forcedanon'] ? true : false; | ||||
var selector, event; | |||||
if (window.Options && Options.get_tab('general')) { | |||||
selector = '#forced-anon'; | |||||
event = 'change'; | |||||
Options.extend_tab("general", "<label id='forced-anon'><input type='checkbox' /> "+_('Forced anonymity')+"</label>"); | |||||
} | |||||
else { | |||||
selector = '#forced-anon'; | |||||
event = 'click'; | |||||
$('hr:first').before('<div id="forced-anon" style="text-align:right"><a class="unimportant" href="javascript:void(0)">-</a></div>'); | |||||
$('div#forced-anon a').text(_('Forced anonymity')+' (' + (forced_anon ? _('enabled') : _('disabled')) + ')'); | |||||
} | |||||
$('hr:first').before('<div id="forced-anon" style="text-align:right"><a class="unimportant" href="javascript:void(0)">-</a></div>'); | |||||
$('div#forced-anon a').text(_('Forced anonymity')+' (' + (forced_anon ? _('enabled') : _('disabled')) + ')'); | |||||
$('div#forced-anon a').click(function() { | |||||
$(selector).on(event, function() { | |||||
forced_anon = !forced_anon; | forced_anon = !forced_anon; | ||||
if(forced_anon) { | if(forced_anon) { | ||||
@@ -76,8 +90,13 @@ $(document).ready(function() { | |||||
return false; | return false; | ||||
}); | }); | ||||
if(forced_anon) | |||||
if(forced_anon) { | |||||
enable_fa(); | enable_fa(); | ||||
if (window.Options && Options.get_tab('general')) { | |||||
$('#toggle-locked-threads>input').prop('checked', true); | |||||
} | |||||
} | |||||
$(document).on('new_post', function(e, post) { | $(document).on('new_post', function(e, post) { | ||||
if(forced_anon) | if(forced_anon) | ||||
@@ -2,9 +2,13 @@ | |||||
* no-animated-gif.js - Toggle GIF animated thumbnails when gifsicle is enabled | * no-animated-gif.js - Toggle GIF animated thumbnails when gifsicle is enabled | ||||
* | * | ||||
* Copyright (c) 2014 Fredrick Brennan <admin@8chan.co> | * Copyright (c) 2014 Fredrick Brennan <admin@8chan.co> | ||||
* Copyright (c) 2014 Marcin Łabanowski <marcin@6irc.net> | |||||
* | * | ||||
* Usage: | * Usage: | ||||
* $config['additional_javascript'][] = 'js/jquery.min.js'; | * $config['additional_javascript'][] = 'js/jquery.min.js'; | ||||
* //$config['additional_javascript'][] = 'js/options.js'; | |||||
* //$config['additional_javascript'][] = 'js/style-select.js'; | |||||
* //$config['additional_javascript'][] = 'js/options/general.js'; | |||||
* $config['additional_javascript'][] = 'js/no-animated-gif.js'; | * $config['additional_javascript'][] = 'js/no-animated-gif.js'; | ||||
*/ | */ | ||||
@@ -31,6 +35,7 @@ function no_animated_gif() { | |||||
var anim_gifs = $('img.post-image[src$=".gif"]'); | var anim_gifs = $('img.post-image[src$=".gif"]'); | ||||
localStorage.no_animated_gif = true; | localStorage.no_animated_gif = true; | ||||
$('#no-animated-gif>a').text(_('Animate GIFs')); | $('#no-animated-gif>a').text(_('Animate GIFs')); | ||||
$('#no-animated-gif>input').prop('checked', true); | |||||
$.each(anim_gifs, function(i, e) {unanimate_gif(e)} ); | $.each(anim_gifs, function(i, e) {unanimate_gif(e)} ); | ||||
} | } | ||||
@@ -40,14 +45,24 @@ function animated_gif() { | |||||
$('img.post-image').removeClass("unanimated").show(); | $('img.post-image').removeClass("unanimated").show(); | ||||
localStorage.no_animated_gif = false; | localStorage.no_animated_gif = false; | ||||
$('#no-animated-gif>a').text(_('Unanimate GIFs')); | $('#no-animated-gif>a').text(_('Unanimate GIFs')); | ||||
$('#no-animated-gif>input').prop('checked', false); | |||||
} | } | ||||
if (active_page == 'thread' || active_page == 'index' || active_page == 'ukko') { | if (active_page == 'thread' || active_page == 'index' || active_page == 'ukko') { | ||||
onready(function(){ | |||||
$('hr:first').before('<div id="no-animated-gif" style="text-align:right"><a class="unimportant" href="javascript:void(0)">'+_('Unanimate GIFs')+'</a></div>') | |||||
$(function(){ | |||||
var selector, event; | |||||
if (window.Options && Options.get_tab('general')) { | |||||
selector = '#no-animated-gif>input'; | |||||
event = 'change'; | |||||
Options.extend_tab("general", "<label id='no-animated-gif'><input type='checkbox' /> "+_('Unanimate GIFs')+"</label>"); | |||||
} | |||||
else { | |||||
selector = '#no-animated-gif'; | |||||
event = 'click'; | |||||
$('hr:first').before('<div id="no-animated-gif" style="text-align:right"><a class="unimportant" href="javascript:void(0)">'+_('Unanimate GIFs')+'</a></div>') | |||||
} | |||||
$('#no-animated-gif').on('click', function() { | |||||
$(selector).on(event, function() { | |||||
if (localStorage.no_animated_gif === 'true') { | if (localStorage.no_animated_gif === 'true') { | ||||
animated_gif(); | animated_gif(); | ||||
} else { | } else { | ||||
@@ -56,6 +71,6 @@ if (active_page == 'thread' || active_page == 'index' || active_page == 'ukko') | |||||
}); | }); | ||||
if (localStorage.no_animated_gif === 'true') | if (localStorage.no_animated_gif === 'true') | ||||
$(document).ready(no_animated_gif); | |||||
no_animated_gif(); | |||||
}); | }); | ||||
} | } |
@@ -37,6 +37,13 @@ $(function(){ | |||||
document.location.reload(); | document.location.reload(); | ||||
}); | }); | ||||
$("<button>"+_("Erase")+"</button>").appendTo(stor).on("click", function() { | |||||
if (confirm(_("Are you sure you want to erase your storage? This involves your hidden threads, watched threads, post password and many more."))) { | |||||
localStorage.clear(); | |||||
document.location.reload(); | |||||
} | |||||
}); | |||||
$("#style-select").detach().css({float:"none","margin-bottom":0}).appendTo(tab.content); | $("#style-select").detach().css({float:"none","margin-bottom":0}).appendTo(tab.content); | ||||
}); | }); | ||||
@@ -7,6 +7,9 @@ | |||||
* | * | ||||
* Usage: | * Usage: | ||||
* $config['additional_javascript'][] = 'js/jquery.min.js'; | * $config['additional_javascript'][] = 'js/jquery.min.js'; | ||||
* //$config['additional_javascript'][] = 'js/options.js'; | |||||
* //$config['additional_javascript'][] = 'js/style-select.js'; | |||||
* //$config['additional_javascript'][] = 'js/options/general.js'; | |||||
* $config['additional_javascript'][] = 'js/toggle-images.js'; | * $config['additional_javascript'][] = 'js/toggle-images.js'; | ||||
* | * | ||||
*/ | */ | ||||
@@ -53,10 +56,22 @@ $(document).ready(function(){ | |||||
} | } | ||||
}; | }; | ||||
$('hr:first').before('<div id="toggle-images" style="text-align:right"><a class="unimportant" href="javascript:void(0)">-</a></div>'); | |||||
$('div#toggle-images a') | |||||
.text(hide_images ? _('Show images') : _('Hide images')) | |||||
.click(function() { | |||||
var selector, event; | |||||
if (window.Options && Options.get_tab('general')) { | |||||
selector = '#toggle-images>input'; | |||||
event = 'change'; | |||||
Options.extend_tab("general", "<label id='toggle-images'><input type='checkbox' /> "+_('Hide images')+"</label>"); | |||||
} | |||||
else { | |||||
selector = '#toggle-images a'; | |||||
event = 'click'; | |||||
$('hr:first').before('<div id="toggle-images" style="text-align:right"><a class="unimportant" href="javascript:void(0)">-</a></div>'); | |||||
$('div#toggle-images a') | |||||
.text(hide_images ? _('Show images') : _('Hide images')); | |||||
} | |||||
$(selector) | |||||
.on(event, function() { | |||||
hide_images = !hide_images; | hide_images = !hide_images; | ||||
if (hide_images) { | if (hide_images) { | ||||
$('img.post-image, .theme-catalog .thread>a>img').each(hideImage); | $('img.post-image, .theme-catalog .thread>a>img').each(hideImage); | ||||
@@ -74,6 +89,10 @@ $(document).ready(function(){ | |||||
if (hide_images) { | if (hide_images) { | ||||
$('img.post-image, .theme-catalog .thread>a>img').each(hideImage); | $('img.post-image, .theme-catalog .thread>a>img').each(hideImage); | ||||
show_hide_hide_images_buttons(); | show_hide_hide_images_buttons(); | ||||
if (window.Options && Options.get_tab('general')) { | |||||
$('#toggle-images>input').prop('checked', true); | |||||
} | |||||
} | } | ||||
$(document).on('new_post', function(e, post) { | $(document).on('new_post', function(e, post) { | ||||
@@ -7,20 +7,21 @@ | |||||
* | * | ||||
* Usage: | * Usage: | ||||
* $config['additional_javascript'][] = 'js/jquery.min.js'; | * $config['additional_javascript'][] = 'js/jquery.min.js'; | ||||
* //$config['additional_javascript'][] = 'js/options.js'; | |||||
* //$config['additional_javascript'][] = 'js/style-select.js'; | |||||
* //$config['additional_javascript'][] = 'js/options/general.js'; | |||||
* $config['additional_javascript'][] = 'js/toggle-locked-threads.js'; | * $config['additional_javascript'][] = 'js/toggle-locked-threads.js'; | ||||
* | * | ||||
*/ | */ | ||||
if (active_page == 'ukko' || active_page == 'index') | |||||
if (active_page == 'ukko' || active_page == 'index' || (window.Options && Options.get_tab('general'))) | |||||
$(document).ready(function(){ | $(document).ready(function(){ | ||||
if($('div.banner').length != 0) | |||||
return; // not index | |||||
var hide_locked_threads = localStorage['hidelockedthreads'] ? true : false; | var hide_locked_threads = localStorage['hidelockedthreads'] ? true : false; | ||||
$('<style type="text/css"> img.hidden{ opacity: 0.1; background: grey; border: 1px solid #000; } </style>').appendTo($('head')); | $('<style type="text/css"> img.hidden{ opacity: 0.1; background: grey; border: 1px solid #000; } </style>').appendTo($('head')); | ||||
var hideLockedThread = function($thread) { | var hideLockedThread = function($thread) { | ||||
if (active_page == 'ukko' || active_page == 'index') | |||||
$thread | $thread | ||||
.hide() | .hide() | ||||
.addClass('hidden'); | .addClass('hidden'); | ||||
@@ -35,11 +36,24 @@ $(document).ready(function(){ | |||||
var getThreadFromIcon = function($icon) { | var getThreadFromIcon = function($icon) { | ||||
return $icon.parent().parent().parent() | return $icon.parent().parent().parent() | ||||
}; | }; | ||||
var selector, event; | |||||
if (window.Options && Options.get_tab('general')) { | |||||
selector = '#toggle-locked-threads>input'; | |||||
event = 'change'; | |||||
Options.extend_tab("general", "<label id='toggle-locked-threads'><input type='checkbox' /> "+_('Hide locked threads')+"</label>"); | |||||
} | |||||
else { | |||||
selector = '#toggle-locked-threads a'; | |||||
event = 'click'; | |||||
$('hr:first').before('<div id="toggle-locked-threads" style="text-align:right"><a class="unimportant" href="javascript:void(0)">-</a></div>'); | |||||
} | |||||
$('hr:first').before('<div id="toggle-locked-threads" style="text-align:right"><a class="unimportant" href="javascript:void(0)">-</a></div>'); | |||||
$('div#toggle-locked-threads a') | $('div#toggle-locked-threads a') | ||||
.text(hide_locked_threads ? _('Show locked threads') : _('Hide locked threads')) | |||||
.click(function() { | |||||
.text(hide_locked_threads ? _('Show locked threads') : _('Hide locked threads')); | |||||
$(selector) | |||||
.on(event, function() { | |||||
hide_locked_threads = !hide_locked_threads; | hide_locked_threads = !hide_locked_threads; | ||||
if (hide_locked_threads) { | if (hide_locked_threads) { | ||||
$('img.icon[title="Locked"], i.fa-lock.fa').each(function() { | $('img.icon[title="Locked"], i.fa-lock.fa').each(function() { | ||||
@@ -60,6 +74,10 @@ $(document).ready(function(){ | |||||
$('img.icon[title="Locked"], i.fa-lock.fa').each(function() { | $('img.icon[title="Locked"], i.fa-lock.fa').each(function() { | ||||
hideLockedThread(getThreadFromIcon($(this))); | hideLockedThread(getThreadFromIcon($(this))); | ||||
}); | }); | ||||
if (window.Options && Options.get_tab('general')) { | |||||
$('#toggle-locked-threads>input').prop('checked', true); | |||||
} | |||||
} | } | ||||
$(document).on('new_post', function(e, post) { | $(document).on('new_post', function(e, post) { | ||||
if (hide_locked_threads) { | if (hide_locked_threads) { | ||||