Page Kanban Musume js Edition (Forum Mother. Blog tan. In short a dream tan V (-1) code

/**
 * ukagaka.js
 * @author Star
 */
 if(typeof(Kangbang) == 'undefined')
     var Kangbang = {};
     var Ukagaka = null;
         Kangbang.ukagaka = function(){
                this.msgList = []; // The available message list  
                this.shellList = [];// The available list of shell  
                this.msgIndex = 0; // The current message index  
                this.shellIndex = 0;// The index of the current shell  
                this.ghostName = "";// The name of the current personality  
                this.msgBox = ""; //  Language output location, the default is  div
                this.shell = "";  //  The default location of the ukagaka image display  , The default for the IMG element  
                this.config = ""; // ukagaka Configuration information, use the   HashTable Initialization  
                this.somagicShell = "";
                this.somagicMsg = "";
                this.somagicMsgBox = "";
                this.timer = null;
                this.timerFlag = false;
         };
         
         Kangbang.ukagaka.prototype = {
                
                setGhostName : function( name){this.ghostName = name; },
                getGhostName : function(){ return this.ghostName; },
                setMsgList : function(msgs){ this.msgList = msgs; },
                setShellList : function(shells){ this.shellList = shells; },
        setShell : function(img){this.shell = img; },
                setMsgBox : function(div){this.msgBox = div; },
                setSomagicShell : function(div){ this.somagicShell = div; },
                setSomagicMsgBox : function(div){ this.somagicMsgBox = div;     }, //  The entire dialog box  
                setSomagicMsg : function(div){ this.somagicMsg = div; },    // Show some of the dialogue  
                getConfig : function(){ return this.config;     },
                
                hiddenSomagicMsgBox : function(){ Kit.hidden(this.somagicMsgBox);},
                showSomagicMsgBox : function(){Kit.show(this.somagicMsgBox); this.showSomagic();},
                hiddenSomagic : function(){ Kit.hidden(this.somagicShell);  /*this.hiddenSomagicMsgBox()*/},
                showSomagic  : function(){Kit.show(this.somagicShell);},
                stopTimer : function(){ if(this.timer ==null) return ;this.timerFlag = false;clearTimeout(this.timer)},
                
                setConfig : function(cfg){  //  Background get called after the server configuration file  
                        this.config = cfg;      
                        this.shellList = cfg.get("#shell").split(",");
                        this.msgList = cfg.get("#msg").split("\\w");
                        this.ghostName = cfg.get("#ghost");
                        this.createCode();
                },
                createCode : function(){  //  Dynamically created js property or method  
                        var codes = this.config.get("#jsCode").split("\[code\]");
                        for (var i = 0; i < codes.length; i++) {
                                //alert(codes[i]);
                                eval(codes[i]);
                        }
                        
                },
                init : function(){    // The front page is completely loaded, sonotori, after calling the front desk very according to their own situation manual control  
                        //this.showMenu();
//                      this.hello = function(){
//                      alert("Hello!");
//               };
                },
                showMenu : function(){  //  Display the system menu, showing location dialog box  
                    //alert(this.config.get("#menu"));
                        this.stopTimer();
                        this.msgBox.innerHTML = this.config.get("#menu");
                },
                sayNext  : function(){ //  Simple in order to display the next dialogue. Self tucao  
                        if(this.msgIndex >= this.msgList.length) this.msgIndex = 0;
                        this.msgBox.innerHTML = this.msgList[this.msgIndex ++].split("\\c")[0];
                        Kit.element("outPutDialog").innerHTML = this.msgBox.innerHTML + "<br/>";
                },
                sayToIndex : function(index){ //  Control the order tucao  
                        if(index > this.msgList.length) index = this.msgList.length;
                        if(index < 0) index = 0;
                        this.msgBox.innerHTML = this.msgList[index].split("\\s")[0];
                },
                
                shellNext : function(){ //  According to switch between external shell  
                        if(this.shellIndex >= this.shellList.length) this.shellIndex = 0;
                        this.shell.src = this.shellList[this.shellIndex ++];
                },
                shellToIndex : function(index){ // Control the order in which to display the shell  
                        if(index > this.shellList.length) index = this.shellList.length;
                        if(index < 0) index = 0;
                        this.shell.src = this.shellList[index];
                },
                shellOnce : function(index /* */ , time /* */){ // Control the order in which they are displayed and in time after the restore default  
                        this.shellToIndex(index);
                        setTimeout(function(){Ukagaka.shellToIndex(0);} , time);
                },
                tsukkomi : function(){    // My own spit  
                        if(this.msgList.length <= 0) return;
                        this.sayNext();
                        this.timer = setTimeout(function(){Ukagaka.tsukkomi();} , 10 * 1000);
                },
                tsukkomiSomagic : function(){   //  With spit  
                        if(this.msgList.length <= 0) return;
                        if(this.msgIndex >= this.msgList.length) this.msgIndex = 0;
                        this.timer = setTimeout(function(){Ukagaka.tsukkomiSomagic();} , 10 * 1000);
                        var arr = this.msgList[this.msgIndex ++ ].split("\\c");
                        this.msgBox.innerHTML = arr[0];
                        this.somagicMsg.innerHTML = arr[1];
                }
         };
(function(){
        Ukagaka = new Kangbang.ukagaka();
        var ajax = new Ajax();
        var hashMap = new Kit.HashTable();  //  From the server reads the configuration file, this should be cattle  13 Now, completely separate out  
        var response = ajax.getServerRequest("http://127.0.0.1:8000/ukagaka/cfg/ukagak.cfg").split("[end]");
        for(var line in response){ // This design I said nothing, the loop is subscript  
                var arr = response[line].split("=");
//              if(arr.length <= 0) continue;
                var value = "";
                for(var i = 1 ; i < arr.length ; i ++){
                        value += arr[i] + (i < arr.length - 1 ? "=" : ""); 
                }
                hashMap.put(arr[0].replace("\r\n" , "") , value);
        }
        Ukagaka.setConfig(hashMap);
})();




/**
 * Toolkit.js
 * three object canuse 
 * @author Star
 */

if(typeof(Kit) == 'undefined')
    var Kit = {};
        Kit.element = function(elementId){
                return document.getElementById(elementId);
        };
        Kit.isElement = function(elementId){
                return typeof(elementId) == "object";
        }
        Kit.hidden = function(elementId){
                if (Kit.isElement(elementId)) {
                        elementId.style.display = "none";
                }else {
                        Kit.element(elementId).style.display = "none";
                }
        };
        Kit.show = function(elementId){
                if (Kit.isElement(elementId)) {
                        elementId.style.display = "";
                }else {
                        Kit.element(elementId).style.display = "";
                }
        };
        Kit.isShow = function(elementId){
                return Kit.isElement(elementId) ? elementId.style.display.toLowerCase()!= "none" :
                                                     Kit.element(elementId).style.display.toLowerCase() != "none" ;
        };
        Kit.HashTable = function(){
                        this.keys = [];
                        this.values = [];
        };
        Kit.HashTable.prototype = /*(function()*/{
//              return {
                getLength : function(){  return this.keys.length; },
                                  
                clear    :  function(){ this.keys = [];this.values = []; },
                                  
                keys    : function(){ return this.keys; },
                                        
                values  : function(){ return this.values; },
                /**
                 * 
                 * @param {Object} key
                 * @param {Object} value
                 */
            put      : function(key , value){
                            if(this.containsKey(key)) return false;
                                this.keys.push(key);
                                this.values.push(value);
                                return true;
                            },
                /**
                 * 
                 * @param {Object} key
                 * @param {Object} value
                 */
                set     : function(key , value){
                       for(var i = 0 ; i < this.getLength() ; i ++){
                                        if (this.keys[i] == key) {
                                                this.values[i] = value;
                                                return true;
                                        }
                                }
                                return false;
                  },
            /**
             * 
             * @param {Object} key
             */
            get    : function(key){
                                for(var i = 0 ; i < this.getLength() ; i ++){
                                        if(this.keys[i] == key) return this.values[i];
                                }
                                return null;
                           },
                /**
                 * 
                 * @param {Object} key
                 */
                remove   :  function(key){
                          for(var i = 0 ; i < this.getLength() ; i ++){
                                        if(this.keys[i] == key){
                                                this.keys.removeIndex(i);
                                                this.values.removeIndex(i);
                                                return;
                                        }
                                  }
                 },
                /**
                 * 
                 * @param {Object} key
                 * 
                 */
            containsKey : function(key){
                              for(var i = 0 ; i < this.getLength() ; i ++){
                                        if(this.keys[i] == key) return true;
                                  } return false;
                    },
                /**
                 * 
                 * @param {Object} value
                 */
                containsValue  : function(value){
                                for(var i = 0 ; i < this.getLength() ; i ++){
                                                if(this.values[i] == value) return true;
                                          } return false;
                }
                // }
        };//)();
        Kit.Time = {
                onTime : function(fn ,time){
                        setTimeout(fn , time);
                }
        };
 if(typeof(Browser) == 'undefined')
    var Browser = {};
        
        Browser.Layout = {};
        
        Browser.Type = {
                 /**
                  * borwer type main type like ie or firefox and so on
                  */
                borwerType : " ",
                /**
                 * quick know the borwer type
                 */
                isIE : function(){
                            return Browser.Type.borwerType.toLowerCase() == "ie" ? true : false;
                      } ,
                /**
                 * borwer version list
                 */
                borwerVersion : "",
                
                agentString : ""
    };
        
        
        
        /**
         * Oh my god , the method is great but I think It`s error .
         * If the brow is not 'IE 6' the method id bad so the method only to
         * use 'IE 6' to support position fixd attribute but FireFox or Op.....
         * so you can use css file ? js file can use to load css file but please
         * not use js to create css , It`s so hard to read.
         */
        Browser.Layout.FixedPosition = {
                inited     : false,
                /**
                 * 
                 * @param {Object} element
                 * @param {Object} top
                 * @param {Object} left
                 */
                setPosition : function(element, top, left){
                        element.style.display = "block";
                                            if (Browser.Type.isIE()) {
                                                element.style.position = "absolute";
                                                Browser.Layout.FixedPosition.setGlobal();
                                            }else {
                                                element.style.position = "fixed";
                                            }
                                            element.style.top = top + "px";
                                            element.style.left = left + "px";
                                        },
                /**
                 * add css attribute key and value to document
                 * @param {Object} key
                 * @param {Object} value
                 */
                addCSSRule : function(key, value){
                                            var css = document.styleSheets[document.styleSheets.length - 1];
                                            css.cssRules ? (css.insertRule(key + "{" + value + "}", css.cssRules.length)) : (css.addRule(key, value));
                                            },
                /**
                 * 
                 */
                setGlobal  :  function(){
                                            if (!Browser.Layout.FixedPosition.inited) {
                                                document.body.style.height = "100%";
                                                document.body.style.overflow = "auto";
                                                Browser.Layout.FixedPosition.addCSSRule("*html", "overflow-x:auto;overflow-y:hidden;");
                                                Browser.Layout.FixedPosition.inited = true;
                                            }
                      }
        };
        /**
         * init var on page load
         */
        (function(){
                Browser.Type.agentString = navigator.userAgent;
                var bowerStr = Browser.Type.agentString.toLowerCase();
                if(bowerStr.indexOf("msie") > -1){
                        Browser.Type.borwerType = "ie";
                        if(bowerStr.indexOf("msie 6") > -1){
                                Browser.Type.borwerVersion = "IE 6";
                        }else if(bowerStr.indexOf("msie 7") > -1){
                                Browser.Type.borwerVersion = "IE 7";
                        }else{
                                Browser.Type.borwerVersion = "nani";
                        }
                }else{
                        Browser.Type.borwerType = "FireFox";
                }
        })();

if(typeof(Ajax) == 'undefined')
    var Ajax = function(){
                this.request = null;
        };
        Ajax.prototype = {
                
                createRequest : function(){
                        var request = false;
                                var ms = ['Msxml2.XMLHTTP.5.0','Msxml2.XMLHTTP.4.0','Msxml2.XMLHTTP.3.0','Msxml2.XMLHTTP','Microsoft.XMLHTTP'];
                                if(window.XMLHttpRequest){
                                        return new XMLHttpRequest();
                                }else if(window.ActiveXObject){
                                        for(var i = 0 ; i < ms.length ; i ++ ){
                                                try{
                                                        request = new ActiveXObject(ms[i]);
                                                        return request;
                                                }catch(e){
                                                        continue;
                                                }
                                        }
                                }
                                return false;
                },
                
                getServerRequest : function(url){
                        this.request = this.createRequest();
                        this.request.open("get" , url ,false);
//                              if(this.request.overrideMimeType)
//                                 this.request.overrideMimeType('text/json; charset=utf-8');
                                this.request.setRequestHeader("cache-control","no-cache");
                                this.request.setRequestHeader('Accept-Charset','utf-8');
                this.request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
                                this.request.send();
                                if(this.request.readyState==4&&this.request.status==200) return this.request.responseText;
                else return "";
                }
        };
        


body{
        font-family:"Lucida Grande",Arial,Helvetica,Verdana,sans-serif;
        font-size:12px;
        line-height:150%;
}
 /**
  *  The whole project of the outermost  
  */
#mp_kobato{
        margin:0;
    padding:0;
}
/**
 *  The inner layer, contains the kanban board and overall control options  
 */
#kanggang_shell{
        bottom:0;
        display:block;
        float:right;
        font-size:12px;
        margin:0 20px 0 0;
        padding:0;
        position:fixed;
        right:0;
        z-index:501;
}
/**
 *  Kanban Musume entity, which contains the kanban Musume and dialog boxes  
 */
#kobato{
        
        float:right;
        padding-right:10px;
        position:relative;
}
#somagic{
        top : 140px;
        float:right;
        padding-right:250px;
        position:relative;
}
/**
 * padding top right buttom left
 */
#somagic_msgBox{
        position:absolute;
        float:left;
        padding:5px 5px 10px 0;
        top : -10px;
        left :80px;
        width : 230px;
        height : 60px;
        background-color:#808080;
        background : transparent url("/imgs/somagciballoon.png" ) no-repeat scroll right top;
}
#somagic_msg{
        margin : 0 10px 10px 20px ;
        color : #FFFFFF;
}
/**
 *  Kanban control options  
 */
#kobato_dock{
        background-color:#FFFFFF;
        float:right;
        padding:5px 10px;
        text-align:center;
        -moz-border-radius-topleft:8px;
        -moz-border-radius-topright:8px;

}
/**
 *      color:#FFFFFF;
 */
#kobato_msgBox{

    margin:0;
    padding:10px 20px;
        left:-320px;
        height : 100px;
        position:absolute;
        top:5px;
        height : 90px;
        width:295px;
        background : transparent url("/imgs/balloon.png" ) no-repeat scroll right top;

}
#kobato_msgBox #menu{
        margin:0;
        top : -5px;
        right : 20px;
        position:absolute;
        cursor : pointer;
}
/**
 * background-color:#808080;
 *      border-style:solid solid none;
 *      -moz-border-radius:5px 5px 5px 5px;
 * cursor : pointer;
 */
#kobato_msg{
        
    color:#FFFFFF;
    margin:0;
        padding:0;
         
}
#kobato_msg ul{
        margin:0;
        padding:0;
        list-style:none outside none;
}
#kobato_msg li{
        float:left;
    width:33%;
}
#kobato_msg a{
        cursor : pointer;
}





<div>
                                <div>
                                        <div>
                                                <div>
                                                        <div><img src="imgs/menu.gif"/></div>
                                                        <div > Welcome to  </div>
                                                </div>
                                             <div  >
                                                      <img src="imgs/1.gif" title="kobato" width="200px" height="242px"/>
                                             </div>
                                        </div>
                                        <div >
                                                <div>
                                                        <div>tobato</div>
                                                </div><!--style="display:none;"-->
                                                <div   >
                                                        <img src="imgs/7.gif" width="90px" height="100px"/>
                                                </div>
                    </div>
                                 <div></div>
                                </div>
                        </div>
                          <script language="JavaScript" type="text/javascript" >
                            (function(){
                                        Ukagaka.setShell(Kit.element("kobato_shell"));
                                        Ukagaka.setMsgBox(Kit.element("kobato_msg"));
                                        Ukagaka.setSomagicShell(Kit.element("somagic"));
                                        Ukagaka.setSomagicMsgBox(Kit.element("somagic_msgBox"));
                                        Ukagaka.setSomagicMsg(Kit.element("somagic_msg"));
                                        Ukagaka.init();
                                        
                                        Ukagaka.tsukkomiSomagic();
                                })();
                </script>     


Did not expect that here, too inconvenient, let hi the first word to explain the circumstances, write a complete explanation.
http://hi.baidu.com/starsecond/blog/item/c3c63bf5d16399e37709d724.html
Simple explanation to be placed here.
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of Page Kanban Musume js Edition (Forum Mother. Blog tan. In short a dream tan V (-1) code

  • Read "prototype.js 1.4 Developer Edition Manual" excerpt

    Information Address: http://thinhunan.cnblogs.com/archive/2006/04/01/DeveloperNotesForPrototype.html Extract 1, $ F () function Function: Return of any form input control value, the parameters are the element id or the element itself Example: <script

  • common event in js

    / / 1: onblur event occurs when the object loses focus function upperCase () ( var x = document.getElementById ( "fname"). value document.getElementById ( "fname"). value = x.toUpperCase () ) </ script> Enter your name: <input

  • Javascript object inheritance

    Javascript object inheritance

  • Msxml2.XMLHTTP version problem

    Projects with an import feature prototype.js of Ajax functionality to update the prompt, the code is very simple, do not have the framework of the background on a jsp to output Text, future use of timers and to update the page Ajax.request encountere ...

  • JS after ajax request return of the problem can not be implemented

    1: Send ajax request, in the onComplete, if back when the html contains a javascript, then these javascrip and will not be realized, it does not mean not to implement. This problem has troubled me for a long time, behind the hair and then put this kn ...

  • Javascript Object Model

    Javascript Object Model

  • JS in the Date type conversion

    http://blog.csdn.net/yzy0612/archive/2007/08/07/1730732.aspx

  • JavaScript inheritance

    About JavaScript inherited a small example ... <! DOCTYPE HTML PUBLIC "- / / W3C / / DTD HTML 4.01 / / EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" conte ...

  • Struts2 + hibernate + spring problem user log in

    dao layer services layer action jsp <tr> <td align="center"> <b> user name: </ b> </ td> <td> <s: textfield name = "czyNumber" cssClass = "textstyle" theme = "simple" size = &q

  • Sign in spring struts2.0 hibernate user authentication

    Engage in a day has finally put the ghost of a user log in to engage in things out. . Ah first experience with a spring to manage the bean is a good tool. Of course, far more than this spring profound role in it. This is called a simple sense of the ...

blog comments powered by Disqus
Recent
Recent Entries
Tag Cloud
Random Entries