Browse Source

update to comply with jQuery 3.3.1

nin-v2
Simon Grim 6 years ago
parent
commit
0ba21b0a26
  1. 27
      js/theme_option.js

27
js/theme_option.js

@ -1,17 +1,13 @@
$(window).resize(function() $(window).on('resize', function () {
{
testRightSide(); testRightSide();
reAppendModules(); reAppendModules();
}); });
$(window).load(function() $(window).on('load', function () {
{
testRightSide(); testRightSide();
}); });
$(function () {
$(document).ready(function()
{
testRightSide(); testRightSide();
reOrganizeTemplates(); reOrganizeTemplates();
@ -21,13 +17,13 @@ $(document).ready(function()
$.globalEval(openModal.toString().replace(/window_scrollY = window\.pageYOffset;/, '') $.globalEval(openModal.toString().replace(/window_scrollY = window\.pageYOffset;/, '')
.replace(/\$\('body'\)\.css\('overflow', 'hidden'\);/, '')); .replace(/\$\('body'\)\.css\('overflow', 'hidden'\);/, ''));
$( '.userMenu-home.current a' ).on( 'click', function() { $('.userMenu-home.current a').on('click', function () {
$('html, body').animate({scrollTop:0},300); $('html, body').animate({scrollTop:0},300);
return false return false
}); });
// modify the way promoted posts are shown // modify the way promoted posts are shown
$( ".promoted-posts-only").click(function() { $('.promoted-posts-only').on('click', function () {
//active promoted posts tab //active promoted posts tab
$(this).children('.promoted-posts').addClass(promotedPostsOnly ? "active" : "disabled"); $(this).children('.promoted-posts').addClass(promotedPostsOnly ? "active" : "disabled");
$(this).children('.normal-posts').addClass(promotedPostsOnly ? "disabled" : "active"); $(this).children('.normal-posts').addClass(promotedPostsOnly ? "disabled" : "active");
@ -39,11 +35,10 @@ $(document).ready(function()
}); });
if (/\/options.html$/i.test(document.location)) if (/\/options.html$/i.test(document.location))
$(document).ready(localizeLabels); localizeLabels();
$(window).scroll(function(){ $(window).on('scroll', function () {
window_scrollY = window.pageYOffset; // declare variable here for screen not to scroll when closing modals window_scrollY = window.pageYOffset; // declare variable here for screen not to scroll when closing modals
}); });
// Collapse all .post.open // Collapse all .post.open
@ -108,7 +103,7 @@ function reOrganizeTemplates() { // for nin's templating
.addClass('ion') .addClass('ion')
.addClass('ion-plus') .addClass('ion-plus')
.appendTo('.userMenu-newPost') .appendTo('.userMenu-newPost')
.bind( 'click', function() { .on('click', function () {
if(!$('.mini-profile .post-area').hasClass('display')) {$('.mini-profile .post-area').addClass('display');} if(!$('.mini-profile .post-area').hasClass('display')) {$('.mini-profile .post-area').addClass('display');}
else {$('.mini-profile .post-area').removeClass('display');} else {$('.mini-profile .post-area').removeClass('display');}
return false; return false;
@ -119,10 +114,10 @@ function reOrganizeTemplates() { // for nin's templating
.addClass('modal-header') .addClass('modal-header')
.prependTo('.mini-profile .post-area'); .prependTo('.mini-profile .post-area');
$('.mini-profile .post-area .post-submit').bind( 'click', function() { $('.mini-profile .post-area .post-submit').on('click', function () {
$('.mini-profile .post-area').removeClass('display'); $('.mini-profile .post-area').removeClass('display');
}); });
$('.mini-profile .post-area .modal-close').bind( 'click', function() { $('.mini-profile .post-area .modal-close').on('click', function () {
$('.mini-profile .post-area').removeClass('display'); $('.mini-profile .post-area').removeClass('display');
}); });
@ -139,7 +134,7 @@ function reOrganizeTemplates() { // for nin's templating
} }
// Close new post prompt with esc key // Close new post prompt with esc key
$(document).keyup(function(e) { $(document).on('keyup', function (e) {
if (e.keyCode == 27) { if (e.keyCode == 27) {
$('.mini-profile .post-area').removeClass('display'); $('.mini-profile .post-area').removeClass('display');
closeModal(); closeModal();

Loading…
Cancel
Save