196 lines
58 KiB
JavaScript
196 lines
58 KiB
JavaScript
|
/*!
|
|||
|
* NatureFace UI JavaScript Library v2.0
|
|||
|
* http:
|
|||
|
*
|
|||
|
* Copyright 2003~2013, KSonglover
|
|||
|
*
|
|||
|
* 此程式主要用途為產生互動式web應用程式之操作介面。
|
|||
|
* 並搭配一些簡單的操作,就可完成一個應用程式互動介面。
|
|||
|
* 此程式「使用創用CC 姓名標示─非商業性─禁止改作 3.0 台灣 授權條款」
|
|||
|
* 如做為商業用途,請利用Paypal進行付費授權,另外任何使用請保留此註記。
|
|||
|
*
|
|||
|
* Date: $LastChangedDate: 2013-03-07 09:18:06 +0800 (週四, 07 三月 2013) $
|
|||
|
* Revision : $Rev: 2053 $
|
|||
|
*/
|
|||
|
|
|||
|
/*
|
|||
|
|
|||
|
Method : jQuery.NatureFace.init(theme, fullscreen, prefix, firsttarget, touchscreen, top, left, width, height, rootdiv)
|
|||
|
|
|||
|
description: 初始化佈景主題
|
|||
|
|
|||
|
parameters:
|
|||
|
|
|||
|
<theme> : 字串時為theme名稱, 如為物件則使用{}設定以下參數
|
|||
|
<fullscreen> : set fullscreen (auto, 如為true, top, left, width及height失效)
|
|||
|
[prefix] : folder prefix path
|
|||
|
[firsttarget] : first target (default: theme), 用途refresh機制時,因為reinitialize, 所以必須指定firsttarget
|
|||
|
[touchscreen] : 強制指定是否為觸控(未指定將自動判斷, 有些紅外線觸控可能判斷錯誤)
|
|||
|
[top] : 定位點top
|
|||
|
[left] : 定位點left
|
|||
|
[width] : 定位點width(與height同時存在方能生效)
|
|||
|
[height] : 定位點height(與width同時存在方能生效)
|
|||
|
[rootdiv] : 放入指定的div element
|
|||
|
|
|||
|
Method : jQuery.NatureFace.target(layer)
|
|||
|
|
|||
|
description: 跳至指定layer
|
|||
|
|
|||
|
parameters:
|
|||
|
|
|||
|
<layer> : goto the layer target
|
|||
|
|
|||
|
Method : jQuery.NatureFace.layer()
|
|||
|
|
|||
|
description: 取得目前layer
|
|||
|
|
|||
|
Method : jQuery.NatureFace.listener(key, function(data))
|
|||
|
|
|||
|
description: 監聽事件
|
|||
|
|
|||
|
parameters:
|
|||
|
|
|||
|
<key> : event name : "target"
|
|||
|
|
|||
|
<function> : trigger function
|
|||
|
<data> : event data
|
|||
|
|
|||
|
|
|||
|
Method : jQuery.NatureFace.removeListener(key, function(data))
|
|||
|
|
|||
|
description: 移除監聽事件
|
|||
|
|
|||
|
parameters:
|
|||
|
|
|||
|
<key> : event name : "target"
|
|||
|
|
|||
|
<function> : trigger function
|
|||
|
<data> : event data
|
|||
|
|
|||
|
Method : jQuery.NatureFace.script(url)
|
|||
|
|
|||
|
description: 動態載入脚本
|
|||
|
|
|||
|
parameters:
|
|||
|
|
|||
|
<url> : dynamic load javascript file (js)
|
|||
|
|
|||
|
Method : jQuery.listing(group, url, sub_update(item, data), sub_updatepage(currentpage, allpage))
|
|||
|
|
|||
|
description: 觸控式list
|
|||
|
|
|||
|
relation attrs: binding, group,
|
|||
|
|
|||
|
parameters:
|
|||
|
|
|||
|
<group> : group name
|
|||
|
<url> : http url (JSON Data), merge pageno , ex : url + pageno (use rest method)
|
|||
|
ex : {"recordcount":22048,"pagecount":2205,"pagesize":10,"absolutepage":2,"absoluteposition":11,"items":[{"songno":"00011","songname":"\u9001\u5225"},{"songno":"00012","songname":"\u665A\u6B4C"},{"songno":"00013","songname":"\u91CE\u9910"},{"songno":"00014","songname":"\u8CC0\u5E74"},{"songno":"00015","songname":"\u6416\u8239"},{"songno":"00016","songname":"\u873B\u8713"},{"songno":"00017","songname":"\u6A05\u6A39"},{"songno":"00018","songname":"\u8774\u8776"},{"songno":"00019","songname":"\u8778\u725B"},{"songno":"00020","songname":"\u71D5\u5B50"}]}
|
|||
|
<page> : absolute page
|
|||
|
<sub_update> : item update function (itemobject, data)
|
|||
|
<sub_updatepage> : page update function (currentpage, allpage)
|
|||
|
|
|||
|
Method : jQuery.binding(group, url, sub_update(item, data), sub_clear(item), pageno)
|
|||
|
|
|||
|
description: 表格式list
|
|||
|
|
|||
|
relation attrs: binding, group, cols, rows
|
|||
|
|
|||
|
parameters:
|
|||
|
|
|||
|
<group> : group name
|
|||
|
<url> : http url (JSON Data), merge pageno , ex : url + pageno
|
|||
|
ex : {"recordcount":22048,"pagecount":2205,"pagesize":10,"absolutepage":2,"absoluteposition":11,"items":[{"songno":"00011","songname":"\u9001\u5225"},{"songno":"00012","songname":"\u665A\u6B4C"},{"songno":"00013","songname":"\u91CE\u9910"},{"songno":"00014","songname":"\u8CC0\u5E74"},{"songno":"00015","songname":"\u6416\u8239"},{"songno":"00016","songname":"\u873B\u8713"},{"songno":"00017","songname":"\u6A05\u6A39"},{"songno":"00018","songname":"\u8774\u8776"},{"songno":"00019","songname":"\u8778\u725B"},{"songno":"00020","songname":"\u71D5\u5B50"}]}
|
|||
|
<page> : absolute page
|
|||
|
<sub_update> : item update function (itemobject, data)
|
|||
|
<sub_clear> : item clear function (itemobject)
|
|||
|
[pageno] : assign page no , defaul : 1
|
|||
|
|
|||
|
Method : jQuery.NatureFace.marquee(url, function)
|
|||
|
|
|||
|
description: 跑馬燈
|
|||
|
|
|||
|
parameters:
|
|||
|
|
|||
|
<url> : http url (JSON Data or Other format(function))
|
|||
|
response data : {"effect":"(fade|scrollRight|scrollLeft|scrollUp|scrollDown)", "speed":ms, "delay":ms, items:[{"msg":"Welcome to jquery.NatureFace.js"},{"msg":"Change GUI Design Method..."}]}
|
|||
|
[function(data)] : json handler
|
|||
|
data handler and use marqueeItem to add marquee items
|
|||
|
|
|||
|
global variables:
|
|||
|
$.NatureFace.marquee.effect
|
|||
|
$.NatureFace.marquee.speed
|
|||
|
$.NatureFace.marquee.delay
|
|||
|
|
|||
|
|
|||
|
Method : jQuery.NatureFace.marqueeItem(msg)
|
|||
|
|
|||
|
description: 跑馬燈項目
|
|||
|
|
|||
|
parameters:
|
|||
|
|
|||
|
<msg> : add Marquee item
|
|||
|
|
|||
|
Method : jQuery.NatureFace.loading(b, target, opt)
|
|||
|
|
|||
|
description: 讀取中動態小圖
|
|||
|
|
|||
|
parameters:
|
|||
|
|
|||
|
<b> : true/false
|
|||
|
<target> : 存放動態載入的div容器
|
|||
|
[opt] : see also : http:
|
|||
|
{
|
|||
|
lines: 13,
|
|||
|
length: 7,
|
|||
|
width: 4,
|
|||
|
radius: 10,
|
|||
|
corners: 1,
|
|||
|
rotate: 0,
|
|||
|
color: '#ffff00',
|
|||
|
speed: 1,
|
|||
|
trail: 60,
|
|||
|
shadow: false,
|
|||
|
hwaccel: false,
|
|||
|
className: 'spinner',
|
|||
|
zIndex: 2000000000,
|
|||
|
top: 'auto',
|
|||
|
left: 'auto'
|
|||
|
}
|
|||
|
|
|||
|
Method : jQuery.NatureFace.refresh()
|
|||
|
|
|||
|
description: 重新整理(重新執行init及target至目前的layer, 如發現狀態不對,必須自行處理)
|
|||
|
|
|||
|
Method : jQuery.NatureFace.istouch()
|
|||
|
|
|||
|
description: 判斷是否為觸控, 如init時強制指定時, 即取得強制性值, 否則為系統值
|
|||
|
|
|||
|
Method : jQuery.NatureFace.hide()
|
|||
|
|
|||
|
Method : jQuery.NatureFace.show()
|
|||
|
|
|||
|
取得NatureFace 環境設定值:
|
|||
|
|
|||
|
$.NatureFace.settings = {
|
|||
|
theme : 主題
|
|||
|
fullscreen : 是否全螢幕
|
|||
|
prefix : template prefix path
|
|||
|
firsttarget : 第一個target
|
|||
|
touch : 是否支持觸控
|
|||
|
top : 座標top
|
|||
|
left : 座標left
|
|||
|
width : 寬度
|
|||
|
height : 高度
|
|||
|
divName : 主div容器
|
|||
|
div : 主div容器(含#)
|
|||
|
hasSize : 是否有自定義大小
|
|||
|
hide : 是否hide
|
|||
|
self : this
|
|||
|
}
|
|||
|
|
|||
|
*/
|
|||
|
|
|||
|
|
|||
|
|
|||
|
function NatureFace(opt,fullscreen,prefix,firsttarget,touch,top,left,width,height,rootdiv){this["\x69\x6E\x69\x74"](opt,fullscreen,prefix,firsttarget,touch,top,left,width,height,rootdiv);} ;NatureFace["\x70\x72\x6F\x74\x6F\x74\x79\x70\x65"]={settings:{},init:function (opt,fullscreen,prefix,firsttarget,touch,top,left,width,height,rootdiv){if( typeof opt=="\x73\x74\x72\x69\x6E\x67"){return this["\x73\x74\x61\x72\x74"](opt,fullscreen,prefix,firsttarget,touch,top,left,width,height,rootdiv);} else {if( typeof opt=="\x6F\x62\x6A\x65\x63\x74"){return this["\x73\x74\x61\x72\x74"](opt["\x74\x68\x65\x6D\x65"],opt["\x66\x75\x6C\x6C\x73\x63\x72\x65\x65\x6E"],opt["\x70\x72\x65\x66\x69\x78"],opt["\x66\x69\x72\x73\x74\x74\x61\x72\x67\x65\x74"],opt["\x74\x6F\x75\x63\x68"],opt["\x74\x6F\x70"],opt["\x6C\x65\x66\x74"],opt["\x77\x69\x64\x74\x68"],opt["\x68\x65\x69\x67\x68\x74"],opt["\x72\x6F\x6F\x74\x64\x69\x76"]);} ;} ;return ;} ,start:function (theme,fullscreen,prefix,firsttarget,touch,top,left,width,height,rootdiv){var hasSize=false;this["\x73\x65\x74\x74\x69\x6E\x67\x73"]={theme:theme,fullscreen:fullscreen,prefix:(prefix?prefix:""),firsttarget:((firsttarget)?firsttarget:theme),touch:(( typeof touch!="\x75\x6E\x64\x65\x66\x69\x6E\x65\x64")?touch:(!!("\x75\x6E\x64\x65\x66\x69\x6E\x65\x64"!= typeof document["\x64\x6F\x63\x75\x6D\x65\x6E\x74\x45\x6C\x65\x6D\x65\x6E\x74"]["\x6F\x6E\x74\x6F\x75\x63\x68\x73\x74\x61\x72\x74"]))),top:((top&&!fullscreen)?top:0),left:((left&&!fullscreen)?left:0),width:((width&&height&&!fullscreen)?function (){hasSize=true;return parseInt(width);} ["\x63\x61\x6C\x6C"]():$(window)["\x77\x69\x64\x74\x68"]()),height:((width&&height&&!fullscreen)?parseInt(height):$(window)["\x68\x65\x69\x67\x68\x74"]()),divName:(rootdiv?rootdiv:"\x4E\x61\x74\x75\x72\x65\x46\x61\x63\x65\x5F"+theme),div:"\x23"+(rootdiv?rootdiv:"\x4E\x61\x74\x75\x72\x65\x46\x61\x63\x65\x5F"+theme),hasSize:hasSize,refreshPause:false,zindex:1,noname:0,sizeH:1,sizeW:1,elements:{},files:[],groups:{},listeners:{},self:this,hide:false,globalLoadingTarget:"\x4E\x61\x74\x75\x72\x65\x46\x61\x63\x65\x47\x6C\x6F\x62\x61\x6C\x4C\x6F\x61\x64\x69\x6E\x67\x47\x6C\x61\x73\x73\x42\x6F\x61\x72\x64",spinners:{},loadingOpts:{lines:13,length:7,width:4,radius:10,corners:1,rotate:0,color:"\x23\x66\x66\x66\x66\x30\x30",speed:1,trail:60,shadow:false,hwaccel:false,className:"\x73\x70\x69\x6E\x6E\x65\x72",zIndex:2000000000,top:"\x61\x75\x74\x6F",left:"\x61\x75\x74\x6F"}};var s=this["\x73\x65\x74\x74\x69\x6E\x67\x73"];console["\x69\x6E\x66\x6F"]("\x64\x69\x73\x70\x6C\x61\x79\x20\x72\x65\x73\x6F\x6C\x75\x74\x69\x6F\x6E\x3A\x20\x77\x69\x64\x74\x68\x3A"+s["\x77\x69\x64\x74\x68"]+"\x20\x68\x65\x69\x67\x68\x74\x3A"+s["\x68\x65\x69\x67\x68\x74"]);var originalTextMethod=jQuery["\x66\x6E"]["\x74\x65\x78\x74"];jQuery["\x66\x6E"]["\x65\x78\x74\x65\x6E\x64"]({text:function (arguments){if(this["\x68\x61\x73\x43\x6C\x61\x73\x73"]("\x4E\x61\x74\x75\x72\x65\x4F\x62\x6A\x65\x63\x74")&&$("\x23"+$(this)["\x61\x74\x74\x72"]("\x69\x64")+"\x5F\x63\x61\x70\x74\x69\x6F\x6E",s["\x64\x69\x76"])["\x6C\x65\x6E\x67\x74\x68"]!=0){var caption=$("\x23"+$(this)["\x61\x74\x74\x72"]("\x69\x64")+"\x5F\x63\x61\x70\x74\x69\x6F\x6E",s["\x64\x69\x76"]);if(jQuery["\x69\x73\x46\x75\x6E\x63\x74\x69\x6F\x6E"](arguments)){return caption["\x65\x61\x63\x68"](function (i){var self=jQuery(this);self["\x74\x65\x78\x74"](text["\x63\x61\x6C\x6C"](this,i,self["\x74\x65\x78\x74"]()));} );} ;if( typeof arguments!=="\x6F\x62\x6A\x65\x63\x74"&&arguments!==undefined){return caption["\x65\x6D\x70\x74\x79"]()["\x61\x70\x70\x65\x6E\x64"]((caption[0]&&caption[0]["\x6F\x77\x6E\x65\x72\x44\x6F\x63\x75\x6D\x65\x6E\x74"]||document)["\x63\x72\x65\x61\x74\x65\x54\x65\x78\x74\x4E\x6F\x64\x65"](arguments));} ;return jQuery["\x74\x65\x78\x74"](this);} else {return originalTextMethod["\x61\x70\x70\x6C\x79"](this,arguments);} ;} });$("\x62\x6F\x64\x79")["\x63\x73\x73"]({margin:"\x30\x70\x78",overflow:"\x68\x69\x64\x64\x65\x6E"});this["\x73\x63\x72\x69\x70\x74"]("\x6A\x73\x2F\x6A\x71\x75\x65\x72\x79\x2E\x4E\x61\x74\x75\x72\x65\x46\x61\x63\x65\x2D\x33\x7
|