mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-23 23:20:57 +01:00
Fix many features for Internet Explorer 9 and 10
Please don't use "dataset" in scripts anymore, it doesn't work in IE9 or 10. Instead use $.data
This commit is contained in:
parent
88f6088a42
commit
5176377045
@ -34,16 +34,16 @@ if (active_page == 'catalog') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function searchToggle() {
|
function searchToggle() {
|
||||||
var button = $('#catalog_search_button')[0];
|
var button = $('#catalog_search_button');
|
||||||
|
|
||||||
if (!button.dataset.expanded) {
|
if (!button.data('expanded')) {
|
||||||
button.dataset.expanded = '1';
|
button.data('expanded', '1');
|
||||||
button.innerText = 'Close';
|
button.text('Close');
|
||||||
$('.catalog_search').append(' <input id="search_field" style="border: inset 1px;">');
|
$('.catalog_search').append(' <input id="search_field" style="border: inset 1px;">');
|
||||||
$('#search_field').focus();
|
$('#search_field').focus();
|
||||||
} else {
|
} else {
|
||||||
delete button.dataset.expanded;
|
button.removeData('expanded');
|
||||||
button.innerText = 'Search';
|
button.text('Search');
|
||||||
$('.catalog_search').children().last().remove();
|
$('.catalog_search').children().last().remove();
|
||||||
$('div[id="Grid"]>.mix').each(function () { $(this).css('display', 'inline-block'); });
|
$('div[id="Grid"]>.mix').each(function () { $(this).css('display', 'inline-block'); });
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ onready(function(){
|
|||||||
if (/^\/player\.php\?/.test($(this).parent().attr('href')))
|
if (/^\/player\.php\?/.test($(this).parent().attr('href')))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!$(this).parent()[0].dataset.expanded)
|
if (!$(this).parent().data('expanded'))
|
||||||
$(this).parent().click();
|
$(this).parent().click();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ onready(function(){
|
|||||||
.text(_('Shrink all images'))
|
.text(_('Shrink all images'))
|
||||||
.click(function(){
|
.click(function(){
|
||||||
$('a img.full-image').each(function() {
|
$('a img.full-image').each(function() {
|
||||||
if ($(this).parent()[0].dataset.expanded)
|
if ($(this).parent().data('expanded'))
|
||||||
$(this).parent().click();
|
$(this).parent().click();
|
||||||
});
|
});
|
||||||
$(this).parent().remove();
|
$(this).parent().remove();
|
||||||
|
@ -77,7 +77,7 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
$(this).hide().after(show_link);
|
$(this).hide().after(show_link);
|
||||||
|
|
||||||
if ($(img).parent()[0].dataset.expanded == 'true') {
|
if ($(img).parent().data('expanded') == 'true') {
|
||||||
$(img).parent().click();
|
$(img).parent().click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
if (active_page == 'thread' || active_page == 'index') {
|
if (active_page == 'thread' || active_page == 'index') {
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
if (window.Options && Options.get_tab('general')) {
|
if (window.Options && Options.get_tab('general')) {
|
||||||
selector = '#color-ids>input';
|
var selector = '#color-ids>input';
|
||||||
event = 'change';
|
var e = 'change';
|
||||||
Options.extend_tab("general", "<label id='color-ids'><input type='checkbox' /> "+_('Color IDs')+"</label>");
|
Options.extend_tab("general", "<label id='color-ids'><input type='checkbox' /> "+_('Color IDs')+"</label>");
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
selector = '#color-ids';
|
var selector = '#color-ids';
|
||||||
event = 'click';
|
var e = 'click';
|
||||||
$('hr:first').before('<div id="color-ids" style="text-align:right"><a class="unimportant" href="javascript:void(0)">'+_('Color IDs')+'</a></div>')
|
$('hr:first').before('<div id="color-ids" style="text-align:right"><a class="unimportant" href="javascript:void(0)">'+_('Color IDs')+'</a></div>')
|
||||||
}
|
}
|
||||||
|
|
||||||
$(selector).on(event, function() {
|
$(selector).on(e, function() {
|
||||||
if (localStorage.color_ids === 'true') {
|
if (localStorage.color_ids === 'true') {
|
||||||
localStorage.color_ids = 'false';
|
localStorage.color_ids = 'false';
|
||||||
} else {
|
} else {
|
||||||
|
@ -48,8 +48,8 @@ $(document).ready(function(){
|
|||||||
if (i > -1) {
|
if (i > -1) {
|
||||||
waiting.splice(i, 1);
|
waiting.splice(i, 1);
|
||||||
}
|
}
|
||||||
if (ele.dataset.imageLoading === 'true') {
|
if ($(ele).data('imageLoading') === 'true') {
|
||||||
ele.dataset.imageLoading = 'false';
|
$(ele).data('imageLoading', 'false');
|
||||||
clearTimeout(ele.timeout);
|
clearTimeout(ele.timeout);
|
||||||
--loading;
|
--loading;
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ $(document).ready(function(){
|
|||||||
$.when($loadstart).done(function () {
|
$.when($loadstart).done(function () {
|
||||||
// once fully loaded, update the waiting queue
|
// once fully loaded, update the waiting queue
|
||||||
--loading;
|
--loading;
|
||||||
ele.dataset.imageLoading = 'false';
|
$(ele).data('imageLoading', 'false');
|
||||||
update();
|
update();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -83,7 +83,7 @@ $(document).ready(function(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
img.setAttribute('src', ele.href);
|
img.setAttribute('src', ele.href);
|
||||||
ele.dataset.imageLoading = 'true';
|
$(ele).data('imageLoading', 'true');
|
||||||
ele.timeout = onLoadStart(img);
|
ele.timeout = onLoadStart(img);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -112,9 +112,9 @@ $(document).ready(function(){
|
|||||||
return false;
|
return false;
|
||||||
if (e.which == 2 || e.ctrlKey) // open in new tab
|
if (e.which == 2 || e.ctrlKey) // open in new tab
|
||||||
return true;
|
return true;
|
||||||
if (!this.dataset.expanded) {
|
if (!$(this).data('expanded')) {
|
||||||
this.parentNode.removeAttribute('style');
|
this.parentNode.removeAttribute('style');
|
||||||
this.dataset.expanded = 'true';
|
$(this).data('expanded', 'true');
|
||||||
|
|
||||||
if (thumb.tagName === 'CANVAS') {
|
if (thumb.tagName === 'CANVAS') {
|
||||||
canvas = thumb;
|
canvas = thumb;
|
||||||
@ -144,12 +144,12 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (~this.parentNode.className.indexOf('multifile'))
|
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.opacity = '';
|
||||||
thumb.style.display = '';
|
thumb.style.display = '';
|
||||||
if (thumb.nextSibling) this.removeChild(thumb.nextSibling); //full image loaded or loading
|
if (thumb.nextSibling) this.removeChild(thumb.nextSibling); //full image loaded or loading
|
||||||
delete this.dataset.expanded;
|
$(this).removeData('expanded');
|
||||||
delete thumb.style.filter;
|
delete thumb.style.filter;
|
||||||
|
|
||||||
// do the scrolling after page reflow
|
// do the scrolling after page reflow
|
||||||
|
@ -174,10 +174,10 @@ if (active_page === 'thread' || active_page === 'index') {
|
|||||||
function hide(ele) {
|
function hide(ele) {
|
||||||
var $ele = $(ele);
|
var $ele = $(ele);
|
||||||
|
|
||||||
if (ele.dataset.hidden == '1')
|
if ($(ele).data('hidden') === '1')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ele.dataset.hidden = '1';
|
$(ele).data('hidden', '1');
|
||||||
if ($ele.hasClass('op')) {
|
if ($ele.hasClass('op')) {
|
||||||
$ele.parent().find('.body, .files, .video-container').not($ele.children('.reply').children()).hide();
|
$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) {
|
function show(ele) {
|
||||||
var $ele = $(ele);
|
var $ele = $(ele);
|
||||||
|
|
||||||
ele.dataset.hidden = '0';
|
$(ele).data('hidden', '0');
|
||||||
if ($ele.hasClass('op')) {
|
if ($ele.hasClass('op')) {
|
||||||
$ele.parent().find('.body, .files, .video-container').show();
|
$ele.parent().find('.body, .files, .video-container').show();
|
||||||
if (active_page == 'index') $ele.parent().find('.omitted, .reply:not(.hidden), post_no, .mentioned, br').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
|
// unhide button
|
||||||
if (ele.dataset.hidden == '1' && ele.dataset.hiddenByUid == '0' &&
|
if ($(ele).data('hidden') == '1' && $(ele).data('hiddenByUid') == '0' &&
|
||||||
ele.dataset.hiddenByName == '0' && ele.dataset.hiddenByTrip == '0') {
|
$(ele).data('hiddenByName') == '0' && $(ele).data('hiddenByTrip') == '0') {
|
||||||
$buffer.find('#filter-menu-unhide').click(function () {
|
$buffer.find('#filter-menu-unhide').click(function () {
|
||||||
// if hidden due to post id, remove it from blacklist
|
// if hidden due to post id, remove it from blacklist
|
||||||
// otherwise just show this post
|
// otherwise just show this post
|
||||||
@ -267,7 +267,7 @@ if (active_page === 'thread' || active_page === 'index') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// post id
|
// post id
|
||||||
if (ele.dataset.hiddenByPost == '0') {
|
if ($(ele).data('hiddenByPost') == '0') {
|
||||||
$buffer.find('#filter-menu-add .filter-post').click(function () {
|
$buffer.find('#filter-menu-add .filter-post').click(function () {
|
||||||
blacklist.add.post(pageData.boardId, threadId, postId, false);
|
blacklist.add.post(pageData.boardId, threadId, postId, false);
|
||||||
});
|
});
|
||||||
@ -280,7 +280,7 @@ if (active_page === 'thread' || active_page === 'index') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// UID
|
// UID
|
||||||
if (pageData.hasUID && ele.dataset.hiddenByUid == '0') {
|
if (pageData.hasUID && $(ele).data('hiddenByUid') == '0') {
|
||||||
$buffer.find('#filter-menu-add .filter-id').click(function () {
|
$buffer.find('#filter-menu-add .filter-id').click(function () {
|
||||||
blacklist.add.uid(pageData.boardId, threadId, postUid, false);
|
blacklist.add.uid(pageData.boardId, threadId, postUid, false);
|
||||||
});
|
});
|
||||||
@ -304,7 +304,7 @@ if (active_page === 'thread' || active_page === 'index') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// name
|
// name
|
||||||
if (!pageData.forcedAnon && ele.dataset.hiddenByName == '0') {
|
if (!pageData.forcedAnon && $(ele).data('hiddenByName') == '0') {
|
||||||
$buffer.find('#filter-menu-add .filter-name').click(function () {
|
$buffer.find('#filter-menu-add .filter-name').click(function () {
|
||||||
blacklist.add.name(postName);
|
blacklist.add.name(postName);
|
||||||
});
|
});
|
||||||
@ -323,7 +323,7 @@ if (active_page === 'thread' || active_page === 'index') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// tripcode
|
// 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 () {
|
$buffer.find('#filter-menu-add .filter-trip').click(function () {
|
||||||
blacklist.add.trip(postTrip);
|
blacklist.add.trip(postTrip);
|
||||||
});
|
});
|
||||||
@ -408,11 +408,11 @@ if (active_page === 'thread' || active_page === 'index') {
|
|||||||
var hasUID = pageData.hasUID;
|
var hasUID = pageData.hasUID;
|
||||||
var forcedAnon = pageData.forcedAnon;
|
var forcedAnon = pageData.forcedAnon;
|
||||||
|
|
||||||
post.dataset.hidden = '0';
|
$post.data('hidden', '0');
|
||||||
post.dataset.hiddenByUid = '0';
|
$post.data('hiddenByUid', '0');
|
||||||
post.dataset.hiddenByPost = '0';
|
$post.data('hiddenByPost', '0');
|
||||||
post.dataset.hiddenByName = '0';
|
$post.data('hiddenByName', '0');
|
||||||
post.dataset.hiddenByTrip = '0';
|
$post.data('hiddenByTrip', '0');
|
||||||
|
|
||||||
// add post with matched UID to localList
|
// add post with matched UID to localList
|
||||||
if (hasUID &&
|
if (hasUID &&
|
||||||
@ -423,7 +423,7 @@ if (active_page === 'thread' || active_page === 'index') {
|
|||||||
|
|
||||||
for (i=0; i<array.length; i++) {
|
for (i=0; i<array.length; i++) {
|
||||||
if (array[i].uid == uid) {
|
if (array[i].uid == uid) {
|
||||||
post.dataset.hiddenByUid = '1';
|
$post.data('hiddenByUid', '1');
|
||||||
localList.push(postId);
|
localList.push(postId);
|
||||||
if (array[i].hideReplies) noReplyList.push(postId);
|
if (array[i].hideReplies) noReplyList.push(postId);
|
||||||
break;
|
break;
|
||||||
@ -434,7 +434,7 @@ if (active_page === 'thread' || active_page === 'index') {
|
|||||||
// match localList
|
// match localList
|
||||||
if (localList.length) {
|
if (localList.length) {
|
||||||
if ($.inArray(postId, localList) != -1) {
|
if ($.inArray(postId, localList) != -1) {
|
||||||
if (post.dataset.hiddenByUid != '1') post.dataset.hiddenByPost = '1';
|
if ($post.data('hiddenByUid') != '1') $post.data('hiddenByPost', '1');
|
||||||
hide(post);
|
hide(post);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -443,13 +443,13 @@ if (active_page === 'thread' || active_page === 'index') {
|
|||||||
if (!forcedAnon) {
|
if (!forcedAnon) {
|
||||||
name = (typeof $post.find('.name').contents()[0] == 'undefined') ? '' : $post.find('.name').contents()[0].nodeValue.trim();
|
name = (typeof $post.find('.name').contents()[0] == 'undefined') ? '' : $post.find('.name').contents()[0].nodeValue.trim();
|
||||||
if ($(list.nameFilter).filter(function(){if (this.name == name) return true;}).length) {
|
if ($(list.nameFilter).filter(function(){if (this.name == name) return true;}).length) {
|
||||||
post.dataset.hiddenByName = '1';
|
$post.data('hiddenByName', '1');
|
||||||
hide(post);
|
hide(post);
|
||||||
}
|
}
|
||||||
if ($post.find('.trip').length) {
|
if ($post.find('.trip').length) {
|
||||||
trip = $post.find('.trip').text();
|
trip = $post.find('.trip').text();
|
||||||
if ($(list.nameFilter).filter(function(){if (this.trip == trip) return true;}).length) {
|
if ($(list.nameFilter).filter(function(){if (this.trip == trip) return true;}).length) {
|
||||||
post.dataset.hiddenByTrip = '1';
|
$post.data('hiddenByTrip', '1');
|
||||||
hide(post);
|
hide(post);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -469,9 +469,9 @@ if (active_page === 'thread' || active_page === 'index') {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// post didn't match any filters
|
// post didn't match any filters
|
||||||
if ((typeof post.dataset.hidden == 'undefined' || post.dataset.hidden == '0') &&
|
if ((typeof $post.data('hidden') == 'undefined' || $post.data('hidden') == '0') &&
|
||||||
post.dataset.hiddenByUid == '0' &&
|
$post.data('hiddenByUid') === '0' &&
|
||||||
post.dataset.hiddenByUid == post.dataset.hiddenByPost == post.dataset.hiddenByName == post.dataset.hiddenByTrip) {
|
$post.data('hiddenByUid') == $post.data('hiddenByPost') == $post.data('hiddenByName') == $post.data('hiddenByTrip')) {
|
||||||
show(post);
|
show(post);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -512,7 +512,7 @@ if (active_page === 'thread' || active_page === 'index') {
|
|||||||
addMenuButton(op, threadId, pageData);
|
addMenuButton(op, threadId, pageData);
|
||||||
|
|
||||||
// iterate filter over each post
|
// iterate filter over each post
|
||||||
if (op.dataset.hidden != '1' || active_page == 'thread') {
|
if ($(op).data('hidden') != '1' || active_page == 'thread') {
|
||||||
$thread.find('.reply').not('.hidden').each(function () {
|
$thread.find('.reply').not('.hidden').each(function () {
|
||||||
filter(this, threadId, pageData);
|
filter(this, threadId, pageData);
|
||||||
addMenuButton(this, threadId, pageData);
|
addMenuButton(this, threadId, pageData);
|
||||||
|
@ -20,7 +20,7 @@ $(document).ready(function(){
|
|||||||
$('<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 hideImage = function() {
|
var hideImage = function() {
|
||||||
if ($(this).parent()[0].dataset.expanded == 'true') {
|
if ($(this).parent().data('expanded') == 'true') {
|
||||||
$(this).parent().click();
|
$(this).parent().click();
|
||||||
}
|
}
|
||||||
$(this)
|
$(this)
|
||||||
|
Loading…
Reference in New Issue
Block a user