-/* This file is part of NIT ( http://www.nitlanguage.org ).\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
- Documentation generator for the nit language.\r
- Generate API documentation in HTML format from nit source code.\r
-*/\r
-\r
-/*\r
- * Nitdoc.GitHub.ModalBox class\r
- */\r
-define([\r
- "jquery",\r
-], function($) {\r
- // Init new modal box instance\r
- //TODO use DJQuery.UI Dialog: https://jqueryui.com/dialog/#modal-message\r
- var ModalBox = {\r
-\r
- // Open modal box instance\r
- open: function(title, content, isError) {\r
- $("body").append(\r
- $(document.createElement("div"))\r
- .attr("id", "nitdoc-github-modal-fade")\r
- .addClass("nitdoc-github-fade")\r
- )\r
- .append(\r
- $(document.createElement("div"))\r
- .attr("id", "nitdoc-github-modal")\r
- .addClass("nitdoc-github-modal")\r
- .append(\r
- $(document.createElement("a"))\r
- .addClass("nitdoc-github-close")\r
- .attr("title", "Close")\r
- .append("x")\r
- .click(function() { ModalBox.close() })\r
- )\r
- .append("<h3>" + title + "</h3>")\r
- .append("<div>" + content + "</div>")\r
- .append(\r
- $(document.createElement("div"))\r
- .addClass("nitdoc-github-buttons")\r
- .append(\r
- $(document.createElement("button"))\r
- .addClass("nitdoc-github-button")\r
- .append("Ok")\r
- .click(function() { ModalBox.close() })\r
- )\r
- )\r
- );\r
-\r
- if(isError) {\r
- $("#nitdoc-github-modal").addClass("nitdoc-github-error");\r
- }\r
-\r
- $("#nitdoc-github-modal")\r
- .css({\r
- top: "50%",\r
- marginTop: -($("#nitdoc-github-modal").outerHeight() / 2) + "px",\r
- left: "50%",\r
- marginLeft: -($("#nitdoc-github-modal").outerWidth() / 2) + "px"\r
- })\r
- .find("button.nitdoc-github-button").focus();\r
- },\r
-\r
- // Close modal box instance\r
- close: function() {\r
- $("#nitdoc-github-modal").remove();\r
- $("#nitdoc-github-modal-fade").remove();\r
- }\r
- };\r
- return ModalBox;\r
-});\r