Skip to content

Commit

Permalink
Fixbug when the script is loaded multiple times.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jun Koda committed Sep 7, 2016
1 parent cdd6ccf commit 0b20e37
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions kyokumen.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@
* Website: https://github.com/junkoda/kyokumen
*/

if (typeof kyokumen_js_ver == 'undefined') {
kyokumen_js_ver = '0.0.1'
kyokumen_js();
}

function kyokumen_js() {
window.addEventListener('load', eventWindowLoaded, false);

const ver = '0.0.1'
const axisLine = 0.2;

const nrow = 9;
Expand All @@ -15,7 +20,7 @@ const numKanji = ['一', '二', '三', '四', '五', '六', '七', '八', '九',
const SENTE = '☗';
const GOTE = '☖';

const defaultCSS = 'https://junkoda.github.io/kyokumen/' + ver + '/kyokumen.css'
const defaultCSS = 'https://junkoda.github.io/kyokumen/' + kyokumen_js_ver + '/kyokumen.css';

loadDefaultCSS(defaultCSS);

Expand Down Expand Up @@ -453,8 +458,6 @@ function getWidth(kyokumen) {
return Number(owidth);
}

console.log(document.styleSheets);

var str_width = document.defaultView.getComputedStyle(kyokumen, null).width;
var width = parseFloat(str_width);

Expand Down Expand Up @@ -549,6 +552,5 @@ function loadDefaultCSS(filename)
}
}



}

0 comments on commit 0b20e37

Please sign in to comment.