1
0
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:
8chan 2015-02-20 01:51:06 -08:00
parent 3e0134e53e
commit 7364e85351
7 changed files with 45 additions and 45 deletions

View File

@ -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(' <input id="search_field" style="border: inset 1px;">');
$('#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'); });
}

View File

@ -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();

View File

@ -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();
}

View File

@ -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", "<label id='color-ids'><input type='checkbox' /> "+_('Color IDs')+"</label>");
}
else {
selector = '#color-ids';
event = 'click';
var selector = '#color-ids';
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>')
}
$(selector).on(event, function() {
$(selector).on(e, function() {
if (localStorage.color_ids === 'true') {
localStorage.color_ids = 'false';
} else {

View File

@ -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

View File

@ -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<array.length; i++) {
if (array[i].uid == uid) {
post.dataset.hiddenByUid = '1';
$post.data('hiddenByUid', '1');
localList.push(postId);
if (array[i].hideReplies) noReplyList.push(postId);
break;
@ -434,7 +434,7 @@ if (active_page === 'thread' || active_page === 'index') {
// match localList
if (localList.length) {
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);
}
}
@ -443,13 +443,13 @@ if (active_page === 'thread' || active_page === 'index') {
if (!forcedAnon) {
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) {
post.dataset.hiddenByName = '1';
$post.data('hiddenByName', '1');
hide(post);
}
if ($post.find('.trip').length) {
trip = $post.find('.trip').text();
if ($(list.nameFilter).filter(function(){if (this.trip == trip) return true;}).length) {
post.dataset.hiddenByTrip = '1';
$post.data('hiddenByTrip', '1');
hide(post);
}
}
@ -469,9 +469,9 @@ if (active_page === 'thread' || active_page === 'index') {
});
// post didn't match any filters
if ((typeof post.dataset.hidden == 'undefined' || post.dataset.hidden == '0') &&
post.dataset.hiddenByUid == '0' &&
post.dataset.hiddenByUid == post.dataset.hiddenByPost == post.dataset.hiddenByName == post.dataset.hiddenByTrip) {
if ((typeof $post.data('hidden') == 'undefined' || $post.data('hidden') == '0') &&
$post.data('hiddenByUid') === '0' &&
$post.data('hiddenByUid') == $post.data('hiddenByPost') == $post.data('hiddenByName') == $post.data('hiddenByTrip')) {
show(post);
}
}
@ -512,7 +512,7 @@ if (active_page === 'thread' || active_page === 'index') {
addMenuButton(op, threadId, pageData);
// 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 () {
filter(this, threadId, pageData);
addMenuButton(this, threadId, pageData);

View File

@ -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'));
var hideImage = function() {
if ($(this).parent()[0].dataset.expanded == 'true') {
if ($(this).parent().data('expanded') == 'true') {
$(this).parent().click();
}
$(this)