View Issue Details

IDProjectCategoryView StatusLast Update
0001919AJAX/JSBug Report - Interfacepublic2016-01-08 00:37
Reporteranidb_bug_reporter Assigned ToDerIdiot  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Summary0001919: Tabs should default to Same Content not Same Position
DescriptionMagic.toggle_tabs() stores a cookie for the last tab visited, and on the next page load, switches to the same tab. However, this is implemented by tab position (id is an enum) rather than content.

As not all entries have all enabled tabs, the content of the nth tab is not necessarily the same as the previous page. Consequently, trying to view the same content on multiple pages in succession often requires changing tabs to the same-content tab rather than the same-position tab.
Steps To Reproduce1. Enable AJAX tabs
2. View an anime
3. Select a tab to the right in the list
4. Note tab content (eg "groups") and position (eg 5th)
5. Click the random anime link
6. Note default tab position is same as in 0000004; however, content may be different
7. Continue to load random anime until 0000006 does result in different content
Additional InformationFiled as a bug, as this is a particular annoyance, and I am not aware of a use case for same-position tabs...
Tagspatch

Activities

anidb_bug_reporter

2011-03-17 19:24

reporter   ~0003214

In Steps to Reproduce (as originally entered), [pound-sign][number] was intended to reference the corresponding Step number, not bug number.

anidb_bug_reporter

2011-05-08 23:41

reporter  

anidbscript.js.patch (1,064 bytes)   
--- anidbscript.js.orig	2011-05-08 16:32:45.000000000 -0700
+++ anidbscript.js	2011-05-08 16:40:07.000000000 -0700
@@ -886,7 +886,7 @@
 					var li = elems[i].getElementsByTagName('li');
 					for (var j = 0; j < li.length; j++){
 						var tab = li[j];
-						if(tab.className.indexOf('_default') >= 0 || tab.id == selected) {
+						if(tab.className.indexOf('_default') >= 0 || tab.className.split(' ').indexOf(selected) != -1) {
 							Magic.toggle_tabs(0, tab);
 							selected = 0;
 						}
@@ -910,7 +910,11 @@
 							ClassToggle(elems[i], 'selected', 2);
 						}
 						ClassToggle(tab, 'selected', 1);
-						tabCookieSet((curPageID ? curPageID : 'tab'), tab.id);
+						var i = classes.indexOf('tab');
+						if (i != -1) classes.splice(i, 1);
+						i = classes.indexOf('selected');
+						if (i != -1) classes.splice(i, 1);
+						if (classes[0]) tabCookieSet((curPageID ? curPageID : 'tab'), classes[0]);
 						elems = tab.parentNode.parentNode.getElementsByTagName('div');
 						var topTab = null;
 						for (var i = 0; i < elems.length; i++){
anidbscript.js.patch (1,064 bytes)   

anidb_bug_reporter

2011-05-08 23:45

reporter   ~0003228

An UNTESTED, minimalist patch has been attached, which is believed to add the requested functionality. Scope is the Magic.enable_tabs and Magic.toggle_tabs functions of ./js/anidbscript.js.

Issue History

Date Modified Username Field Change
2011-03-17 19:21 anidb_bug_reporter New Issue
2011-03-17 19:24 anidb_bug_reporter Note Added: 0003214
2011-03-17 22:58 DerIdiot Project AniDB Website => AJAX/JS
2011-05-08 23:41 anidb_bug_reporter File Added: anidbscript.js.patch
2011-05-08 23:45 anidb_bug_reporter Note Added: 0003228
2011-06-13 05:00 anidb_bug_reporter Tag Attached: patch
2016-01-08 00:37 DerIdiot Status new => resolved
2016-01-08 00:37 DerIdiot Resolution open => fixed
2016-01-08 00:37 DerIdiot Assigned To => DerIdiot