+++ /dev/null
-/* 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
-define([\r
- "jquery",\r
- "jQueryUI"\r
-], function($) {\r
- $.widget("nitdoc.modalbox", {\r
- options: {\r
- id: "nitdoc-dialog",\r
- classes: "nitdoc-dialog",\r
- css: {},\r
- title: "Title",\r
- isError: false,\r
- },\r
-\r
- _create: function() {\r
- this._addFade();\r
- this._makeDialog();\r
- },\r
-\r
- open: function() {\r
- this._dialog\r
- .show()\r
- .css({\r
- top: "50%",\r
- marginTop: -(this._dialog.outerHeight() / 2) + "px",\r
- left: "50%",\r
- marginLeft: -(this._dialog.outerWidth() / 2) + "px"\r
- })\r
- .find(".nitdoc-dialog-buttons button:first").focus();\r
-\r
- this._fade.show();\r
- },\r
-\r
- close: function() {\r
- this._fade.hide();\r
- this._dialog.hide();\r
- },\r
-\r
- _addFade: function() {\r
- this._fade = $("<div/>")\r
- .hide()\r
- .attr("id", "nitdoc-dialog-fade-" + this.options.id)\r
- .addClass("nitdoc-dialog-fade");\r
- $("body").append(this._fade);\r
- },\r
-\r
- _makeDialog: function() {\r
- this._dialog = $("<div/>")\r
- .hide()\r
- .attr("id", this.options.id)\r
- .addClass(this.options.classes)\r
- .css(this.options.css)\r
- .append(\r
- $("<div/>")\r
- .addClass("nitdoc-dialog-header")\r
- .append(\r
- $("<h3/>")\r
- .text(this.options.title)\r
- )\r
- .append(\r
- $("<button/>")\r
- .addClass("nitdoc-dialog-close")\r
- .append("x")\r
- .click($.proxy(this.close, this))\r
- )\r
- )\r
- .append(\r
- $("<div/>")\r
- .addClass("nitdoc-dialog-content")\r
- .html(this.element)\r
- )\r
- .append(\r
- $("<div/>")\r
- .addClass("nitdoc-dialog-buttons")\r
- .append(\r
- $("<button/>")\r
- .append("Ok")\r
- .click($.proxy(this.close, this))\r
- )\r
- );\r
- if(this.options.isError) {\r
- this._dialog.addClass("nitdoc-dialog-error");\r
- }\r
- $("body").append(this._dialog);\r
- }\r
- });\r
-});\r