Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/kujirahand/nadesiko3
Browse files Browse the repository at this point in the history
  • Loading branch information
kujirahand committed Mar 4, 2018
2 parents 9555ca0 + 28dc565 commit 263fc09
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Japanese Programming Language Nadesiko v3

## 対応機器/Webブラウザ

- HTML5対応ブラウザ (Internet Explorer / Safari / Chrome / Firefox 等)
- HTML5対応ブラウザ (Internet Explorer 11 / Safari / Chrome / Firefox 等)
- スマホブラウザ (iOS Safari / Android標準ブラウザ)
- PC (Windows/macOS/Linux - Node.jsが動く環境)

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions src/wnako3.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,20 @@ class WebNakoCompiler extends NakoCompiler {
console.log('実行したなでしこの個数=', nakoScriptCount)
}

/**
* type=なでしこ のスクリプトを自動実行するべきかどうかを返す
* @returns {boolean} type=なでしこ のスクリプトを自動実行するべきかどうか
*/
checkScriptTagParam () {
// src属性で、?runが指定されていれば、
// type=なでしこ のスクリプトを自動実行する
let scripts = document.querySelectorAll('script')
for (let i = 0; i < scripts.length; i++) {
let script = scripts[i]
let src = script.src || ''
if (src.indexOf('wnako3.js?run') >= 0) {
this.autoRun = true
break
return true
}
}
return false
}
}

Expand All @@ -45,8 +47,8 @@ if (typeof (navigator) === 'object') {
const nako3 = navigator.nako3 = new WebNakoCompiler()
nako3.addPluginObject('PluginBrowser', PluginBrowser)
window.addEventListener('DOMContentLoaded', (e) => {
const autoRun = nako3.checkScriptTagParam()
if (autoRun) nako3.runNakoScript()
const isAutoRun = nako3.checkScriptTagParam()
if (isAutoRun) nako3.runNakoScript()
}, false)
} else {
module.exports = WebNakoCompiler
Expand Down

0 comments on commit 263fc09

Please sign in to comment.