diff --git a/js/catalog-search.js b/js/catalog-search.js index 17a8edac..ff9af785 100644 --- a/js/catalog-search.js +++ b/js/catalog-search.js @@ -34,16 +34,16 @@ if (active_page == 'catalog') { } function searchToggle() { - var button = $('#catalog_search_button')[0]; + var button = $('#catalog_search_button'); - if (!button.dataset.expanded) { - button.dataset.expanded = '1'; - button.innerText = 'Close'; + if (!button.data('expanded')) { + button.data('expanded', '1'); + button.text('Close'); $('.catalog_search').append(' '); $('#search_field').focus(); } else { - delete button.dataset.expanded; - button.innerText = 'Search'; + button.removeData('expanded'); + button.text('Search'); $('.catalog_search').children().last().remove(); $('div[id="Grid"]>.mix').each(function () { $(this).css('display', 'inline-block'); }); } diff --git a/js/expand-all-images.js b/js/expand-all-images.js index 6d7b4ca0..c110f51c 100644 --- a/js/expand-all-images.js +++ b/js/expand-all-images.js @@ -31,7 +31,7 @@ onready(function(){ if (/^\/player\.php\?/.test($(this).parent().attr('href'))) return; - if (!$(this).parent()[0].dataset.expanded) + if (!$(this).parent().data('expanded')) $(this).parent().click(); }); @@ -43,7 +43,7 @@ onready(function(){ .text(_('Shrink all images')) .click(function(){ $('a img.full-image').each(function() { - if ($(this).parent()[0].dataset.expanded) + if ($(this).parent().data('expanded')) $(this).parent().click(); }); $(this).parent().remove(); diff --git a/js/hide-images.js b/js/hide-images.js index 023c166c..7b21d638 100644 --- a/js/hide-images.js +++ b/js/hide-images.js @@ -77,7 +77,7 @@ $(document).ready(function(){ $(this).hide().after(show_link); - if ($(img).parent()[0].dataset.expanded == 'true') { + if ($(img).parent().data('expanded') == 'true') { $(img).parent().click(); } diff --git a/js/id_colors.js b/js/id_colors.js index 17f8b4d9..6335f960 100644 --- a/js/id_colors.js +++ b/js/id_colors.js @@ -1,18 +1,18 @@ if (active_page == 'thread' || active_page == 'index') { $(document).ready(function(){ if (window.Options && Options.get_tab('general')) { - selector = '#color-ids>input'; - event = 'change'; + var selector = '#color-ids>input'; + var e = 'change'; Options.extend_tab("general", ""); } else { - selector = '#color-ids'; - event = 'click'; + var selector = '#color-ids'; + var e = 'click'; $('hr:first').before('
') } - $(selector).on(event, function() { + $(selector).on(e, function() { if (localStorage.color_ids === 'true') { localStorage.color_ids = 'false'; } else { diff --git a/js/inline-expanding.js b/js/inline-expanding.js index 92069689..e316fbb7 100644 --- a/js/inline-expanding.js +++ b/js/inline-expanding.js @@ -48,8 +48,8 @@ $(document).ready(function(){ if (i > -1) { waiting.splice(i, 1); } - if (ele.dataset.imageLoading === 'true') { - ele.dataset.imageLoading = 'false'; + if ($(ele).data('imageLoading') === 'true') { + $(ele).data('imageLoading', 'false'); clearTimeout(ele.timeout); --loading; } @@ -73,7 +73,7 @@ $(document).ready(function(){ $.when($loadstart).done(function () { // once fully loaded, update the waiting queue --loading; - ele.dataset.imageLoading = 'false'; + $(ele).data('imageLoading', 'false'); update(); }); }); @@ -83,7 +83,7 @@ $(document).ready(function(){ }); img.setAttribute('src', ele.href); - ele.dataset.imageLoading = 'true'; + $(ele).data('imageLoading', 'true'); ele.timeout = onLoadStart(img); }); @@ -112,9 +112,9 @@ $(document).ready(function(){ return false; if (e.which == 2 || e.ctrlKey) // open in new tab return true; - if (!this.dataset.expanded) { + if (!$(this).data('expanded')) { this.parentNode.removeAttribute('style'); - this.dataset.expanded = 'true'; + $(this).data('expanded', 'true'); if (thumb.tagName === 'CANVAS') { canvas = thumb; @@ -144,12 +144,12 @@ $(document).ready(function(){ } if (~this.parentNode.className.indexOf('multifile')) - this.parentNode.style.width = (parseInt(this.dataset.width)+40)+'px'; + this.parentNode.style.width = (parseInt($(this).data('width'))+40)+'px'; thumb.style.opacity = ''; thumb.style.display = ''; if (thumb.nextSibling) this.removeChild(thumb.nextSibling); //full image loaded or loading - delete this.dataset.expanded; + $(this).removeData('expanded'); delete thumb.style.filter; // do the scrolling after page reflow diff --git a/js/post-filter.js b/js/post-filter.js index d5225f45..b3f633f7 100644 --- a/js/post-filter.js +++ b/js/post-filter.js @@ -174,10 +174,10 @@ if (active_page === 'thread' || active_page === 'index') { function hide(ele) { var $ele = $(ele); - if (ele.dataset.hidden == '1') + if ($(ele).data('hidden') === '1') return; - ele.dataset.hidden = '1'; + $(ele).data('hidden', '1'); if ($ele.hasClass('op')) { $ele.parent().find('.body, .files, .video-container').not($ele.children('.reply').children()).hide(); @@ -191,7 +191,7 @@ if (active_page === 'thread' || active_page === 'index') { function show(ele) { var $ele = $(ele); - ele.dataset.hidden = '0'; + $(ele).data('hidden', '0'); if ($ele.hasClass('op')) { $ele.parent().find('.body, .files, .video-container').show(); if (active_page == 'index') $ele.parent().find('.omitted, .reply:not(.hidden), post_no, .mentioned, br').show(); @@ -254,8 +254,8 @@ if (active_page === 'thread' || active_page === 'index') { */ // unhide button - if (ele.dataset.hidden == '1' && ele.dataset.hiddenByUid == '0' && - ele.dataset.hiddenByName == '0' && ele.dataset.hiddenByTrip == '0') { + if ($(ele).data('hidden') == '1' && $(ele).data('hiddenByUid') == '0' && + $(ele).data('hiddenByName') == '0' && $(ele).data('hiddenByTrip') == '0') { $buffer.find('#filter-menu-unhide').click(function () { // if hidden due to post id, remove it from blacklist // otherwise just show this post @@ -267,7 +267,7 @@ if (active_page === 'thread' || active_page === 'index') { } // post id - if (ele.dataset.hiddenByPost == '0') { + if ($(ele).data('hiddenByPost') == '0') { $buffer.find('#filter-menu-add .filter-post').click(function () { blacklist.add.post(pageData.boardId, threadId, postId, false); }); @@ -280,7 +280,7 @@ if (active_page === 'thread' || active_page === 'index') { } // UID - if (pageData.hasUID && ele.dataset.hiddenByUid == '0') { + if (pageData.hasUID && $(ele).data('hiddenByUid') == '0') { $buffer.find('#filter-menu-add .filter-id').click(function () { blacklist.add.uid(pageData.boardId, threadId, postUid, false); }); @@ -304,7 +304,7 @@ if (active_page === 'thread' || active_page === 'index') { } // name - if (!pageData.forcedAnon && ele.dataset.hiddenByName == '0') { + if (!pageData.forcedAnon && $(ele).data('hiddenByName') == '0') { $buffer.find('#filter-menu-add .filter-name').click(function () { blacklist.add.name(postName); }); @@ -323,7 +323,7 @@ if (active_page === 'thread' || active_page === 'index') { } // tripcode - if (!pageData.forcedAnon && ele.dataset.hiddenByTrip == '0' && postTrip !== '') { + if (!pageData.forcedAnon && $(ele).data('hiddenByTrip') == '0' && postTrip !== '') { $buffer.find('#filter-menu-add .filter-trip').click(function () { blacklist.add.trip(postTrip); }); @@ -408,11 +408,11 @@ if (active_page === 'thread' || active_page === 'index') { var hasUID = pageData.hasUID; var forcedAnon = pageData.forcedAnon; - post.dataset.hidden = '0'; - post.dataset.hiddenByUid = '0'; - post.dataset.hiddenByPost = '0'; - post.dataset.hiddenByName = '0'; - post.dataset.hiddenByTrip = '0'; + $post.data('hidden', '0'); + $post.data('hiddenByUid', '0'); + $post.data('hiddenByPost', '0'); + $post.data('hiddenByName', '0'); + $post.data('hiddenByTrip', '0'); // add post with matched UID to localList if (hasUID && @@ -423,7 +423,7 @@ if (active_page === 'thread' || active_page === 'index') { for (i=0; i