Plato on Github
Report Home
space/_header.js
Maintainability
70.22
Lines of code
100
Difficulty
11.28
Estimated Errors
0.31
Function weight
By Complexity
By SLOC
/*global YUI, window */ /** *
For user to know the current device inof
* * Spec: http://produce.corp.miiicasa.com/spec/photos/20120627/M1-1-1_Device_Info.html * Mockup: http://produce.corp.miiicasa.com/ued/charming/M1_1_1_Device_info.png * Guideline: http://produce.corp.miiicasa.com/ued/charming/M1_1_1_Device_info_guideline.png * @author Mei Lin * @created 2010/11/13 * @module space * @submodule _header */ YUI.add("space/_header", function (Y) { var _api, _node, //=========================== // Constants //=========================== MODULE_ID = "#header", HIDDEN_STATUS_CLASS = "hidden-status", //=========================== // Private Methods //=========================== _show, //=========================== // Public Methods //=========================== init, onviewload, onmessage; //=========================== // Private Methods //=========================== /** * Show doulbe NAT error message. * * @method _show * @private * @return void */ _show = function () { _api.log("_show() is executed."); var errorMsgNode = _node.one(".error-message"); if (errorMsgNode.hasClass(HIDDEN_STATUS_CLASS)) { _node.one(".error-message").removeClass(HIDDEN_STATUS_CLASS); } }; //=========================== // Public Methods //=========================== /** * Module initialization * @event init * @param api {Y.Sandbox} Module API * @public * @return void */ init = function (sandbox) { _api = sandbox; _api.log("init() is executed"); _api.listen("show-double-nat-message"); }; /* * Module content ready * @event onviewload * @public * @return void */ onviewload = function () { _api.log("onviewload() is executed"); _node = _api.getViewNode(); }; /** * Module message receive. * * @method onmessage * @public * @return void */ onmessage = function (e) { _api.log("onmessage() " + e.name); if (e.name === "show-double-nat-message") { _show(); } }; _api = new Y.Module({ selector: MODULE_ID, langModule: "space", init: init, on: { viewload : onviewload, message : onmessage } }); }, "0.0.1", { "group" : "space", "js" : "space/_header.js", "css" : "space/_header.css", "requires": [ "module", "module-intl", "node-base", "node-style", "event-base" ] });