diff --git a/docinfo.html b/docinfo.html index f724f46b6..5a27d44c2 100644 --- a/docinfo.html +++ b/docinfo.html @@ -1,10 +1,9 @@ + - - - - + - + diff --git a/gulpfile.js b/gulpfile.js index 4ee4ac5c1..a19b1901c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -4,6 +4,9 @@ var path = require("path"); var rename = require("gulp-rename"); var inlining = require("gulp-inlining-node-require"); var removeUseString = require("gulp-remove-use-strict"); +gulp.task("build-js", function () { + +}); gulp.task("embed", function () { return gulp.src(["./Ch*/src/**/*.js", "./Ch*/lib/*.js", "./Ch3_Testing/test/*.js"], {base: './'}) .pipe(inlining()) diff --git a/public/js/bug-report.js b/public/js/bug-report.js index c8a14d8c1..9eb99ada4 100644 --- a/public/js/bug-report.js +++ b/public/js/bug-report.js @@ -1,4 +1,11 @@ "use strict"; +var TOCHighlighter = require("./sync-toc"); +function quoteText(text) { + return text.split("\n").map(function (line) { + return "> " + line; + }).join("\n"); +} + function BugReporter() { var highLightLevel = ["h1", "h2", "h3"]; var sections = document.querySelectorAll(".sect2"); @@ -36,14 +43,8 @@ BugReporter.prototype.report = function () { + "&labels=" + encodeURIComponent(this.github_issue_labels); window.open(url, "_blank"); }; -window.addEventListener("load", function (event) { - - function quoteText(text) { - return text.split("\n").map(function (line) { - return "> " + line; - }).join("\n"); - } - +module.exports = BugReporter; +module.exports.initilize = function () { var reportElement = document.createElement("button"); reportElement.textContent = "バグ報告"; reportElement.setAttribute("style", "position:fixed; right:0;bottom:0;"); @@ -59,5 +60,4 @@ window.addEventListener("load", function (event) { bug.report(); }); document.body.appendChild(reportElement); -}); - +}; \ No newline at end of file diff --git a/public/js/editor.js b/public/js/editor.js new file mode 100644 index 000000000..48e224ffb --- /dev/null +++ b/public/js/editor.js @@ -0,0 +1,16 @@ +/** + * Created by azu on 2014/06/11. + * LICENSE : MIT + */ +"use strict"; +module.exports.initilize = function () { + var consoleUI = require("codemirror-console-ui"); + var codeBlocks = document.querySelectorAll("div.listingblock"); + for (var i = 0; i < codeBlocks.length; i++) { + var codeBlock = codeBlocks[i]; + var code = codeBlock.getElementsByTagName("code")[0]; + if (code) { + consoleUI(codeBlock, code.textContent); + } + } +} \ No newline at end of file diff --git a/public/js/index.js b/public/js/index.js index 7058ce183..d7ea76b3a 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -4,14 +4,8 @@ */ "use strict"; function windowOnload() { - var consoleUI = require("codemirror-console-ui"); - var codeBlocks = document.querySelectorAll("div.listingblock"); - for (var i = 0; i < codeBlocks.length; i++) { - var codeBlock = codeBlocks[i]; - var code = codeBlock.getElementsByTagName("code")[0]; - if (code) { - consoleUI(codeBlock, code.textContent); - } - } + require("./editor").initilize(); + require("./sync-toc").initilize(); + require("./bug-report").initilize(); } window.addEventListener("load", windowOnload); \ No newline at end of file diff --git a/public/js/sync-toc.js b/public/js/sync-toc.js index d97c83a22..7e211cac6 100644 --- a/public/js/sync-toc.js +++ b/public/js/sync-toc.js @@ -60,7 +60,8 @@ TOCHighlighter.prototype.findAllChildHeader = function (parent) { } return []; }; -window.addEventListener("load", function onLoad() { +module.exports = TOCHighlighter; +module.exports.initilize = function initilize() { var highLightLevel = ["h1", "h2", "h3"]; var chapters = document.querySelectorAll(".sect1"); var sections = document.querySelectorAll(".sect2"); @@ -78,4 +79,4 @@ window.addEventListener("load", function onLoad() { } window.addEventListener("scroll", onScroll); -}); +};