User:Yoko Harukaze/common.js

//* Setup-bar test. *//

function setup_furigana { i=0; a=document.getElementsByClassName("furigana-box"); e=document.getElementsByClassName("kanji");

yes=document.getElementById("setup-furigana-yes"); no=document.getElementById("setup-furigana-no"); if ( yes.style.display=="inline-block" ) {    yes.style.display="none"; no.style.display="inline-block"; while (i<a.length) {       a[i].style.display="none"; i=i+1; }    i=0; while (i<e.length) {       e[i].style.display="inline-block"; i=i+1; }    }  else {    yes.style.display="inline-block"; no.style.display="none"; while (i<a.length) {       a[i].style.display="inline-block"; i=i+1; }    if (document.getElementById("setup-ruby-yes").style.display=="inline-block") {       i=0; while (i<e.length) {          if (e[i].tagName!="RB") {             e[i].style.display="none"; }          i=i+1; }       }     } }

function setup_hoverbox { i=0; a=document.getElementsByClassName("furigana-hoverbox"); b=document.getElementsByClassName("furigana-brackets"); c=document.getElementsByClassName("furigana-ruby");

e=document.getElementsByClassName("kanji"); yes=document.getElementById("setup-hoverbox-yes"); no=document.getElementById("setup-hoverbox-no") if ( yes.style.display=="inline-block" ) {    }  else {    yes.style.display="inline-block"; no.style.display="none"; document.getElementById("setup-brackets-yes").style.display="none"; document.getElementById("setup-brackets-no").style.display="inline-block"; document.getElementById("setup-ruby-yes").style.display="none"; document.getElementById("setup-ruby-no").style.display="inline-block"; while (i<a.length) {       a[i].style.display="inline-block"; i=i+1; }    i=0; while (i<b.length) {       b[i].style.display="none"; i=i+1; }    i=0; while (i<c.length) {       c[i].style.display="none"; i=i+1; }

i=0; while (i<e.length) {       e[i].style.display="inline-block"; i=i+1; }    } } function setup_brackets { i=0; a=document.getElementsByClassName("furigana-brackets"); b=document.getElementsByClassName("furigana-ruby"); c=document.getElementsByClassName("furigana-hoverbox");

e=document.getElementsByClassName("kanji"); yes=document.getElementById("setup-brackets-yes"); no=document.getElementById("setup-brackets-no"); if ( yes.style.display=="inline-block" ) {    }  else {    yes.style.display="inline-block"; no.style.display="none"; document.getElementById("setup-ruby-yes").style.display="none"; document.getElementById("setup-ruby-no").style.display="inline-block"; document.getElementById("setup-hoverbox-yes").style.display="none"; document.getElementById("setup-hoverbox-no").style.display="inline-block"; while (i<a.length) {       a[i].style.display="inline-block"; i=i+1; }    i=0; while (i<b.length) {       b[i].style.display="none"; i=i+1; }    i=0; while (i<c.length) {       c[i].style.display="none"; i=i+1; }

i=0; while (i<e.length) {       e[i].style.display="inline-block"; i=i+1; }    } } function setup_ruby { i=0; a=document.getElementsByClassName("furigana-ruby"); b=document.getElementsByClassName("furigana-hoverbox"); c=document.getElementsByClassName("furigana-brackets");

e=document.getElementsByClassName("kanji"); yes=document.getElementById("setup-ruby-yes"); no=document.getElementById("setup-ruby-no"); if ( yes.style.display=="inline-block" ) {    }  else {    yes.style.display="inline-block"; no.style.display="none"; document.getElementById("setup-hoverbox-yes").style.display="none"; document.getElementById("setup-hoverbox-no").style.display="inline-block"; document.getElementById("setup-brackets-yes").style.display="none"; document.getElementById("setup-brackets-no").style.display="inline-block"; while (i<a.length) {       a[i].style.display="inline"; i=i+1; }    i=0; while (i<b.length) {       b[i].style.display="none"; i=i+1; }    i=0; while (i<c.length) {       c[i].style.display="none"; i=i+1; }

if (document.getElementById("setup-furigana-no").style.display=="none") {       i=0; while (i<e.length) {          if (e[i].tagName!="RB") {             e[i].style.display="none"; }          i=i+1; }       }     } }

//* Setup-bar creation test. *//

if ( !document.getElementById("furigana-setup").classList.contains('setup-user-own') ) {   document.getElementById("setup-furigana-yes").style.display="inline-block"; document.getElementById("setup-furigana-no").style.display="none"; document.getElementById("setup-hoverbox-yes").style.display="inline-block"; document.getElementById("setup-hoverbox-no").style.display="none"; document.getElementById("setup-brackets-yes").style.display="none"; document.getElementById("setup-brackets-no").style.display="inline-block"; document.getElementById("setup-ruby-yes").style.display="none"; document.getElementById("setup-ruby-no").style.display="inline-block"; }