Subversion Repositories php-qbpwcf

Rev

Rev 207 | Rev 232 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 207 Rev 226
Line 1... Line 1...
1
<?php
1
<?php
2
 
2
 
3
/*
3
/*
4
 
4
 
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
6
    Copyright (C) 2015~2024 Min-Jhin,Chen
6
    Copyright (C) 2014~2025 MIN ZHI, CHEN
7
 
7
 
8
    This file is part of QBPWCF.
8
    This file is part of QBPWCF.
9
 
9
 
10
    QBPWCF is free software: you can redistribute it and/or modify
10
    QBPWCF is free software: you can redistribute it and/or modify
11
    it under the terms of the GNU General Public License as published by
11
    it under the terms of the GNU General Public License as published by
Line 236... Line 236...
236
				#函式說明:
236
				#函式說明:
237
				#將檔案的位置名稱變成網址,也可以取得檔案位於伺服器上檔案系統的絕對位置.
237
				#將檔案的位置名稱變成網址,也可以取得檔案位於伺服器上檔案系統的絕對位置.
238
				#回傳結果:
238
				#回傳結果:
239
				#$result["status"],"true"爲建立成功,"false"爲建立失敗.
239
				#$result["status"],"true"爲建立成功,"false"爲建立失敗.
240
				#$result["error"],錯誤訊息陣列.
240
				#$result["error"],錯誤訊息陣列.
241
				#$result["function"],函數名稱. 
241
				#$result["function"],函數名稱.
242
				#$result["argu"],使用的參數.
242
				#$result["argu"],使用的參數.
243
				#$result["content"],網址,若是在命令列執行,則為"null".
243
				#$result["content"],網址,若是在命令列執行,則為"null".
244
				#$result["webPathFromRoot"],相對於網頁根目錄的路徑.
244
				#$result["webPathFromRoot"],相對於網頁根目錄的路徑.
245
				#$result["fileSystemAbsoulutePosition"],針對伺服器端的絕對位置,亦即從網頁「document_root」目錄開始的路徑.
245
				#$result["fileSystemAbsoulutePosition"],針對伺服器端的絕對位置,亦即從網頁「document_root」目錄開始的路徑.
246
				#必填參數:
246
				#必填參數:
Line 269... Line 269...
269
 
269
 
270
					#回傳結果
270
					#回傳結果
271
					return $result;
271
					return $result;
272
 
272
 
273
					}#if end
273
					}#if end
274
	
274
 
275
				#用成網路位置
275
				#用成網路位置
276
				$conf["jsPosition"]=$getInternetAddressV2["content"];
276
				$conf["jsPosition"]=$getInternetAddressV2["content"];
277
						
277
 
278
				#檢查要匯入的js檔案是否存在
278
				#檢查要匯入的js檔案是否存在
279
				#函式說明:檢查多個檔案與資料夾是否存在.
279
				#函式說明:檢查多個檔案與資料夾是否存在.
280
				#回傳結果:
280
				#回傳結果:
281
				#$result["status"],執行正常與否,"true"代表正常,"false"代表不正常.
281
				#$result["status"],執行正常與否,"true"代表正常,"false"代表不正常.
282
				#$result["error"],錯誤訊息陣列.
282
				#$result["error"],錯誤訊息陣列.
Line 296... Line 296...
296
				#參考資料來源:
296
				#參考資料來源:
297
				#http://php.net/manual/en/function.file-exists.php
297
				#http://php.net/manual/en/function.file-exists.php
298
				#http://php.net/manual/en/control-structures.foreach.php
298
				#http://php.net/manual/en/control-structures.foreach.php
299
				$checkMultiFileExist=fileAccess::checkMultiFileExist($conf["fileAccess::checkMultiFileExist"]);
299
				$checkMultiFileExist=fileAccess::checkMultiFileExist($conf["fileAccess::checkMultiFileExist"]);
300
				unset($conf["fileAccess::checkMultiFileExist"]);
300
				unset($conf["fileAccess::checkMultiFileExist"]);
301
				
301
 
302
				#debug
302
				#debug
303
				#var_dump($checkMultiFileExist);
303
				#var_dump($checkMultiFileExist);
304
				
304
 
305
				#如果檢查要匯入的js檔案失敗
305
				#如果檢查要匯入的js檔案失敗
306
				if($checkMultiFileExist["status"]=="false"){
306
				if($checkMultiFileExist["status"]=="false"){
307
 
307
 
308
					#設置錯誤狀態
308
					#設置錯誤狀態
309
					$result["status"]="false";
309
					$result["status"]="false";
Line 322... Line 322...
322
					#設置沒有找到 js 檔案
322
					#設置沒有找到 js 檔案
323
					$result["founded"]="false";
323
					$result["founded"]="false";
324
 
324
 
325
					#如果不允許 server 端找不到 js 檔案
325
					#如果不允許 server 端找不到 js 檔案
326
					if($conf["allowNotExist"]==="false"){
326
					if($conf["allowNotExist"]==="false"){
327
				
327
 
328
						#設置錯誤狀態
328
						#設置錯誤狀態
329
						$result["status"]="false";
329
						$result["status"]="false";
330
 
330
 
331
						#設置錯誤提示
331
						#設置錯誤提示
332
						$result["error"][]="要匯入的js檔案「".$checkMultiFileExist["varName"][0]."」不存在";
332
						$result["error"][]="要匯入的js檔案「".$checkMultiFileExist["varName"][0]."」不存在";
Line 380... Line 380...
380
		#debug
380
		#debug
381
		#var_dump($result);
381
		#var_dump($result);
382
 
382
 
383
		#如果有是找到js檔案的識別
383
		#如果有是找到js檔案的識別
384
		if(isset($result["founded"])){
384
		if(isset($result["founded"])){
385
		
385
 
386
			#如果找不到js檔案,且沒有要求也要輸出匯入js的標籤
386
			#如果找不到js檔案,且沒有要求也要輸出匯入js的標籤
387
			if( $result["founded"]==="false" && $conf["importWhenExist"]==="true" ){
387
			if( $result["founded"]==="false" && $conf["importWhenExist"]==="true" ){
388
			
388
 
389
				#清空匯入js的標籤
389
				#清空匯入js的標籤
390
				$conf["jsPosition"]="";
390
				$conf["jsPosition"]="";
391
			
391
 
392
				}#if end
392
				}#if end
393
		
393
 
394
			}#if end
394
			}#if end
395
 
395
 
396
		#設置要回傳javascript語法
396
		#設置要回傳javascript語法
397
		$result["content"]="<script type=\"text/javascript\" ".$conf["jsPosition"]." >";
397
		$result["content"]="<script type=\"text/javascript\" ".$conf["jsPosition"]." >";
398
 
398
 
Line 435... Line 435...
435
	#$result["function"],當前執行的函數名稱
435
	#$result["function"],當前執行的函數名稱
436
	#必填參數:
436
	#必填參數:
437
	#$conf["alertSentence"],字串,爲要彈出式視窗的內容,"\\n"代表換行.
437
	#$conf["alertSentence"],字串,爲要彈出式視窗的內容,"\\n"代表換行.
438
	$conf["alertSentence"]="";
438
	$conf["alertSentence"]="";
439
	#可省略參數:
439
	#可省略參數:
440
	#無.	
440
	#無.
441
	#參考資料:
441
	#參考資料:
442
	#無.
442
	#無.
443
	#備註:
443
	#備註:
444
	#無.
444
	#無.
445
	*/
445
	*/
Line 2775... Line 2775...
2775
			#函式說明:
2775
			#函式說明:
2776
			#將檔案的位置名稱變成網址,也可以取得檔案位於伺服器上檔案系統的絕對位置.
2776
			#將檔案的位置名稱變成網址,也可以取得檔案位於伺服器上檔案系統的絕對位置.
2777
			#回傳結果:
2777
			#回傳結果:
2778
			#$result["status"],"true"爲建立成功,"false"爲建立失敗.
2778
			#$result["status"],"true"爲建立成功,"false"爲建立失敗.
2779
			#$result["error"],錯誤訊息陣列.
2779
			#$result["error"],錯誤訊息陣列.
2780
			#$result["function"],函數名稱. 
2780
			#$result["function"],函數名稱.
2781
			#$result["argu"],使用的參數.
2781
			#$result["argu"],使用的參數.
2782
			#$result["content"],網址,若是在命令列執行,則為"null".
2782
			#$result["content"],網址,若是在命令列執行,則為"null".
2783
			#$result["webPathFromRoot"],相對於網頁根目錄的路徑.
2783
			#$result["webPathFromRoot"],相對於網頁根目錄的路徑.
2784
			#$result["fileSystemAbsoulutePosition"],針對伺服器端的絕對位置,亦即從網頁「document_root」目錄開始的路徑.
2784
			#$result["fileSystemAbsoulutePosition"],針對伺服器端的絕對位置,亦即從網頁「document_root」目錄開始的路徑.
2785
			#$result["fileSystemRelativePosition"],針對伺服器檔案系統的相對位置.
2785
			#$result["fileSystemRelativePosition"],針對伺服器檔案系統的相對位置.
Line 2796... Line 2796...
2796
			$getInternetAddressV2=fileAccess::getInternetAddressV2($conf["fileAccess::getInternetAddressV2"]);
2796
			$getInternetAddressV2=fileAccess::getInternetAddressV2($conf["fileAccess::getInternetAddressV2"]);
2797
			unset($conf["fileAccess::getInternetAddressV2"]);
2797
			unset($conf["fileAccess::getInternetAddressV2"]);
2798
 
2798
 
2799
			#如果執行失敗
2799
			#如果執行失敗
2800
			if($getInternetAddressV2["status"]==="false"){
2800
			if($getInternetAddressV2["status"]==="false"){
2801
			
2801
 
2802
				#設置執行不正常
2802
				#設置執行不正常
2803
				$result["status"]="false";
2803
				$result["status"]="false";
2804
 
2804
 
2805
				#設置錯誤訊息
2805
				#設置錯誤訊息
2806
				$result["error"]=$getInternetAddressV2;
2806
				$result["error"]=$getInternetAddressV2;
2807
 
2807
 
2808
				#回傳結果
2808
				#回傳結果
2809
				return $result;
2809
				return $result;
2810
			
2810
 
2811
				}#if end
2811
				}#if end
2812
			
2812
 
2813
			#取得網頁位置	
2813
			#取得網頁位置
2814
			$jsLocation=$getInternetAddressV2["content"];
2814
			$jsLocation=$getInternetAddressV2["content"];
2815
 
2815
 
2816
			#var_dump($jsLocation);
2816
			#var_dump($jsLocation);
2817
 
2817
 
2818
			#函式說明:
2818
			#函式說明:
Line 2984... Line 2984...
2984
 
2984
 
2985
			}#if end
2985
			}#if end
2986
 
2986
 
2987
		#如果不要script標籤
2987
		#如果不要script標籤
2988
		if($conf["noScriptTag"]==="true"){
2988
		if($conf["noScriptTag"]==="true"){
2989
		
2989
 
2990
			#如果存在 $conf["globalJs"]
2990
			#如果存在 $conf["globalJs"]
2991
			if(isset($conf["globalJs"])){
2991
			if(isset($conf["globalJs"])){
2992
		
2992
 
2993
				#針對每個全域js
2993
				#針對每個全域js
2994
				foreach($conf["globalJs"] as $jsSection){
2994
				foreach($conf["globalJs"] as $jsSection){
2995
				
2995
 
2996
					#取得javaScript開始的語法
2996
					#取得javaScript開始的語法
2997
					$result["content"]=$result["content"].$jsSection;
2997
					$result["content"]=$result["content"].$jsSection;
2998
				
2998
 
2999
					}#foreach end
2999
					}#foreach end
3000
		
3000
 
3001
				}#if end
3001
				}#if end
3002
		
3002
 
3003
			#如果存在 $conf["jsFunciton"]
3003
			#如果存在 $conf["jsFunciton"]
3004
			if(isset($conf["jsFunciton"])){
3004
			if(isset($conf["jsFunciton"])){
3005
		
3005
 
3006
				#針對每個js函式
3006
				#針對每個js函式
3007
				foreach($conf["jsFunciton"] as $jsSection){
3007
				foreach($conf["jsFunciton"] as $jsSection){
3008
				
3008
 
3009
					#取得javaScript開始的語法
3009
					#取得javaScript開始的語法
3010
					$result["content"]=$result["content"].$jsSection;
3010
					$result["content"]=$result["content"].$jsSection;
3011
				
3011
 
3012
					}#foreach end
3012
					}#foreach end
3013
					
3013
 
3014
				}#if end
3014
				}#if end
3015
				
3015
 
3016
			#如果 $conf["onReady"] 為 "true"
3016
			#如果 $conf["onReady"] 為 "true"
3017
			if($conf["onReady"]==="true"){
3017
			if($conf["onReady"]==="true"){
3018
 
3018
 
3019
				#用ready條件包住要執行的script內容
3019
				#用ready條件包住要執行的script內容
3020
				$conf["script"]=
3020
				$conf["script"]=
Line 3028... Line 3028...
3028
 
3028
 
3029
				#串接要執行的script
3029
				#串接要執行的script
3030
				$result["content"]=$result["content"].$conf["script"];
3030
				$result["content"]=$result["content"].$conf["script"];
3031
 
3031
 
3032
				}#if end
3032
				}#if end
3033
		
3033
 
3034
			}#if end
3034
			}#if end
3035
		
3035
 
3036
		#反之
3036
		#反之
3037
		else{
3037
		else{
3038
		
3038
 
3039
			#javaScript開始
3039
			#javaScript開始
3040
			$conf["javaScript"]["start"]["include"]="false";#是否要匯入外部js庫。"true"爲要匯入;"false"爲沒有要匯入。
3040
			$conf["javaScript"]["start"]["include"]="false";#是否要匯入外部js庫。"true"爲要匯入;"false"爲沒有要匯入。
3041
			#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑,請與參數"jsPosition"一起設置.
3041
			#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑,請與參數"jsPosition"一起設置.
3042
			#$conf["javaScript"]["start"]["fileArgu"]=$conf["fileArgu"];
3042
			#$conf["javaScript"]["start"]["fileArgu"]=$conf["fileArgu"];
3043
			$javaScriptStart=javaScript::start($conf["javaScript"]["start"]);
3043
			$javaScriptStart=javaScript::start($conf["javaScript"]["start"]);
Line 3083... Line 3083...
3083
					$result["content"]=$result["content"].$jsFunc;
3083
					$result["content"]=$result["content"].$jsFunc;
3084
 
3084
 
3085
					}#foreach end
3085
					}#foreach end
3086
 
3086
 
3087
				}#if end
3087
				}#if end
3088
				
3088
 
3089
			#如果 $conf["onReady"] 為 "true"
3089
			#如果 $conf["onReady"] 為 "true"
3090
			if($conf["onReady"]==="true"){
3090
			if($conf["onReady"]==="true"){
3091
 
3091
 
3092
				#用ready條件包住要執行的script內容
3092
				#用ready條件包住要執行的script內容
3093
				$conf["script"]=
3093
				$conf["script"]=
Line 3112... Line 3112...
3112
 
3112
 
3113
				}#elsd end
3113
				}#elsd end
3114
 
3114
 
3115
			#串接 <script>
3115
			#串接 <script>
3116
			$result["content"]=$result["content"].javaScript::end();
3116
			$result["content"]=$result["content"].javaScript::end();
3117
			
3117
 
3118
			}#else end
3118
			}#else end
3119
 
3119
 
3120
		#設置執行正常
3120
		#設置執行正常
3121
		$result["status"]="true";
3121
		$result["status"]="true";
3122
 
3122
 
Line 4670... Line 4670...
4670
 
4670
 
4671
			}#if end
4671
			}#if end
4672
 
4672
 
4673
		#轉換 $conf["scriptTag"] 給 javaScript::addScriptTag 使用
4673
		#轉換 $conf["scriptTag"] 給 javaScript::addScriptTag 使用
4674
		if($conf["scriptTag"]==="true"){
4674
		if($conf["scriptTag"]==="true"){
4675
		
4675
 
4676
			$conf["scriptTag"]="false";
4676
			$conf["scriptTag"]="false";
4677
		
4677
 
4678
			}#if end
4678
			}#if end
4679
			
4679
 
4680
		else if($conf["scriptTag"]==="false"){
4680
		else if($conf["scriptTag"]==="false"){
4681
		
4681
 
4682
			$conf["scriptTag"]="true";
4682
			$conf["scriptTag"]="true";
4683
		
4683
 
4684
			}#if end
4684
			}#if end
4685
 
4685
 
4686
		#to js
4686
		#to js
4687
		#函式說明:
4687
		#函式說明:
4688
		#依據需要加上<script></script>標籤,並且可以指定要匯入的js檔案.
4688
		#依據需要加上<script></script>標籤,並且可以指定要匯入的js檔案.
Line 5115... Line 5115...
5115
 
5115
 
5116
			}#else end
5116
			}#else end
5117
 
5117
 
5118
		#如果有指定要儲存到window中的變數
5118
		#如果有指定要儲存到window中的變數
5119
		if(isset($conf["returnWindowVarName"])){
5119
		if(isset($conf["returnWindowVarName"])){
5120
		
5120
 
5121
			#設置儲存到指定的window中變數
5121
			#設置儲存到指定的window中變數
5122
			$conf["returnWindowVarName"]="window.".$conf["returnWindowVarName"]."=";
5122
			$conf["returnWindowVarName"]="window.".$conf["returnWindowVarName"]."=";
5123
		
5123
 
5124
			}#if end
5124
			}#if end
5125
		
5125
 
5126
		#反之
5126
		#反之
5127
		else{
5127
		else{
5128
		
5128
 
5129
			#設置直接return
5129
			#設置直接return
5130
			$conf["returnWindowVarName"]="return ";
5130
			$conf["returnWindowVarName"]="return ";
5131
		
5131
 
5132
			}#else end
5132
			}#else end
5133
 
5133
 
5134
		#開新視窗的js function
5134
		#開新視窗的js function
5135
		$js="
5135
		$js="
5136
			//open window functino ".$conf["function"]."
5136
			//open window functino ".$conf["function"]."
Line 5556... Line 5556...
5556
 
5556
 
5557
			#回傳結果
5557
			#回傳結果
5558
			return $result;
5558
			return $result;
5559
 
5559
 
5560
			}#if end
5560
			}#if end
5561
			
5561
 
5562
		#如果檢查不通過
5562
		#如果檢查不通過
5563
		if($checkArguments["passed"]==="false"){
5563
		if($checkArguments["passed"]==="false"){
5564
 
5564
 
5565
			#設置錯誤狀態
5565
			#設置錯誤狀態
5566
			$result["status"]="false";
5566
			$result["status"]="false";
Line 5584... Line 5584...
5584
		#$conf["script"],字串,要執行的javaScript語法.
5584
		#$conf["script"],字串,要執行的javaScript語法.
5585
		$conf["javaScript::toScript"]["script"]=
5585
		$conf["javaScript::toScript"]["script"]=
5586
		"
5586
		"
5587
		//debug
5587
		//debug
5588
		console.log('override addEventListener');
5588
		console.log('override addEventListener');
5589
		
5589
 
5590
		//參考資料 https://stackoverflow.com/questions/446892/how-to-find-event-listeners-on-a-dom-node-when-debugging-or-from-the-javascript
5590
		//參考資料 https://stackoverflow.com/questions/446892/how-to-find-event-listeners-on-a-dom-node-when-debugging-or-from-the-javascript
5591
		//override addEventListener, when not native code
5591
		//override addEventListener, when not native code
5592
		if(Element.prototype.addEventListener.toString().includes('native code')!==true){		
5592
		if(Element.prototype.addEventListener.toString().includes('native code')!==true){
5593
			Element.prototype._addEventListener = Element.prototype.addEventListener;
5593
			Element.prototype._addEventListener = Element.prototype.addEventListener;
5594
			Element.prototype.addEventListener = function(a,b,c){
5594
			Element.prototype.addEventListener = function(a,b,c){
5595
				this._addEventListener(a,b,c);
5595
				this._addEventListener(a,b,c);
5596
				if(!this.eventListenerList) {
5596
				if(!this.eventListenerList) {
5597
					this.eventListenerList = {};
5597
					this.eventListenerList = {};
Line 5600... Line 5600...
5600
					this.eventListenerList[a] = [];
5600
					this.eventListenerList[a] = [];
5601
					}
5601
					}
5602
				this.eventListenerList[a].push(b);
5602
				this.eventListenerList[a].push(b);
5603
				};
5603
				};
5604
			}//if end
5604
			}//if end
5605
					
5605
 
5606
		//debug
5606
		//debug
5607
		//console.log('add scrollingListMiddleEvent');
5607
		//console.log('add scrollingListMiddleEvent');
5608
 
5608
 
5609
		//新增當視窗大小改變時的事件
5609
		//新增當視窗大小改變時的事件
5610
		window.scrollingListMiddleEvent();
5610
		window.scrollingListMiddleEvent();
Line 5635... Line 5635...
5635
		//托移的事件
5635
		//托移的事件
5636
		window.dragEventHandler.func.call();
5636
		window.dragEventHandler.func.call();
5637
 
5637
 
5638
		//如果沒有 window.qbpwcf
5638
		//如果沒有 window.qbpwcf
5639
		if(window.qbpwcf===undefined){
5639
		if(window.qbpwcf===undefined){
5640
		
5640
 
5641
			//初始化為空物件
5641
			//初始化為空物件
5642
			window.qbpwcf={};
5642
			window.qbpwcf={};
5643
		
5643
 
5644
			}//if end
5644
			}//if end
5645
 
5645
 
5646
		//close Icon
5646
		//close Icon
5647
		window.qbpwcf.closeIcon='data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwO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UoLTEzOS4wMzQ0MikiCiAgICAgICAgIHJ5PSIwIgogICAgICAgICB5PSItNzMuMDUwOTQ5IgogICAgICAgICB4PSItMTgyLjk2MjUyIgogICAgICAgICBoZWlnaHQ9IjIuMTUyMjA2NCIKICAgICAgICAgd2lkdGg9IjI5LjI3OTY0OCIKICAgICAgICAgaWQ9InJlY3Q0NDEzLTMiCiAgICAgICAgIHN0eWxlPSJvcGFjaXR5OjE7ZmlsbDojZmZmZjAwO2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDowO3N0cm9rZS1taXRlcmxpbWl0OjQ7c3Ryb2tlLWRhc2hhcnJheTpub25lO3N0cm9rZS1vcGFjaXR5OjE7ZmlsdGVyOnVybCgjZmlsdGVyNDQzOCkiIC8+CiAgICA8L2c+CiAgPC9nPgo8L3N2Zz4K';
5648
 
5648
 
Line 5732... Line 5732...
5732
			//如果是火狐瀏覽器
5732
			//如果是火狐瀏覽器
5733
			if(navigator.userAgent.includes('Firefox')){
5733
			if(navigator.userAgent.includes('Firefox')){
5734
 
5734
 
5735
				//設置選項內框與選單外框的高度,已便讓選項列表上下置中於選單外框
5735
				//設置選項內框與選單外框的高度,已便讓選項列表上下置中於選單外框
5736
				rootDiv.children[0].children[0].style.marginTop=marginTop;
5736
				rootDiv.children[0].children[0].style.marginTop=marginTop;
5737
			
5737
 
5738
				}//if end
5738
				}//if end
5739
			
5739
 
5740
 
5740
 
5741
			}//function scrollingListMiddleFunction end
5741
			}//function scrollingListMiddleFunction end
5742
		";
5742
		";
5743
		$conf["javaScript::toScript"]["jsFunciton"][]=
5743
		$conf["javaScript::toScript"]["jsFunciton"][]=
5744
		"
5744
		"
Line 6337... Line 6337...
6337
 
6337
 
6338
			//初始化 window qbpwcf 物件
6338
			//初始化 window qbpwcf 物件
6339
			window.qbpwcf={};
6339
			window.qbpwcf={};
6340
 
6340
 
6341
			}//if end
6341
			}//if end
6342
		
6342
 
6343
		/*
6343
		/*
6344
		涵式說明:
6344
		涵式說明:
6345
		將同 data-form-id 的input/textarea內容用表單的方式傳送出去(POST)
6345
		將同 data-form-id 的input/textarea內容用表單的方式傳送出去(POST)
6346
		params.ele, 要綁定事件的元素.
6346
		params.ele, 要綁定事件的元素.
6347
		params.formId, 用來識別表單群體的名稱.
6347
		params.formId, 用來識別表單群體的名稱.
6348
		params.url, 表單要傳送到的地方.
6348
		params.url, 表單要傳送到的地方.
6349
		params.method, GET or POST.
6349
		params.method, GET or POST.
6350
		*/
6350
		*/
6351
		window.qbpwcf.sendByDataFormId=function(params){
6351
		window.qbpwcf.sendByDataFormId=function(params){
6352
		
6352
 
6353
			//如果沒有ele
6353
			//如果沒有ele
6354
			if(params.ele===undefined){
6354
			if(params.ele===undefined){
6355
			
6355
 
6356
				//結束執行
6356
				//結束執行
6357
				return;
6357
				return;
6358
			
6358
 
6359
				}//if end
6359
				}//if end
6360
		
6360
 
6361
			//取得要取得的ele
6361
			//取得要取得的ele
6362
			var ele=params.ele;
6362
			var ele=params.ele;
6363
					
6363
 
6364
			//如果沒有formId
6364
			//如果沒有formId
6365
			if(params.formId===undefined){
6365
			if(params.formId===undefined){
6366
			
6366
 
6367
				//預設為 'qbpwcf_form'
6367
				//預設為 'qbpwcf_form'
6368
				params.formId='qbpwcf_form';
6368
				params.formId='qbpwcf_form';
6369
			
6369
 
6370
				}//if end		
6370
				}//if end
6371
						
6371
 
6372
			//取得要取得的formId
6372
			//取得要取得的formId
6373
			var formId=params.formId;
6373
			var formId=params.formId;
6374
			
6374
 
6375
			//如果沒有formId
6375
			//如果沒有formId
6376
			if(params.url===undefined){
6376
			if(params.url===undefined){
6377
			
6377
 
6378
				//預設為當前網址
6378
				//預設為當前網址
6379
				params.url=location.href;
6379
				params.url=location.href;
6380
			
6380
 
6381
				}//if end
6381
				}//if end
6382
			
6382
 
6383
			//取得表單要傳送到的地方
6383
			//取得表單要傳送到的地方
6384
			var url=params.url;
6384
			var url=params.url;
6385
			
6385
 
6386
			//如果沒有method
6386
			//如果沒有method
6387
			if(params.method===undefined){
6387
			if(params.method===undefined){
6388
			
6388
 
6389
				//預設為post
6389
				//預設為post
6390
				params.method='POST';
6390
				params.method='POST';
6391
			
6391
 
6392
				}//if end
6392
				}//if end
6393
			
6393
 
6394
			//限定為post
6394
			//限定為post
6395
			var method=params.method;
6395
			var method=params.method;
6396
						
6396
 
6397
			//綁定點擊事件
6397
			//綁定點擊事件
6398
			params.ele.addEventListener('click',async function(event){
6398
			params.ele.addEventListener('click',async function(event){
6399
				
6399
 
6400
				//如果沒有鎖頭
6400
				//如果沒有鎖頭
6401
				if(this.dataset.lock===undefined){
6401
				if(this.dataset.lock===undefined){
6402
				
6402
 
6403
					//設置為上鎖
6403
					//設置為上鎖
6404
					this.dataset.lock==='false';
6404
					this.dataset.lock==='false';
6405
				
6405
 
6406
					}//if end
6406
					}//if end
6407
				
6407
 
6408
				//如果已經上鎖了
6408
				//如果已經上鎖了
6409
				if(this.dataset.lock==='true'){
6409
				if(this.dataset.lock==='true'){
6410
				
6410
 
6411
					//結束執行
6411
					//結束執行
6412
					return false;
6412
					return false;
6413
				
6413
 
6414
					}//if end
6414
					}//if end
6415
				
6415
 
6416
				//上鎖
6416
				//上鎖
6417
				this.dataset.lock='true';
6417
				this.dataset.lock='true';
6418
				
6418
 
6419
				//取得所有 inputs
6419
				//取得所有 inputs
6420
				var dataFormId='data-form-id=\"'+formId+'\"';
6420
				var dataFormId='data-form-id=\"'+formId+'\"';
6421
				dataFormId='input['+dataFormId+']';
6421
				dataFormId='input['+dataFormId+']';
6422
				eval('var inputDataFormId=\''+dataFormId+'\'');
6422
				eval('var inputDataFormId=\''+dataFormId+'\'');
6423
				var inputs=document.querySelectorAll(inputDataFormId);
6423
				var inputs=document.querySelectorAll(inputDataFormId);
6424
				
6424
 
6425
				//取得所有 textarea
6425
				//取得所有 textarea
6426
				var dataFormId='data-form-id=\"'+formId+'\"';
6426
				var dataFormId='data-form-id=\"'+formId+'\"';
6427
				dataFormId='textarea['+dataFormId+']';
6427
				dataFormId='textarea['+dataFormId+']';
6428
				eval('var textareaDataFormId=\''+dataFormId+'\'');
6428
				eval('var textareaDataFormId=\''+dataFormId+'\'');
6429
				var textareas=document.querySelectorAll(textareaDataFormId);
6429
				var textareas=document.querySelectorAll(textareaDataFormId);
6430
				
6430
 
6431
				//debug
6431
				//debug
6432
				console.log(inputs,textareas);
6432
				console.log(inputs,textareas);
6433
				
6433
 
6434
				//初始化查詢的字串
6434
				//初始化查詢的字串
6435
				var queryStr='';
6435
				var queryStr='';
6436
				
6436
 
6437
				//如果有input
6437
				//如果有input
6438
				if(inputs.length!==0){
6438
				if(inputs.length!==0){
6439
				
6439
 
6440
					//針對每個input
6440
					//針對每個input
6441
					for(var i=0;i<inputs.length;i++){
6441
					for(var i=0;i<inputs.length;i++){
6442
					
6442
 
6443
						//如果不是空的
6443
						//如果不是空的
6444
						if(queryStr!==''){
6444
						if(queryStr!==''){
6445
						
6445
 
6446
							//串接'&'
6446
							//串接'&'
6447
							queryStr=queryStr+'&';
6447
							queryStr=queryStr+'&';
6448
						
6448
 
6449
							}//if end
6449
							}//if end
6450
					
6450
 
6451
						//加上查詢內容
6451
						//加上查詢內容
6452
						queryStr=queryStr+inputs[i].name+'='+encodeURIComponent(inputs[i].value);
6452
						queryStr=queryStr+inputs[i].name+'='+encodeURIComponent(inputs[i].value);
6453
					
6453
 
6454
						}//for end
6454
						}//for end
6455
				
6455
 
6456
					}//if end
6456
					}//if end
6457
					
6457
 
6458
				//如果有textarea
6458
				//如果有textarea
6459
				if(textareas.length!==0){
6459
				if(textareas.length!==0){
6460
				
6460
 
6461
					//針對每個textarea
6461
					//針對每個textarea
6462
					for(var i=0;i<textareas.length;i++){
6462
					for(var i=0;i<textareas.length;i++){
6463
					
6463
 
6464
						//如果不是空的
6464
						//如果不是空的
6465
						if(queryStr!==''){
6465
						if(queryStr!==''){
6466
						
6466
 
6467
							//串接'&'
6467
							//串接'&'
6468
							queryStr=queryStr+'&';
6468
							queryStr=queryStr+'&';
6469
						
6469
 
6470
							}//if end
6470
							}//if end
6471
					
6471
 
6472
						//加上查詢內容
6472
						//加上查詢內容
6473
						queryStr=queryStr+textareas[i].name+'='+encodeURIComponent(textareas[i].value);
6473
						queryStr=queryStr+textareas[i].name+'='+encodeURIComponent(textareas[i].value);
6474
					
6474
 
6475
						}//for end
6475
						}//for end
6476
				
6476
 
6477
					}//if end
6477
					}//if end
6478
					
6478
 
6479
				//初始化查詢的字串
6479
				//初始化查詢的字串
6480
				console.log('queryStr='+queryStr);
6480
				console.log('queryStr='+queryStr);
6481
					
6481
 
6482
				//如果沒有任何input
6482
				//如果沒有任何input
6483
				if(inputs.length===0  && textareas.length===0){
6483
				if(inputs.length===0  && textareas.length===0){
6484
				
6484
 
6485
					//結束執行
6485
					//結束執行
6486
					return; 
6486
					return;
6487
				
6487
 
6488
					}//if end
6488
					}//if end
6489
				
6489
 
6490
				//debug
6490
				//debug
6491
				console.log('params.method='+params.method);
6491
				console.log('params.method='+params.method);
6492
				console.log('params.url='+params.url);
6492
				console.log('params.url='+params.url);
6493
				
6493
 
6494
				//傳送表單
6494
				//傳送表單
6495
				/*
6495
				/*
6496
				設置 window.qbpwcf.ajaxP 函數
6496
				設置 window.qbpwcf.ajaxP 函數
6497
				說明:
6497
				說明:
6498
				傳送ajax,指定傳送前要做什麼事情,然後回傳一個Promise.
6498
				傳送ajax,指定傳送前要做什麼事情,然後回傳一個Promise.
Line 6510... Line 6510...
6510
				ajaxP_params={};
6510
				ajaxP_params={};
6511
				ajaxP_params.data=queryStr;
6511
				ajaxP_params.data=queryStr;
6512
				ajaxP_params.method=params.method;
6512
				ajaxP_params.method=params.method;
6513
				ajaxP_params.url=params.url;
6513
				ajaxP_params.url=params.url;
6514
				var res = await window.qbpwcf.ajaxP.call(this,ajaxP_params);
6514
				var res = await window.qbpwcf.ajaxP.call(this,ajaxP_params);
6515
				
6515
 
6516
				//debug
6516
				//debug
6517
				console.log(res);
6517
				console.log(res);
6518
				
6518
 
6519
				//解鎖
6519
				//解鎖
6520
				this.dataset.lock='false';
6520
				this.dataset.lock='false';
6521
				
6521
 
6522
				});
6522
				});
6523
			
6523
 
6524
			}
6524
			}
6525
		";
6525
		";
6526
		$conf["javaScript::toScript"]["jsFunciton"][]=
6526
		$conf["javaScript::toScript"]["jsFunciton"][]=
6527
		"
6527
		"
6528
		//如果 window.qbpwcf 不存在
6528
		//如果 window.qbpwcf 不存在
Line 6530... Line 6530...
6530
 
6530
 
6531
			//初始化 window qbpwcf 物件
6531
			//初始化 window qbpwcf 物件
6532
			window.qbpwcf={};
6532
			window.qbpwcf={};
6533
 
6533
 
6534
			}//if end
6534
			}//if end
6535
		
6535
 
6536
		//初始化物件
6536
		//初始化物件
6537
		window.qbpwcf.postDataAttr={};
6537
		window.qbpwcf.postDataAttr={};
6538
 
6538
 
6539
		/*
6539
		/*
6540
		函式說明:	
6540
		函式說明:
6541
		設置點擊元素後會傳遞data屬性為名稱與其數值為表單數值給特定url,然後依照片段show到當前頁面.
6541
		設置點擊元素後會傳遞data屬性為名稱與其數值為表單數值給特定url,然後依照片段show到當前頁面.
6542
		參數說明:
6542
		參數說明:
6543
		element,要綁定事件的元素.
6543
		element,要綁定事件的元素.
6544
		url,表單要傳送到的位置.
6544
		url,表單要傳送到的位置.
6545
		method,傳送的方法,有POST跟GET兩種		
6545
		method,傳送的方法,有POST跟GET兩種
6546
		範例用法:
6546
		範例用法:
6547
		element=document.getElementsByClassName('quickDayLog')[0];
6547
		element=document.getElementsByClassName('quickDayLog')[0];
6548
		window.qbpwcf.postDataAttr.func.call(this,element,'logRes.php','POST','rootDiv');
6548
		window.qbpwcf.postDataAttr.func.call(this,element,'logRes.php','POST','rootDiv');
6549
		*/					
6549
		*/
6550
		window.qbpwcf.postDataAttr.func=function(element,url,method,rootDiv){
6550
		window.qbpwcf.postDataAttr.func=function(element,url,method,rootDiv){
6551
 
6551
 
6552
			//綁定事件到元素上
6552
			//綁定事件到元素上
6553
			element.addEventListener('click',function(event){
6553
			element.addEventListener('click',function(event){
6554
 
6554
 
6555
				//取得目標url
6555
				//取得目標url
6556
				window.qbpwcf.postDataAttr.url=url;
6556
				window.qbpwcf.postDataAttr.url=url;
6557
 
6557
 
6558
				//取得表單傳遞方式
6558
				//取得表單傳遞方式
6559
				window.qbpwcf.postDataAttr.method=method;	
6559
				window.qbpwcf.postDataAttr.method=method;
6560
			
6560
 
6561
				//取得抓取回應並要放置到哪個id的div裡面
6561
				//取得抓取回應並要放置到哪個id的div裡面
6562
				window.qbpwcf.postDataAttr.rootDiv=rootDiv;
6562
				window.qbpwcf.postDataAttr.rootDiv=rootDiv;
6563
 
6563
 
6564
				//初始化要傳送的表單物件
6564
				//初始化要傳送的表單物件
6565
				window.qbpwcf.postDataAttr.params={};
6565
				window.qbpwcf.postDataAttr.params={};
6566
				
6566
 
6567
				//取得元素的data
6567
				//取得元素的data
6568
				dataset=element.dataset;
6568
				dataset=element.dataset;
6569
 
6569
 
6570
				//針對每個表單名稱
6570
				//針對每個表單名稱
6571
				for(i=0;i<Object.keys(dataset).length;i++){
6571
				for(i=0;i<Object.keys(dataset).length;i++){
Line 6578... Line 6578...
6578
 
6578
 
6579
					//取得表單的內容
6579
					//取得表單的內容
6580
					eval('window.qbpwcf.postDataAttr.params.'+key+'='+val);
6580
					eval('window.qbpwcf.postDataAttr.params.'+key+'='+val);
6581
 
6581
 
6582
					}//for end
6582
					}//for end
6583
	
6583
 
6584
				//遞迴取得回應並放在特定div裡面
6584
				//遞迴取得回應並放在特定div裡面
6585
				window.qbpwcf.tailAny.func.call(this,window.qbpwcf.postDataAttr.params,window.qbpwcf.postDataAttr.url,window.qbpwcf.postDataAttr.method,window.qbpwcf.postDataAttr.rootDiv);			
6585
				window.qbpwcf.tailAny.func.call(this,window.qbpwcf.postDataAttr.params,window.qbpwcf.postDataAttr.url,window.qbpwcf.postDataAttr.method,window.qbpwcf.postDataAttr.rootDiv);
6586
 
6586
 
6587
				});//function end
6587
				});//function end
6588
			};
6588
			};
6589
		";
6589
		";
6590
		$conf["javaScript::toScript"]["jsFunciton"][]=
6590
		$conf["javaScript::toScript"]["jsFunciton"][]=
Line 6593... Line 6593...
6593
		涵式說明:
6593
		涵式說明:
6594
		統一處理托移事件
6594
		統一處理托移事件
6595
		*/
6595
		*/
6596
		// drag event handler start
6596
		// drag event handler start
6597
		window.dragEventHandler={};
6597
		window.dragEventHandler={};
6598
		
6598
 
6599
		//儲存被拖移的元素
6599
		//儲存被拖移的元素
6600
		window.dragEventHandler.dragged={};
6600
		window.dragEventHandler.dragged={};
6601
 
6601
 
6602
		//儲存被壓住的元素
6602
		//儲存被壓住的元素
6603
		window.dragEventHandler.dropped={};
6603
		window.dragEventHandler.dropped={};
Line 6611... Line 6611...
6611
			color: white;
6611
			color: white;
6612
			background: blue;
6612
			background: blue;
6613
			margin-bottom: 10px;
6613
			margin-bottom: 10px;
6614
			}
6614
			}
6615
		</style>
6615
		</style>
6616
		<div class='dropzone'> 
6616
		<div class='dropzone'>
6617
		  <div draggable='true'> 
6617
		  <div draggable='true'>
6618
		    This div is draggable 
6618
		    This div is draggable
6619
		  </div> 
6619
		  </div>
6620
		</div> 
6620
		</div>
-
 
6621
		<div class='dropzone'></div>
6621
		<div class='dropzone'></div>
6622
		<div class='dropzone'></div>
6622
		<div class='dropzone'></div> 
-
 
6623
		<div class='dropzone'></div>
6623
		<div class='dropzone'></div>
6624
		*/
6624
		*/
6625
 
6625
 
6626
		/*
6626
		/*
6627
		處理被拖移元素壓住其他元素後的事件處理函式,宣告即可設定如何處理.
6627
		處理被拖移元素壓住其他元素後的事件處理函式,宣告即可設定如何處理.
Line 6631... Line 6631...
6631
		被壓住的元素
6631
		被壓住的元素
6632
		obj.dropped
6632
		obj.dropped
6633
		window.dragEventHandler.handler=function(param){};
6633
		window.dragEventHandler.handler=function(param){};
6634
		若不宣告則,如果被壓住的div有 'dropzone' 類別,才會動作.
6634
		若不宣告則,如果被壓住的div有 'dropzone' 類別,才會動作.
6635
		*/
6635
		*/
6636
		
6636
 
6637
		/*
6637
		/*
6638
		參考資料:
6638
		參考資料:
6639
		https://developer.mozilla.org/en-US/docs/Web/API/Document/drag_event
6639
		https://developer.mozilla.org/en-US/docs/Web/API/Document/drag_event
6640
		*/
6640
		*/
6641
 
6641
 
6642
		//事件綁定的函式
6642
		//事件綁定的函式
6643
		window.dragEventHandler.func=function(){
6643
		window.dragEventHandler.func=function(){
6644
		
6644
 
6645
			//events fired on the draggable target
6645
			//events fired on the draggable target
6646
			document.addEventListener('drag', function(event) {
6646
			document.addEventListener('drag', function(event) {
6647
 
6647
 
6648
				});
6648
				});
6649
 
6649
 
Line 6653... Line 6653...
6653
				//讓被托移的目標可以被被看到
6653
				//讓被托移的目標可以被被看到
6654
				event.dataTransfer.setData('text/plain',null);
6654
				event.dataTransfer.setData('text/plain',null);
6655
 
6655
 
6656
				// store a ref. on the dragged elem
6656
				// store a ref. on the dragged elem
6657
				window.dragEventHandler.dragged = event.target;
6657
				window.dragEventHandler.dragged = event.target;
6658
			  
6658
 
6659
				// make it half transparent
6659
				// make it half transparent
6660
				event.target.style.opacity = .5;
6660
				event.target.style.opacity = .5;
6661
				
6661
 
6662
				});
6662
				});
6663
	
6663
 
6664
			//在被托移物品上移動時.
6664
			//在被托移物品上移動時.
6665
			/* events fired on the drop targets */
6665
			/* events fired on the drop targets */
6666
			document.addEventListener('dragover', function(event) {
6666
			document.addEventListener('dragover', function(event) {
6667
				
6667
 
6668
				// prevent default to allow drop
6668
				// prevent default to allow drop
6669
				event.preventDefault();
6669
				event.preventDefault();
6670
 
6670
 
6671
				});
6671
				});
6672
 
6672
 
6673
			//移到別的元素時觸發
6673
			//移到別的元素時觸發
6674
			document.addEventListener('dragenter', function(event) {
6674
			document.addEventListener('dragenter', function(event) {
6675
 
6675
 
6676
				// highlight potential drop target when the draggable element enters it
6676
				// highlight potential drop target when the draggable element enters it
6677
				if (event.target.className == 'dropzone'){
6677
				if (event.target.className == 'dropzone'){
6678
				
6678
 
6679
					event.target.style.opacity = .5;
6679
					event.target.style.opacity = .5;
6680
					
6680
 
6681
					}
6681
					}
6682
				
6682
 
6683
				});
6683
				});
6684
 
6684
 
6685
			//移開移動到的元素時觸發
6685
			//移開移動到的元素時觸發
6686
			document.addEventListener('dragleave', function(event) {
6686
			document.addEventListener('dragleave', function(event) {
6687
 
6687
 
6688
				// unhighlight of potential drop target when the draggable element leaves it				
6688
				// unhighlight of potential drop target when the draggable element leaves it
6689
				if (event.target.className == 'dropzone') {
6689
				if (event.target.className == 'dropzone') {
6690
				
6690
 
6691
					//設置不透明
6691
					//設置不透明
6692
					event.target.style.opacity = 1.0;
6692
					event.target.style.opacity = 1.0;
6693
					
6693
 
6694
					}
6694
					}
6695
					
6695
 
6696
				});
6696
				});
6697
			
6697
 
6698
			//放開移動中的元素時觸發
6698
			//放開移動中的元素時觸發
6699
			document.addEventListener('drop', function(event) {
6699
			document.addEventListener('drop', function(event) {
6700
			
6700
 
6701
				// prevent default action (open as link for some elements)
6701
				// prevent default action (open as link for some elements)
6702
				event.preventDefault();
6702
				event.preventDefault();
6703
 
6703
 
6704
				// 取得被壓的元素
6704
				// 取得被壓的元素
6705
				window.dragEventHandler.dropped=event.target
6705
				window.dragEventHandler.dropped=event.target
6706
 
6706
 
6707
				// move dragged elem to the selected drop target
6707
				// move dragged elem to the selected drop target
6708
				if (event.target.className == 'dropzone') {
6708
				if (event.target.className == 'dropzone') {
6709
				
6709
 
6710
					//設置不透明
6710
					//設置不透明
6711
					event.target.style.opacity = 1.0;
6711
					event.target.style.opacity = 1.0;
6712
					
6712
 
6713
			  		}
6713
			  		}
6714
			  		
6714
 
6715
				});
6715
				});
6716
				
6716
 
6717
			}
6717
			}
6718
			
6718
 
6719
			//托移結束
6719
			//托移結束
6720
			document.addEventListener('dragend', function(event) {
6720
			document.addEventListener('dragend', function(event) {
6721
 
6721
 
6722
				// reset the transparency
6722
				// reset the transparency
6723
				event.target.style.opacity = '';
6723
				event.target.style.opacity = '';
6724
				
6724
 
6725
				//初始化要回傳的元素
6725
				//初始化要回傳的元素
6726
				obj={};
6726
				obj={};
6727
				
6727
 
6728
				//設置被托移的元素
6728
				//設置被托移的元素
6729
				obj.dragged=window.dragEventHandler.dragged;
6729
				obj.dragged=window.dragEventHandler.dragged;
6730
				
6730
 
6731
				//設置被壓住的元素
6731
				//設置被壓住的元素
6732
				obj.dropped=window.dragEventHandler.dropped;
6732
				obj.dropped=window.dragEventHandler.dropped;
6733
				
6733
 
6734
				//debug
6734
				//debug
6735
				console.log(obj);
6735
				console.log(obj);
6736
 
6736
 
6737
				if(window.dragEventHandler.handler!==undefined){
6737
				if(window.dragEventHandler.handler!==undefined){
6738
 
6738
 
6739
					if(typeof(window.dragEventHandler.handler)==='function'){										
6739
					if(typeof(window.dragEventHandler.handler)==='function'){
6740
					
6740
 
6741
						window.dragEventHandler.handler.call(this,obj);
6741
						window.dragEventHandler.handler.call(this,obj);
6742
 
6742
 
6743
						}
6743
						}
6744
 
6744
 
6745
					}
6745
					}
6746
				
6746
 
6747
				//採用預設的做法	
6747
				//採用預設的做法
6748
				else{
6748
				else{
6749
					//被壓住的不是div就停止
6749
					//被壓住的不是div就停止
6750
					if(window.dragEventHandler.dropped.tagName!=='DIV'){
6750
					if(window.dragEventHandler.dropped.tagName!=='DIV'){
6751
						
6751
 
6752
						return false;
6752
						return false;
6753
					
6753
 
6754
						}
6754
						}
6755
				
6755
 
6756
					//目標div有幾個類別就執行幾次
6756
					//目標div有幾個類別就執行幾次
6757
					for(i=0;i<window.dragEventHandler.dropped.classList.length;i++){
6757
					for(i=0;i<window.dragEventHandler.dropped.classList.length;i++){
6758
					
6758
 
6759
						//如果被壓住的div有 'dropzone' 類別,才會動作.
6759
						//如果被壓住的div有 'dropzone' 類別,才會動作.
6760
						if(window.dragEventHandler.dropped.classList[i]==='dropzone'){
6760
						if(window.dragEventHandler.dropped.classList[i]==='dropzone'){
6761
							
6761
 
6762
							//覆蓋到目標元素
6762
							//覆蓋到目標元素
6763
							window.dragEventHandler.dropped.innerHTML=window.dragEventHandler.dragged.outerHTML;
6763
							window.dragEventHandler.dropped.innerHTML=window.dragEventHandler.dragged.outerHTML;
6764
							
6764
 
6765
							//移除被移開的元素
6765
							//移除被移開的元素
6766
							window.dragEventHandler.dragged.innerHTML='';
6766
							window.dragEventHandler.dragged.innerHTML='';
6767
							
6767
 
6768
							//結束迴圈
6768
							//結束迴圈
6769
							break;
6769
							break;
6770
						
6770
 
6771
							}
6771
							}
6772
						}
6772
						}
6773
					}
6773
					}
6774
				});
6774
				});
6775
				// drag event handler end
6775
				// drag event handler end
Line 6780... Line 6780...
6780
		導頁的函式:
6780
		導頁的函式:
6781
		*/
6781
		*/
6782
 
6782
 
6783
		//如果沒有 window.qbpwcf.redirectURL
6783
		//如果沒有 window.qbpwcf.redirectURL
6784
		if(window.qbpwcf.redirectURL===undefined){
6784
		if(window.qbpwcf.redirectURL===undefined){
6785
			
6785
 
6786
			//宣告 window.qbpwcf.`redirectURL 為空物件
6786
			//宣告 window.qbpwcf.`redirectURL 為空物件
6787
			window.qbpwcf.redirectURL={};
6787
			window.qbpwcf.redirectURL={};
6788
 
6788
 
6789
			}//if end
6789
			}//if end
6790
 
6790
 
Line 6822... Line 6822...
6822
			//反之
6822
			//反之
6823
			else{
6823
			else{
6824
 
6824
 
6825
				//設置過了 params.countdownSec 秒後要做的事情.
6825
				//設置過了 params.countdownSec 秒後要做的事情.
6826
				setTimeout(function(){
6826
				setTimeout(function(){
6827
					
6827
 
6828
					//導頁到 params.url
6828
					//導頁到 params.url
6829
					window.location.href=params.url;
6829
					window.location.href=params.url;
6830
					
6830
 
6831
					},params.countdownSec*1000);
6831
					},params.countdownSec*1000);
6832
 
6832
 
6833
				}//else end
6833
				}//else end
6834
 
6834
 
6835
			}//if end
6835
			}//if end
Line 6863... Line 6863...
6863
 
6863
 
6864
			}//if end
6864
			}//if end
6865
 
6865
 
6866
		//初始化 window.tailAny 物件
6866
		//初始化 window.tailAny 物件
6867
		window.qbpwcf.tailAny={};
6867
		window.qbpwcf.tailAny={};
6868
		
6868
 
6869
		//初始化 window.qbpwcf.tailAny.continue 為 true,代表遞迴執行.
6869
		//初始化 window.qbpwcf.tailAny.continue 為 true,代表遞迴執行.
6870
		window.qbpwcf.tailAny.continue=true;
6870
		window.qbpwcf.tailAny.continue=true;
6871
		
6871
 
6872
		//初始化 將結果輸出到畫面上的函式
6872
		//初始化 將結果輸出到畫面上的函式
6873
		//res,為ajax抓到的結果json.
6873
		//res,為ajax抓到的結果json.
6874
		//rootDivId,為回應要放到id為rootDivId的div裡面.
6874
		//rootDivId,為回應要放到id為rootDivId的div裡面.
6875
		window.qbpwcf.tailAny.outputFunc=function(res,rootDivId){
6875
		window.qbpwcf.tailAny.outputFunc=function(res,rootDivId){
6876
		
6876
 
6877
			//針對每個輸出的行
6877
			//針對每個輸出的行
6878
			for(var i=0;i<res.lines.length;i++){
6878
			for(var i=0;i<res.lines.length;i++){
6879
		
6879
 
6880
				//如果內容不為空
6880
				//如果內容不為空
6881
				if(res.lines[i]!==''){
6881
				if(res.lines[i]!==''){
6882
				
6882
 
6883
					//set output line
6883
					//set output line
6884
					div=document.createElement('div');
6884
					div=document.createElement('div');
6885
					text=document.createTextNode(res.lines[i]);
6885
					text=document.createTextNode(res.lines[i]);
6886
					div.appendChild(text);
6886
					div.appendChild(text);
6887
				
6887
 
6888
					}//if end
6888
					}//if end
6889
			
6889
 
6890
				//反之
6890
				//反之
6891
				else{
6891
				else{
6892
				
6892
 
6893
					//set output line
6893
					//set output line
6894
					div=document.createElement('div');
6894
					div=document.createElement('div');
6895
				
6895
 
6896
					//建立換行語法
6896
					//建立換行語法
6897
					p=document.createElement('p');
6897
					p=document.createElement('p');
6898
						
6898
 
6899
					//放置換行語法
6899
					//放置換行語法
6900
					div.appendChild(p);
6900
					div.appendChild(p);
6901
				
6901
 
6902
					}//else end
6902
					}//else end
6903
							
6903
 
6904
				//show output line
6904
				//show output line
6905
				rootDiv=document.getElementById(xmlhttp.mother.rootDivId);
6905
				rootDiv=document.getElementById(xmlhttp.mother.rootDivId);
6906
				rootDiv.prepend(div);
6906
				rootDiv.prepend(div);
6907
 
6907
 
6908
				}//for end
6908
				}//for end
6909
		
6909
 
6910
			}//function window.qbpwcf.tailAny.outputFunc end
6910
			}//function window.qbpwcf.tailAny.outputFunc end
6911
		
6911
 
6912
		//初始化 window.tailAny 函式
6912
		//初始化 window.tailAny 函式
6913
		window.qbpwcf.tailAny.func=function(params,url,method,resRootDivId){
6913
		window.qbpwcf.tailAny.func=function(params,url,method,resRootDivId){
6914
 
6914
 
6915
			//取得使用的參數 params
6915
			//取得使用的參數 params
6916
			this.params=params;
6916
			this.params=params;
6917
 
6917
 
6918
			//初始化儲存新的get and post變數
6918
			//初始化儲存新的get and post變數
6919
			this.newParams='';
6919
			this.newParams='';
6920
			
6920
 
6921
			//初始化要查尋的 url
6921
			//初始化要查尋的 url
6922
			this.url=url;
6922
			this.url=url;
6923
 
6923
 
6924
			//取得method
6924
			//取得method
6925
			this.method=method;
6925
			this.method=method;
6926
 
6926
 
6927
			//初始化持續執行
6927
			//初始化持續執行
6928
			this.continue=window.qbpwcf.tailAny.continue;
6928
			this.continue=window.qbpwcf.tailAny.continue;
6929
			
6929
 
6930
			//放置回應的 div id 字串
6930
			//放置回應的 div id 字串
6931
			this.rootDivId=resRootDivId;
6931
			this.rootDivId=resRootDivId;
6932
 
6932
 
6933
			//取得query參數長度
6933
			//取得query參數長度
6934
			pl=Object.keys(params).length;
6934
			pl=Object.keys(params).length;
6935
 
6935
 
6936
			//針對每隔 query 參數
6936
			//針對每隔 query 參數
6937
			for(var i=0;i<pl;i++){
6937
			for(var i=0;i<pl;i++){
6938
			
6938
 
6939
				//&符號字串
6939
				//&符號字串
6940
				var andStr='&';
6940
				var andStr='&';
6941
			
6941
 
6942
				//如果是第一個 query 參數
6942
				//如果是第一個 query 參數
6943
				if(i===0){
6943
				if(i===0){
6944
				
6944
 
6945
					//&符號字串
6945
					//&符號字串
6946
					andStr=''
6946
					andStr=''
6947
				
6947
 
6948
					}//if end
6948
					}//if end
6949
			
6949
 
6950
				//串接查詢字串,並 url encode
6950
				//串接查詢字串,並 url encode
6951
				this.newParams=this.newParams+andStr+encodeURIComponent(Object.keys(params)[i])+'='+encodeURIComponent(Object.values(params)[i]);
6951
				this.newParams=this.newParams+andStr+encodeURIComponent(Object.keys(params)[i])+'='+encodeURIComponent(Object.values(params)[i]);
6952
			
6952
 
6953
				}//for end
6953
				}//for end
6954
 
6954
 
6955
			//如果是 GET 方法
6955
			//如果是 GET 方法
6956
			if(method==='GET'){
6956
			if(method==='GET'){
6957
 
6957
 
6958
				//設置查詢的url
6958
				//設置查詢的url
6959
				this.url=this.url+'?'+this.newParams;
6959
				this.url=this.url+'?'+this.newParams;
6960
 
6960
 
6961
				}//if end
6961
				}//if end
6962
					
6962
 
6963
			xmlhttp=new XMLHttpRequest();
6963
			xmlhttp=new XMLHttpRequest();
6964
			xmlhttp.mother=this;
6964
			xmlhttp.mother=this;
6965
			xmlhttp.responseType='json';
6965
			xmlhttp.responseType='json';
6966
			xmlhttp.open(method,this.url,true);
6966
			xmlhttp.open(method,this.url,true);
6967
			xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
6967
			xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
Line 6969... Line 6969...
6969
			xmlhttp.onreadystatechange=function(){
6969
			xmlhttp.onreadystatechange=function(){
6970
 
6970
 
6971
				//如果狀態為4且response code為200
6971
				//如果狀態為4且response code為200
6972
				if(xmlhttp.readyState===4 && xmlhttp.status===200){
6972
				if(xmlhttp.readyState===4 && xmlhttp.status===200){
6973
 
6973
 
6974
					//get response					
6974
					//get response
6975
					res=xmlhttp.response;
6975
					res=xmlhttp.response;
6976
					
6976
 
6977
					//將結果放到畫面上
6977
					//將結果放到畫面上
6978
					window.qbpwcf.tailAny.outputFunc.call(this,res,xmlhttp.mother.rootDivId);	
6978
					window.qbpwcf.tailAny.outputFunc.call(this,res,xmlhttp.mother.rootDivId);
6979
			
6979
 
6980
					//如果有新的識別欄位與數值
6980
					//如果有新的識別欄位與數值
6981
					if(res.id!==undefined){
6981
					if(res.id!==undefined){
6982
 
6982
 
6983
						//取消舊的識別欄位						
6983
						//取消舊的識別欄位
6984
						xmlhttp.mother.params={};						
6984
						xmlhttp.mother.params={};
6985
 
6985
 
6986
						//如果有新的識別欄位
6986
						//如果有新的識別欄位
6987
						for(i=0;i<Object.keys(res.id).length;i++){
6987
						for(i=0;i<Object.keys(res.id).length;i++){
6988
 
6988
 
6989
							//取得識別欄位
6989
							//取得識別欄位
Line 6997... Line 6997...
6997
 
6997
 
6998
							}//for end
6998
							}//for end
6999
 
6999
 
7000
						}//if end
7000
						}//if end
7001
 
7001
 
7002
					//如果要繼續	
7002
					//如果要繼續
7003
					if(xmlhttp.mother.continue){
7003
					if(xmlhttp.mother.continue){
7004
 
7004
 
7005
						//遞迴
7005
						//遞迴
7006
						window.qbpwcf.tailAny.func(xmlhttp.mother.params,xmlhttp.mother.url,xmlhttp.mother.method,xmlhttp.mother.rootDivId);
7006
						window.qbpwcf.tailAny.func(xmlhttp.mother.params,xmlhttp.mother.url,xmlhttp.mother.method,xmlhttp.mother.rootDivId);
7007
					
7007
 
7008
						}//if end
7008
						}//if end
7009
						
7009
 
7010
					//反之要暫停
7010
					//反之要暫停
7011
					else{
7011
					else{
7012
					
7012
 
7013
						//設置無限等待
7013
						//設置無限等待
7014
						var intervalTail = window.setInterval(function(){
7014
						var intervalTail = window.setInterval(function(){
7015
						
7015
 
7016
							//console.log(window.qbpwcf.tailAny.continue);
7016
							//console.log(window.qbpwcf.tailAny.continue);
7017
						
7017
 
7018
							//如果要繼續了
7018
							//如果要繼續了
7019
							if(xmlhttp.mother.continue){
7019
							if(xmlhttp.mother.continue){
7020
							
7020
 
7021
								//清除無限等待
7021
								//清除無限等待
7022
								clearInterval(intervalTail);
7022
								clearInterval(intervalTail);
7023
								
7023
 
7024
								//遞迴
7024
								//遞迴
7025
								window.qbpwcf.tailAny.func(xmlhttp.mother.params,xmlhttp.mother.url,xmlhttp.mother.method,xmlhttp.mother.rootDivId);
7025
								window.qbpwcf.tailAny.func(xmlhttp.mother.params,xmlhttp.mother.url,xmlhttp.mother.method,xmlhttp.mother.rootDivId);
7026
													
7026
 
7027
								}//if end
7027
								}//if end
7028
						
7028
 
7029
							},1000);
7029
							},1000);
7030
					
7030
 
7031
						}//else end
7031
						}//else end
7032
					
7032
 
7033
					}//if end
7033
					}//if end
7034
 
7034
 
7035
				}//function end
7035
				}//function end
7036
			
7036
 
7037
			//如果是 GET 方法
7037
			//如果是 GET 方法
7038
			if(method==='GET'){
7038
			if(method==='GET'){
7039
 
7039
 
7040
				//不夾帶內容
7040
				//不夾帶內容
7041
				xmlhttp.send();
7041
				xmlhttp.send();
7042
				
7042
 
7043
				}//if end
7043
				}//if end
7044
 
7044
 
7045
			//反之是 POST 方法
7045
			//反之是 POST 方法
7046
			else{
7046
			else{
7047
 
7047
 
7048
				//夾帶內容
7048
				//夾帶內容
7049
				xmlhttp.send(this.newParams);
7049
				xmlhttp.send(this.newParams);
7050
 
7050
 
7051
				}//else end
7051
				}//else end
7052
					
7052
 
7053
			}//function end
7053
			}//function end
7054
		";
7054
		";
7055
		$conf["javaScript::toScript"]["jsFunciton"][]=
7055
		$conf["javaScript::toScript"]["jsFunciton"][]=
7056
		"
7056
		"
7057
		//如果未設定 window.qbpwcf 物件
7057
		//如果未設定 window.qbpwcf 物件
Line 7082... Line 7082...
7082
		window.qbpwcf.gatDataDynamic.func.call(this,element,8,params,'/logRes.php','POST','rootDiv');
7082
		window.qbpwcf.gatDataDynamic.func.call(this,element,8,params,'/logRes.php','POST','rootDiv');
7083
		*/
7083
		*/
7084
 
7084
 
7085
		//設置當前函式的變數
7085
		//設置當前函式的變數
7086
		window.qbpwcf.gatDataDynamic.func=function(element,length,params,url,method,rootDiv){
7086
		window.qbpwcf.gatDataDynamic.func=function(element,length,params,url,method,rootDiv){
7087
			
7087
 
7088
			//debug
7088
			//debug
7089
			//console.log(element,length,params,url,method,rootDiv);
7089
			//console.log(element,length,params,url,method,rootDiv);
7090
			
7090
 
7091
			//儲存內容長度要為多少
7091
			//儲存內容長度要為多少
7092
			window.qbpwcf.gatDataDynamic.length=length;
7092
			window.qbpwcf.gatDataDynamic.length=length;
7093
 
7093
 
7094
			//儲存要傳遞的條件
7094
			//儲存要傳遞的條件
7095
			window.qbpwcf.gatDataDynamic.params=params;
7095
			window.qbpwcf.gatDataDynamic.params=params;
Line 7103... Line 7103...
7103
			//儲存回應的div id
7103
			//儲存回應的div id
7104
			window.qbpwcf.gatDataDynamic.rootDiv=rootDiv;
7104
			window.qbpwcf.gatDataDynamic.rootDiv=rootDiv;
7105
 
7105
 
7106
			//初始化暫存的物件
7106
			//初始化暫存的物件
7107
			window.qbpwcf.gatDataDynamic.tmp={};
7107
			window.qbpwcf.gatDataDynamic.tmp={};
7108
			
7108
 
7109
			//初始化暫存最新表單數值的長度
7109
			//初始化暫存最新表單數值的長度
7110
			window.qbpwcf.gatDataDynamic.tmp.latestValueLength=0;
7110
			window.qbpwcf.gatDataDynamic.tmp.latestValueLength=0;
7111
 
7111
 
7112
			//綁定事件到該元素身上
7112
			//綁定事件到該元素身上
7113
			element.addEventListener('keyup',function(event){
7113
			element.addEventListener('keyup',function(event){
7114
 
7114
 
7115
				//取得使用的參數名稱
7115
				//取得使用的參數名稱
7116
				paramName=Object.keys(window.qbpwcf.gatDataDynamic.params)[0];
7116
				paramName=Object.keys(window.qbpwcf.gatDataDynamic.params)[0];
7117
			
7117
 
7118
				//取得事件觸發後的參數數值
7118
				//取得事件觸發後的參數數值
7119
				eval('window.qbpwcf.gatDataDynamic.params.'+paramName+'=\''+event.target.value+'\'');
7119
				eval('window.qbpwcf.gatDataDynamic.params.'+paramName+'=\''+event.target.value+'\'');
7120
 
7120
 
7121
				//誤觸
7121
				//誤觸
7122
				if(event.isComposing || event.keyCode === 229) {
7122
				if(event.isComposing || event.keyCode === 229) {
7123
    
7123
 
7124
					//取消執行
7124
					//取消執行
7125
					return false;
7125
					return false;
7126
 
7126
 
7127
 					}//if end
7127
 					}//if end
7128
					
7128
 
7129
				//如果長度跟之前比沒有變化,且按下的不為Enter鍵
7129
				//如果長度跟之前比沒有變化,且按下的不為Enter鍵
7130
				if(event.target.value.length===window.qbpwcf.gatDataDynamic.tmp.latestValueLength && event.keyCode !== 13){
7130
				if(event.target.value.length===window.qbpwcf.gatDataDynamic.tmp.latestValueLength && event.keyCode !== 13){
7131
				
7131
 
7132
					//取消執行
7132
					//取消執行
7133
					return false;
7133
					return false;
7134
				
7134
 
7135
					}//if end
7135
					}//if end
7136
					
7136
 
7137
				//反之長度有變化
7137
				//反之長度有變化
7138
				else{
7138
				else{
7139
				
7139
 
7140
					//更新最新變化後的數值長度
7140
					//更新最新變化後的數值長度
7141
					window.qbpwcf.gatDataDynamic.tmp.latestValueLength=event.target.value.length;
7141
					window.qbpwcf.gatDataDynamic.tmp.latestValueLength=event.target.value.length;
7142
				
7142
 
7143
					}//else end
7143
					}//else end
7144
					
7144
 
7145
				//如果長度不對
7145
				//如果長度不對
7146
				if(event.target.value.length!==window.qbpwcf.gatDataDynamic.length){
7146
				if(event.target.value.length!==window.qbpwcf.gatDataDynamic.length){
7147
 
7147
 
7148
					//取消執行
7148
					//取消執行
7149
					return false;
7149
					return false;
Line 7191... Line 7191...
7191
			name:'console.log',
7191
			name:'console.log',
7192
			params:'debug',
7192
			params:'debug',
7193
		};
7193
		};
7194
		window.qbpwcf.sequenceQuery.func.call(this,url,name,queue,callback);
7194
		window.qbpwcf.sequenceQuery.func.call(this,url,name,queue,callback);
7195
		*/
7195
		*/
7196
		
7196
 
7197
		//設置當前函式的變數
7197
		//設置當前函式的變數
7198
		window.qbpwcf.sequenceQuery.func=function(url,name,queue,callback){
7198
		window.qbpwcf.sequenceQuery.func=function(url,name,queue,callback){
7199
 
7199
 
7200
			//如果網址未指定
7200
			//如果網址未指定
7201
			if(url===undefined){
7201
			if(url===undefined){
7202
			
7202
 
7203
				//結束執行
7203
				//結束執行
7204
				return false;
7204
				return false;
7205
			
7205
 
7206
				}//if end
7206
				}//if end
7207
 
7207
 
7208
			//save url to global
7208
			//save url to global
7209
			window.qbpwcf.sequenceQuery.url=url;
7209
			window.qbpwcf.sequenceQuery.url=url;
7210
 
7210
 
Line 7213... Line 7213...
7213
 
7213
 
7214
			//save callback to global
7214
			//save callback to global
7215
			window.qbpwcf.sequenceQuery.callback={};
7215
			window.qbpwcf.sequenceQuery.callback={};
7216
			window.qbpwcf.sequenceQuery.callback.name=callback.name;
7216
			window.qbpwcf.sequenceQuery.callback.name=callback.name;
7217
			window.qbpwcf.sequenceQuery.callback.params=callback.params;
7217
			window.qbpwcf.sequenceQuery.callback.params=callback.params;
7218
			
7218
 
7219
			//debug
7219
			//debug
7220
			//console.log(window.qbpwcf.sequenceQuery.callback);
7220
			//console.log(window.qbpwcf.sequenceQuery.callback);
7221
 
7221
 
7222
			//初始化參數
7222
			//初始化參數
7223
			params={};
7223
			params={};
7224
 
7224
 
7225
			//設置參數
7225
			//設置參數
7226
			eval('params.'+name+'=queue');
7226
			eval('params.'+name+'=queue');
7227
			
7227
 
7228
			//debug
7228
			//debug
7229
			//console.log(params);
7229
			//console.log(params);
7230
 
7230
 
7231
			//初始化參數 window.tailAny.params 字串
7231
			//初始化參數 window.tailAny.params 字串
7232
			window.qbpwcf.sequenceQuery.params='';
7232
			window.qbpwcf.sequenceQuery.params='';
Line 7237... Line 7237...
7237
				//&符號字串
7237
				//&符號字串
7238
				andStr='';
7238
				andStr='';
7239
 
7239
 
7240
				//如果參數目前不為空
7240
				//如果參數目前不為空
7241
				if(window.qbpwcf.sequenceQuery.params!==''){
7241
				if(window.qbpwcf.sequenceQuery.params!==''){
7242
					
7242
 
7243
					//&符號字串
7243
					//&符號字串
7244
					andStr='\&';
7244
					andStr='\&';
7245
				
7245
 
7246
					}//if end
7246
					}//if end
7247
 
7247
 
7248
				//串接查詢字串,並 url encode
7248
				//串接查詢字串,並 url encode
7249
				window.qbpwcf.sequenceQuery.params=window.qbpwcf.sequenceQuery.params+andStr+encodeURIComponent(key)+'='+encodeURIComponent(eval('params.'+key));
7249
				window.qbpwcf.sequenceQuery.params=window.qbpwcf.sequenceQuery.params+andStr+encodeURIComponent(key)+'='+encodeURIComponent(eval('params.'+key));
7250
 
7250
 
Line 7253... Line 7253...
7253
 
7253
 
7254
				});
7254
				});
7255
 
7255
 
7256
			//debug
7256
			//debug
7257
			//console.log(window.qbpwcf.sequenceQuery.params);
7257
			//console.log(window.qbpwcf.sequenceQuery.params);
7258
		
7258
 
7259
			xmlhttp=new XMLHttpRequest();
7259
			xmlhttp=new XMLHttpRequest();
7260
			xmlhttp.responseType='json';
7260
			xmlhttp.responseType='json';
7261
			xmlhttp.timeout=60000;
7261
			xmlhttp.timeout=60000;
7262
			xmlhttp.open('POST',url,true);
7262
			xmlhttp.open('POST',url,true);
7263
			xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
7263
			xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
Line 7265... Line 7265...
7265
			xmlhttp.onreadystatechange=function(){
7265
			xmlhttp.onreadystatechange=function(){
7266
 
7266
 
7267
				//如果狀態為4且response code為200
7267
				//如果狀態為4且response code為200
7268
				if(xmlhttp.readyState===4 && xmlhttp.status===200){
7268
				if(xmlhttp.readyState===4 && xmlhttp.status===200){
7269
 
7269
 
7270
					//get response					
7270
					//get response
7271
					res=xmlhttp.response;
7271
					res=xmlhttp.response;
7272
			
7272
 
7273
					//debug
7273
					//debug
7274
					//console.log(res);
7274
					//console.log(res);
7275
					
7275
 
7276
					//如果執行失敗
7276
					//如果執行失敗
7277
					if(res.status==='false'){
7277
					if(res.status==='false'){
7278
						
7278
 
7279
						//結束執行
7279
						//結束執行
7280
						return false;
7280
						return false;
7281
					
7281
 
7282
						}//if end
7282
						}//if end
7283
					
7283
 
7284
					//取得回應的內容
7284
					//取得回應的內容
7285
					content=res.content;
7285
					content=res.content;
7286
					
7286
 
7287
					//debug
7287
					//debug
7288
					//console.log(content);
7288
					//console.log(content);
7289
					
7289
 
7290
					//如果遇到null元素
7290
					//如果遇到null元素
7291
					if(content[0]==='null'){
7291
					if(content[0]==='null'){
7292
					
7292
 
7293
						//callback
7293
						//callback
7294
						eval(window.qbpwcf.sequenceQuery.callback.name+'.call(this,window.qbpwcf.sequenceQuery.callback.params)');
7294
						eval(window.qbpwcf.sequenceQuery.callback.name+'.call(this,window.qbpwcf.sequenceQuery.callback.params)');
7295
					
7295
 
7296
						//結束執行
7296
						//結束執行
7297
						return true;
7297
						return true;
7298
					
7298
 
7299
						}//if end
7299
						}//if end
7300
					
7300
 
7301
					//遞迴
7301
					//遞迴
7302
					window.qbpwcf.sequenceQuery.func.call(this,window.qbpwcf.sequenceQuery.url,window.qbpwcf.sequenceQuery.name,content,window.qbpwcf.sequenceQuery.callback);
7302
					window.qbpwcf.sequenceQuery.func.call(this,window.qbpwcf.sequenceQuery.url,window.qbpwcf.sequenceQuery.name,content,window.qbpwcf.sequenceQuery.callback);
7303
 
7303
 
7304
					}//if end
7304
					}//if end
7305
 
7305
 
7306
				}//function end
7306
				}//function end
7307
 
7307
 
7308
			//夾帶內容
7308
			//夾帶內容
7309
			xmlhttp.send(window.qbpwcf.sequenceQuery.params);
7309
			xmlhttp.send(window.qbpwcf.sequenceQuery.params);
7310
		
7310
 
7311
			};
7311
			};
7312
 
7312
 
7313
		";
7313
		";
7314
		$conf["javaScript::toScript"]["jsFunciton"][]=
7314
		$conf["javaScript::toScript"]["jsFunciton"][]=
7315
		"
7315
		"
Line 7321... Line 7321...
7321
 
7321
 
7322
			}//if end
7322
			}//if end
7323
 
7323
 
7324
		//設置 window.qbpwcf.modal 物件
7324
		//設置 window.qbpwcf.modal 物件
7325
		window.qbpwcf.modal={};
7325
		window.qbpwcf.modal={};
7326
		
7326
 
7327
		//預設的 modal 標題是由 div 組成
7327
		//預設的 modal 標題是由 div 組成
7328
		window.qbpwcf.modal.title=document.createElement('div');
7328
		window.qbpwcf.modal.title=document.createElement('div');
7329
 
7329
 
7330
		//預設的 modal 標題
7330
		//預設的 modal 標題
7331
		window.qbpwcf.modal.title.innerText='Confirm window';
7331
		window.qbpwcf.modal.title.innerText='Confirm window';
7332
		
7332
 
7333
		//預設的 modal 標題樣式
7333
		//預設的 modal 標題樣式
7334
		window.qbpwcf.modal.title.style.fontWeight='bold';
7334
		window.qbpwcf.modal.title.style.fontWeight='bold';
7335
				
7335
 
7336
		//預設的 modal 標題背景顏色
7336
		//預設的 modal 標題背景顏色
7337
		window.qbpwcf.modal.bgColor='#DDDDFF';
7337
		window.qbpwcf.modal.bgColor='#DDDDFF';
7338
		
7338
 
7339
		//預設的 modal 內文
7339
		//預設的 modal 內文
7340
		window.qbpwcf.modal.content=document.createTextNode('Are you sure?');
7340
		window.qbpwcf.modal.content=document.createTextNode('Are you sure?');
7341
		
7341
 
7342
		//預設的 取消 按鈕內容
7342
		//預設的 取消 按鈕內容
7343
		window.qbpwcf.modal.cancle='Cancel';
7343
		window.qbpwcf.modal.cancle='Cancel';
7344
		
7344
 
7345
		//預設的 取消 按鈕背景顏色
7345
		//預設的 取消 按鈕背景顏色
7346
		window.qbpwcf.modal.cancleBgColor='#FFDDDD';
7346
		window.qbpwcf.modal.cancleBgColor='#FFDDDD';
7347
		
7347
 
7348
		//預設的取消按鈕點擊後要做的事情
7348
		//預設的取消按鈕點擊後要做的事情
7349
		window.qbpwcf.modal.cancelAction=function(e)
7349
		window.qbpwcf.modal.cancelAction=function(e)
7350
		{
7350
		{
7351
			//delete whole confirm window
7351
			//delete whole confirm window
7352
			document.getElementById('qbpwcf.bgDiv').remove();
7352
			document.getElementById('qbpwcf.bgDiv').remove();
7353
			document.getElementById('qbpwcf.modalRootDiv').remove();
7353
			document.getElementById('qbpwcf.modalRootDiv').remove();
7354
		}
7354
		}
7355
		
7355
 
7356
		//預設的 確認 按鈕內容
7356
		//預設的 確認 按鈕內容
7357
		window.qbpwcf.modal.confirm='Confirm';
7357
		window.qbpwcf.modal.confirm='Confirm';
7358
		
7358
 
7359
		//預設的 確認 按鈕背景顏色
7359
		//預設的 確認 按鈕背景顏色
7360
		window.qbpwcf.modal.confirmBgColor='#DDFFFF';
7360
		window.qbpwcf.modal.confirmBgColor='#DDFFFF';
7361
		
7361
 
7362
		//預設的確認按鈕要做的事情
7362
		//預設的確認按鈕要做的事情
7363
		window.qbpwcf.modal.confirmAction=function(e)
7363
		window.qbpwcf.modal.confirmAction=function(e)
7364
		{
7364
		{
7365
			alert('you click confirm');
7365
			alert('you click confirm');
7366
			window.qbpwcf.modal.cancelAction.call(this);
7366
			window.qbpwcf.modal.cancelAction.call(this);
7367
		}
7367
		}
7368
		
7368
 
7369
		//modal的最寬高設定物件
7369
		//modal的最寬高設定物件
7370
		window.qbpwcf.modal.RootDiv={};
7370
		window.qbpwcf.modal.RootDiv={};
7371
		
7371
 
7372
		//modal的寬度比例,1~99
7372
		//modal的寬度比例,1~99
7373
		window.qbpwcf.modal.RootDiv.width='80';
7373
		window.qbpwcf.modal.RootDiv.width='80';
7374
		
7374
 
7375
		//modal距離高度的比例
7375
		//modal距離高度的比例
7376
		window.qbpwcf.modal.RootDiv.top='10';
7376
		window.qbpwcf.modal.RootDiv.top='10';
7377
		
7377
 
7378
		//建立顯示 qbpwcf modal 的函式
7378
		//建立顯示 qbpwcf modal 的函式
7379
		window.qbpwcf.modal.show=function(){
7379
		window.qbpwcf.modal.show=function(){
7380
		
7380
 
7381
			//建立背景div
7381
			//建立背景div
7382
			bgDiv=document.createElement('div');
7382
			bgDiv=document.createElement('div');
7383
		
7383
 
7384
			//設定樣式為全螢幕
7384
			//設定樣式為全螢幕
7385
			bgDiv.style.width='100vw';
7385
			bgDiv.style.width='100vw';
7386
			bgDiv.style.height='100vh';
7386
			bgDiv.style.height='100vh';
7387
			bgDiv.style.backgroundColor='grey';
7387
			bgDiv.style.backgroundColor='grey';
7388
			bgDiv.style.opacity='0.7';
7388
			bgDiv.style.opacity='0.7';
7389
			bgDiv.style.position='fixed';
7389
			bgDiv.style.position='fixed';
7390
			bgDiv.style.top='0px';
7390
			bgDiv.style.top='0px';
7391
			bgDiv.style.left='0px';
7391
			bgDiv.style.left='0px';
7392
			bgDiv.style.zIndex='10000';
7392
			bgDiv.style.zIndex='10000';
7393
			
7393
 
7394
			//設定id
7394
			//設定id
7395
			bgDiv.id='qbpwcf.bgDiv';
7395
			bgDiv.id='qbpwcf.bgDiv';
7396
			
7396
 
7397
			//確認視窗的div
7397
			//確認視窗的div
7398
			modalRootDiv=document.createElement('div');
7398
			modalRootDiv=document.createElement('div');
7399
			
7399
 
7400
			//設定id
7400
			//設定id
7401
			modalRootDiv.id='qbpwcf.modalRootDiv';
7401
			modalRootDiv.id='qbpwcf.modalRootDiv';
7402
			
7402
 
7403
			//確認視窗的modal樣式
7403
			//確認視窗的modal樣式
7404
			modalRootDiv.style.width=window.qbpwcf.modal.RootDiv.width+'vw';
7404
			modalRootDiv.style.width=window.qbpwcf.modal.RootDiv.width+'vw';
7405
			modalRootDiv.style.top=window.qbpwcf.modal.RootDiv.top+'vh';
7405
			modalRootDiv.style.top=window.qbpwcf.modal.RootDiv.top+'vh';
7406
			modalRootDiv.style.backgroundColor='white';
7406
			modalRootDiv.style.backgroundColor='white';
7407
			modalRootDiv.style.position='fixed';
7407
			modalRootDiv.style.position='fixed';
7408
			modalRootDiv.style.left=((100-window.qbpwcf.modal.RootDiv.width)/2)+'vw';
7408
			modalRootDiv.style.left=((100-window.qbpwcf.modal.RootDiv.width)/2)+'vw';
7409
			modalRootDiv.style.zIndex='10001';
7409
			modalRootDiv.style.zIndex='10001';
7410
			modalRootDiv.style.borderRadius='10px';
7410
			modalRootDiv.style.borderRadius='10px';
7411
						
7411
 
7412
			//modal title div
7412
			//modal title div
7413
			modalTitleDiv=document.createElement('div');
7413
			modalTitleDiv=document.createElement('div');
7414
			
7414
 
7415
			//set modal title content
7415
			//set modal title content
7416
			modalTitleDiv.appendChild(window.qbpwcf.modal.title);
7416
			modalTitleDiv.appendChild(window.qbpwcf.modal.title);
7417
			
7417
 
7418
			//set modal title bg color
7418
			//set modal title bg color
7419
			modalTitleDiv.style.backgroundColor=window.qbpwcf.modal.bgColor;
7419
			modalTitleDiv.style.backgroundColor=window.qbpwcf.modal.bgColor;
7420
			
7420
 
7421
			//set modal title line height attr
7421
			//set modal title line height attr
7422
			modalTitleDiv.style.minHeight='20px';
7422
			modalTitleDiv.style.minHeight='20px';
7423
			
7423
 
7424
			//set modal title line height attr
7424
			//set modal title line height attr
7425
			modalTitleDiv.style.borderRadius='inherit';
7425
			modalTitleDiv.style.borderRadius='inherit';
7426
			
7426
 
7427
			//set modal title line height attr
7427
			//set modal title line height attr
7428
			modalTitleDiv.style.paddingLeft='5px';
7428
			modalTitleDiv.style.paddingLeft='5px';
7429
			
7429
 
7430
			//put modal title to modal root div
7430
			//put modal title to modal root div
7431
			modalRootDiv.appendChild(modalTitleDiv);
7431
			modalRootDiv.appendChild(modalTitleDiv);
7432
			
7432
 
7433
			//modal content div
7433
			//modal content div
7434
			modalContentDiv=document.createElement('div');
7434
			modalContentDiv=document.createElement('div');
7435
						
7435
 
7436
			//set modal content text
7436
			//set modal content text
7437
			modalContentDiv.appendChild(window.qbpwcf.modal.content);
7437
			modalContentDiv.appendChild(window.qbpwcf.modal.content);
7438
			
7438
 
7439
			//set modal content style
7439
			//set modal content style
7440
			modalContentDiv.style.textAlign='center';
7440
			modalContentDiv.style.textAlign='center';
7441
			modalContentDiv.style.lineHeight=(window.qbpwcf.modal.RootDiv.height-10)+'vh';
7441
			modalContentDiv.style.lineHeight=(window.qbpwcf.modal.RootDiv.height-10)+'vh';
7442
			
7442
 
7443
			//put modal content to modal root div
7443
			//put modal content to modal root div
7444
			modalRootDiv.appendChild(modalContentDiv);
7444
			modalRootDiv.appendChild(modalContentDiv);
7445
							
7445
 
7446
			//modal bottom div
7446
			//modal bottom div
7447
			modalBottomDiv=document.createElement('div');				
7447
			modalBottomDiv=document.createElement('div');
7448
								
7448
 
7449
			//set modal bottom line height
7449
			//set modal bottom line height
7450
			modalBottomDiv.style.lineHeight='6vh';
7450
			modalBottomDiv.style.lineHeight='6vh';
7451
			
7451
 
7452
			//set modal bptton text align style to right
7452
			//set modal bptton text align style to right
7453
			modalBottomDiv.style.textAlign='right';
7453
			modalBottomDiv.style.textAlign='right';
7454
				
7454
 
7455
			//set modal bottom 圓角
7455
			//set modal bottom 圓角
7456
			modalBottomDiv.style.borderRadius='5px';	
7456
			modalBottomDiv.style.borderRadius='5px';
7457
				
7457
 
7458
			//set modal bottom background color
7458
			//set modal bottom background color
7459
			modalBottomDiv.style.backgroundColor=modalRootDiv.style.backgroundColor;	
7459
			modalBottomDiv.style.backgroundColor=modalRootDiv.style.backgroundColor;
7460
				
7460
 
7461
			//modal close button
7461
			//modal close button
7462
			cancleSpan=document.createElement('span');	
7462
			cancleSpan=document.createElement('span');
7463
				
7463
 
7464
			//字體為粗體字
7464
			//字體為粗體字
7465
			cancleSpan.style.fontWeight='bold';	
7465
			cancleSpan.style.fontWeight='bold';
7466
				
7466
 
7467
			//set model close button text content
7467
			//set model close button text content
7468
			cancleSpan.innerText=window.qbpwcf.modal.cancle;	
7468
			cancleSpan.innerText=window.qbpwcf.modal.cancle;
7469
								
7469
 
7470
			//set cancle button background color
7470
			//set cancle button background color
7471
			cancleSpan.style.backgroundColor=window.qbpwcf.modal.cancleBgColor;
7471
			cancleSpan.style.backgroundColor=window.qbpwcf.modal.cancleBgColor;
7472
			
7472
 
7473
			//cancle button 元素間的距離
7473
			//cancle button 元素間的距離
7474
			cancleSpan.style.marging='5vw';
7474
			cancleSpan.style.marging='5vw';
7475
			
7475
 
7476
			//cancle button 元素的範圍
7476
			//cancle button 元素的範圍
7477
			cancleSpan.style.padding='1vh';
7477
			cancleSpan.style.padding='1vh';
7478
			
7478
 
7479
			//cancle button 不超出範圍
7479
			//cancle button 不超出範圍
7480
			cancleSpan.style.position='relative';
7480
			cancleSpan.style.position='relative';
7481
			cancleSpan.style.bottom='4vh';
7481
			cancleSpan.style.bottom='4vh';
7482
			
7482
 
7483
			//cancle button 圓角
7483
			//cancle button 圓角
7484
			cancleSpan.style.borderRadius='100px';
7484
			cancleSpan.style.borderRadius='100px';
7485
				
7485
 
7486
			//cancle button pointer
7486
			//cancle button pointer
7487
			cancleSpan.style.cursor='pointer';		
7487
			cancleSpan.style.cursor='pointer';
7488
			
7488
 
7489
			//okSpan button right top & bottom
7489
			//okSpan button right top & bottom
7490
			cancleSpan.style.top='0px';
7490
			cancleSpan.style.top='0px';
7491
			cancleSpan.style.bottom='0px';
7491
			cancleSpan.style.bottom='0px';
7492
			
7492
 
7493
			//設置點擊 cancle button 要做的事情.
7493
			//設置點擊 cancle button 要做的事情.
7494
			cancleSpan.addEventListener('click',function(e)
7494
			cancleSpan.addEventListener('click',function(e)
7495
			{
7495
			{
7496
				window.qbpwcf.modal.cancelAction(e);
7496
				window.qbpwcf.modal.cancelAction(e);
7497
			});
7497
			});
7498
								
7498
 
7499
			//modal ok button
7499
			//modal ok button
7500
			okSpan=document.createElement('span');	
7500
			okSpan=document.createElement('span');
7501
			
7501
 
7502
			//字體為粗體字
7502
			//字體為粗體字
7503
			okSpan.style.fontWeight='bold';
7503
			okSpan.style.fontWeight='bold';
7504
				
7504
 
7505
			//set model ok button text content
7505
			//set model ok button text content
7506
			okSpan.innerText=window.qbpwcf.modal.confirm;		
7506
			okSpan.innerText=window.qbpwcf.modal.confirm;
7507
			
7507
 
7508
			//set ok button background color
7508
			//set ok button background color
7509
			okSpan.style.backgroundColor=window.qbpwcf.modal.confirmBgColor;	
7509
			okSpan.style.backgroundColor=window.qbpwcf.modal.confirmBgColor;
7510
			
7510
 
7511
			//okSpan button 元素間的距離
7511
			//okSpan button 元素間的距離
7512
			okSpan.style.marginLeft='5vw';
7512
			okSpan.style.marginLeft='5vw';
7513
			okSpan.style.marginRight='5vw';
7513
			okSpan.style.marginRight='5vw';
7514
			
7514
 
7515
			//okSpan button 元素的範圍
7515
			//okSpan button 元素的範圍
7516
			okSpan.style.padding='1vh';	
7516
			okSpan.style.padding='1vh';
7517
			
7517
 
7518
			//okSpan button 不超出範圍
7518
			//okSpan button 不超出範圍
7519
			okSpan.style.position='relative';
7519
			okSpan.style.position='relative';
7520
			okSpan.style.bottom='4vh';	
7520
			okSpan.style.bottom='4vh';
7521
			
7521
 
7522
			//okSpan button 圓角
7522
			//okSpan button 圓角
7523
			okSpan.style.borderRadius='100px';
7523
			okSpan.style.borderRadius='100px';
7524
			
7524
 
7525
			//okSpan button pointer
7525
			//okSpan button pointer
7526
			okSpan.style.cursor='pointer';	
7526
			okSpan.style.cursor='pointer';
7527
			
7527
 
7528
			//okSpan button right top & bottom
7528
			//okSpan button right top & bottom
7529
			okSpan.style.top='0px';
7529
			okSpan.style.top='0px';
7530
			okSpan.style.bottom='0px';
7530
			okSpan.style.bottom='0px';
7531
			
7531
 
7532
			//設置點擊 cancle button 要做的事情.
7532
			//設置點擊 cancle button 要做的事情.
7533
			okSpan.addEventListener('click',function(e)
7533
			okSpan.addEventListener('click',function(e)
7534
			{
7534
			{
7535
				window.qbpwcf.modal.confirmAction(e);
7535
				window.qbpwcf.modal.confirmAction(e);
7536
			});
7536
			});
7537
			
7537
 
7538
			//put cancle and ok button to modal bottom div
7538
			//put cancle and ok button to modal bottom div
7539
			modalBottomDiv.appendChild(cancleSpan);
7539
			modalBottomDiv.appendChild(cancleSpan);
7540
			modalBottomDiv.appendChild(okSpan);
7540
			modalBottomDiv.appendChild(okSpan);
7541
						
7541
 
7542
			//put modal bottom div to modal root div
7542
			//put modal bottom div to modal root div
7543
			modalRootDiv.appendChild(modalBottomDiv);			
7543
			modalRootDiv.appendChild(modalBottomDiv);
7544
									
7544
 
7545
			//bgDiv放置到當前 window
7545
			//bgDiv放置到當前 window
7546
			document.body.appendChild(bgDiv);
7546
			document.body.appendChild(bgDiv);
7547
						
7547
 
7548
			//put root modal div to body
7548
			//put root modal div to body
7549
			document.body.appendChild(modalRootDiv);
7549
			document.body.appendChild(modalRootDiv);
7550
			
7550
 
7551
			}//if end	
7551
			}//if end
7552
		";
7552
		";
7553
		$conf["javaScript::toScript"]["jsFunciton"][]=
7553
		$conf["javaScript::toScript"]["jsFunciton"][]=
7554
		"
7554
		"
7555
		//如果未設定 window.qbpwcf 物件
7555
		//如果未設定 window.qbpwcf 物件
7556
		if(window.qbpwcf===undefined){
7556
		if(window.qbpwcf===undefined){
Line 7565... Line 7565...
7565
 
7565
 
7566
			//設置 window.qbpwcf.form  為空物件
7566
			//設置 window.qbpwcf.form  為空物件
7567
			window.qbpwcf.form={};
7567
			window.qbpwcf.form={};
7568
 
7568
 
7569
			}//if end
7569
			}//if end
7570
		
7570
 
7571
		/*
7571
		/*
7572
		如果回覆的結果是json,且具有error屬性,則會進行需要手動消除的提示.
7572
		如果回覆的結果是json,且具有error屬性,則會進行需要手動消除的提示.
7573
		如果回覆的結果是json,且具有content性,則會進行會自動消失的提示.
7573
		如果回覆的結果是json,且具有content性,則會進行會自動消失的提示.
7574
		如果回覆的結果是json,且具有location屬性,則會進行導頁.
7574
		如果回覆的結果是json,且具有location屬性,則會進行導頁.
7575
		window.qbpwcf.form.fakeScrollingList(),建構子,初始化fakeScrollingList.
7575
		window.qbpwcf.form.fakeScrollingList(),建構子,初始化fakeScrollingList.
Line 7592... Line 7592...
7592
		window.qbpwcf.from.replaceCurrentPageToDomResponse,布林,預設為true,代表得到ajax回應為非json的dom時,會將其結果呈現到當前畫面;反之為false.
7592
		window.qbpwcf.from.replaceCurrentPageToDomResponse,布林,預設為true,代表得到ajax回應為非json的dom時,會將其結果呈現到當前畫面;反之為false.
7593
		window.qbpwcf.form.active(),啟用fake Scrolling list.
7593
		window.qbpwcf.form.active(),啟用fake Scrolling list.
7594
		*/
7594
		*/
7595
		//設置 this 物件,建構子.
7595
		//設置 this 物件,建構子.
7596
		window.qbpwcf.form.fakeScrollingList=function(){
7596
		window.qbpwcf.form.fakeScrollingList=function(){
7597
		
7597
 
7598
			//要用 fake scrolling list 選單呈現的元素 id 為?
7598
			//要用 fake scrolling list 選單呈現的元素 id 為?
7599
			this.eleId='';
7599
			this.eleId='';
7600
		
7600
 
7601
			//要用 fake scrolling list 選單呈現的元素為,若 eleId 為 '' 且該變數不等於 '' 就會採用.
7601
			//要用 fake scrolling list 選單呈現的元素為,若 eleId 為 '' 且該變數不等於 '' 就會採用.
7602
			this.targetEle='';
7602
			this.targetEle='';
7603
		
7603
 
7604
			//fake scrolling list 預設選單關閉的 叉叉按鈕
7604
			//fake scrolling list 預設選單關閉的 叉叉按鈕
7605
			this.closeIcon='data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgoKPHN2ZwogICB4bWxuczpvc2I9Imh0dHA6Ly93d3cub3BlbnN3YXRjaGJvb2sub3JnL3VyaS8yMDA5L29zYiIKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgeG1sbnM6c29kaXBvZGk9Imh0dHA6Ly9zb2RpcG9kaS5zb3VyY2Vmb3JnZS5uZXQvRFREL3NvZGlwb2RpLTAuZHRkIgogICB4bWxuczppbmtzY2FwZT0iaHR0cDovL3d3dy5pbmtzY2FwZS5vcmcvbmFtZ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k9IjAiCiAgICAgICAgIHk9IjE3NC41NTY0OSIKICAgICAgICAgeD0iLTY3LjM5ODc1OCIKICAgICAgICAgaGVpZ2h0PSIyLjE1MjIwNjQiCiAgICAgICAgIHdpZHRoPSIyOS4yNzk2NDgiCiAgICAgICAgIGlkPSJyZWN0NDQxMyIKICAgICAgICAgc3R5bGU9Im9wYWNpdHk6MTtmaWxsOiNmZmZmMDA7ZmlsbC1vcGFjaXR5OjE7ZmlsbC1ydWxlOm5vbnplcm87c3Ryb2tlOiMwMDAwMDA7c3Ryb2tlLXdpZHRoOjA7c3Ryb2tlLW1pdGVybGltaXQ6NDtzdHJva2UtZGFzaGFycmF5Om5vbmU7c3Ryb2tlLW9wYWNpdHk6MTtmaWx0ZXI6dXJsKCNmaWx0ZXI0NDQ2KSIgLz4KICAgICAgPHJlY3QKICAgICAgICAgdHJhbnNmb3JtPSJyb3RhdGUoLTEzOS4wMzQ0MikiCiAgICAgICAgIHJ5PSIwIgogICAgICAgICB5PSItNzMuMDUwOTQ5IgogICAgICAgICB4PSItMTgyLjk2MjUyIgogICAgICAgICBoZWlnaHQ9IjIuMTUyMjA2NCIKICAgICAgICAgd2lkdGg9IjI5LjI3OTY0OCIKICAgICAgICAgaWQ9InJlY3Q0NDEzLTMiCiAgICAgICAgIHN0eWxlPSJvcGFjaXR5OjE7ZmlsbDojZmZmZjAwO2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDowO3N0cm9rZS1taXRlcmxpbWl0OjQ7c3Ryb2tlLWRhc2hhcnJheTpub25lO3N0cm9rZS1vcGFjaXR5OjE7ZmlsdGVyOnVybCgjZmlsdGVyNDQzOCkiIC8+CiAgICA8L2c+CiAgPC9nPgo8L3N2Zz4K';
7606
		
7606
 
7607
			//fake scrolling list 預設選項選到哪個就不傳送表單
7607
			//fake scrolling list 預設選項選到哪個就不傳送表單
7608
			this.noActionOption={name:'Please select one option',value:''};
7608
			this.noActionOption={name:'Please select one option',value:''};
7609
		
7609
 
7610
			//布林值,預設為false,不啟用;反之為true代表點選元素後就直接送出最後一個選項的數值.啟用條件為window.qbpwcf.form.options只有一個元素.
7610
			//布林值,預設為false,不啟用;反之為true代表點選元素後就直接送出最後一個選項的數值.啟用條件為window.qbpwcf.form.options只有一個元素.
7611
			this.sendOnClickWhenOnly2options=false;
7611
			this.sendOnClickWhenOnly2options=false;
7612
		
7612
 
7613
			//預設選擇了要傳送的項目後,會傳送表單,設置為true代表不會傳送表單只會將選項對應的數值內容交給 this.callback 陣列中的 callback 處理.
7613
			//預設選擇了要傳送的項目後,會傳送表單,設置為true代表不會傳送表單只會將選項對應的數值內容交給 this.callback 陣列中的 callback 處理.
7614
			this.donotSendFrom=false;
7614
			this.donotSendFrom=false;
7615
		
7615
 
7616
			//fake scrolling list 選單傳送出去時要加上的隱藏變陣列
7616
			//fake scrolling list 選單傳送出去時要加上的隱藏變陣列
7617
			this.hiddenVar=[];
7617
			this.hiddenVar=[];
7618
		
7618
 
7619
			//fake scrolling list 選單傳送出去時要加上的隱藏變數名稱與內容,預設為hiddenVarName數值為hiddenVarValue
7619
			//fake scrolling list 選單傳送出去時要加上的隱藏變數名稱與內容,預設為hiddenVarName數值為hiddenVarValue
7620
			this.hiddenVar.push({name:'hiddenVarName',value:'hidenVarValue'});
7620
			this.hiddenVar.push({name:'hiddenVarName',value:'hidenVarValue'});
7621
		
7621
 
7622
			//fake scrolling list 選項的預設項目
7622
			//fake scrolling list 選項的預設項目
7623
			this.defaultOption=this.noActionOption;
7623
			this.defaultOption=this.noActionOption;
7624
		
7624
 
7625
			//fake scrolling list 的選項資訊
7625
			//fake scrolling list 的選項資訊
7626
			this.options=[];
7626
			this.options=[];
7627
		
7627
 
7628
			//預設只有一個選擇了不會送出的選項
7628
			//預設只有一個選擇了不會送出的選項
7629
			this.options.push(this.noActionOption);
7629
			this.options.push(this.noActionOption);
7630
		
7630
 
7631
			//接受要求的頁面,預設為當前頁面
7631
			//接受要求的頁面,預設為當前頁面
7632
			this.recPage=location.href;
7632
			this.recPage=location.href;
7633
		
7633
 
7634
			//傳送表單時的選項對應的變數名稱,預設為'variable'.
7634
			//傳送表單時的選項對應的變數名稱,預設為'variable'.
7635
			this.sendVarName='variable';
7635
			this.sendVarName='variable';
7636
			
7636
 
7637
			//選項送出後,取得的回應要作為參數呼叫哪些 callback
7637
			//選項送出後,取得的回應要作為參數呼叫哪些 callback
7638
			this.callback=[];
7638
			this.callback=[];
7639
			
7639
 
7640
			//預設的 callback 為 console.log
7640
			//預設的 callback 為 console.log
7641
			this.callback.push(console.log);
7641
			this.callback.push(console.log);
7642
			
7642
 
7643
			//預設不自動觸發
7643
			//預設不自動觸發
7644
			this.autoStart=false;
7644
			this.autoStart=false;
7645
			
7645
 
7646
			//預設為true,代表得到ajax回應為非json的dom時,會將其結果呈現到當前畫面;
7646
			//預設為true,代表得到ajax回應為非json的dom時,會將其結果呈現到當前畫面;
7647
			this.replaceCurrentPageToDomResponse=true;
7647
			this.replaceCurrentPageToDomResponse=true;
7648
			
7648
 
7649
			//預設為false,代表允許關閉選單.
7649
			//預設為false,代表允許關閉選單.
7650
			this.disallowClose=false;
7650
			this.disallowClose=false;
7651
			
7651
 
7652
			//預設關閉選單後不要進行轉地址.
7652
			//預設關閉選單後不要進行轉地址.
7653
			this.redirectAfterClose=false;
7653
			this.redirectAfterClose=false;
7654
			
7654
 
7655
			//取得目標元素的涵式
7655
			//取得目標元素的涵式
7656
			this.getTarget=function(){
7656
			this.getTarget=function(){
7657
			
7657
 
7658
				//如果有設置目標id
7658
				//如果有設置目標id
7659
				if(this.eleId!==''){
7659
				if(this.eleId!==''){
7660
				
7660
 
7661
					//設置 targetEle
7661
					//設置 targetEle
7662
					this.targetEle=document.getElementById('this.eleId');
7662
					this.targetEle=document.getElementById('this.eleId');
7663
				
7663
 
7664
					}//if end
7664
					}//if end
7665
					
7665
 
7666
				//如果元素變數為空字串的話
7666
				//如果元素變數為空字串的話
7667
				if(this.targetEle===''){
7667
				if(this.targetEle===''){
7668
					
7668
 
7669
					//設置要自動觸發
7669
					//設置要自動觸發
7670
					this.autoStart=true;
7670
					this.autoStart=true;
7671
					
7671
 
7672
					}//if end
7672
					}//if end
7673
 
7673
 
7674
				//反之元素如果是body
7674
				//反之元素如果是body
7675
				else if(this.targetEle.tagName==='BODY'){
7675
				else if(this.targetEle.tagName==='BODY'){
7676
				
7676
 
7677
					//提示錯誤
7677
					//提示錯誤
7678
					console.error('Please define targetEle other than BODY');
7678
					console.error('Please define targetEle other than BODY');
7679
					
7679
 
7680
					//結束執行
7680
					//結束執行
7681
					return false;
7681
					return false;
7682
				
7682
 
7683
					}//if end
7683
					}//if end
7684
				
7684
 
7685
				//如果要自動觸發
7685
				//如果要自動觸發
7686
				if(this.autoStart===true){
7686
				if(this.autoStart===true){
7687
				
7687
 
7688
					//建立div元素
7688
					//建立div元素
7689
					this.targetEle=document.createElement('div');
7689
					this.targetEle=document.createElement('div');
7690
				
7690
 
7691
					}//if end
7691
					}//if end
7692
					
7692
 
7693
				//存元素參考
7693
				//存元素參考
7694
				var fakeScrollingList=this.targetEle;
7694
				var fakeScrollingList=this.targetEle;
7695
					
7695
 
7696
				//回傳點擊要觸發fakeScrollingList效果的元素
7696
				//回傳點擊要觸發fakeScrollingList效果的元素
7697
				return fakeScrollingList;
7697
				return fakeScrollingList;
7698
			
7698
 
7699
				}//function end
7699
				}//function end
7700
			
7700
 
7701
			//啟用 fake scrolling list 
7701
			//啟用 fake scrolling list
7702
			this.active=function(){
7702
			this.active=function(){
7703
				
7703
 
7704
				//取得要綁定事件的元素
7704
				//取得要綁定事件的元素
7705
				var fakeScrollingList=this.getTarget();
7705
				var fakeScrollingList=this.getTarget();
7706
				
7706
 
7707
				//如果異常
7707
				//如果異常
7708
				if(fakeScrollingList===false){
7708
				if(fakeScrollingList===false){
7709
				
7709
 
7710
					//結束執行
7710
					//結束執行
7711
					return;
7711
					return;
7712
				
7712
 
7713
					}//if end
7713
					}//if end
7714
				
7714
 
7715
				//可以下拉的項目用手指頭圖示
7715
				//可以下拉的項目用手指頭圖示
7716
				fakeScrollingList.style.cursor='pointer';
7716
				fakeScrollingList.style.cursor='pointer';
7717
				
7717
 
7718
				//設置 this 給 fakeScrollingList 的 addEventListener 事件
7718
				//設置 this 給 fakeScrollingList 的 addEventListener 事件
7719
				fakeScrollingList.mother=this;
7719
				fakeScrollingList.mother=this;
7720
				
7720
 
7721
				//點擊選單之後
7721
				//點擊選單之後
7722
				fakeScrollingList.addEventListener('click',function(event){
7722
				fakeScrollingList.addEventListener('click',function(event){
7723
				
7723
 
7724
					//取消預設點擊的效果
7724
					//取消預設點擊的效果
7725
					event.preventDefault();
7725
					event.preventDefault();
7726
					
7726
 
7727
					//取得下拉式選單內容
7727
					//取得下拉式選單內容
7728
					var inputSelect=event.target;
7728
					var inputSelect=event.target;
7729
 
7729
 
7730
					//讓下拉式選單趕緊隱藏
7730
					//讓下拉式選單趕緊隱藏
7731
					inputSelect.style.opacity='0';
7731
					inputSelect.style.opacity='0';
Line 7742... Line 7742...
7742
					//設置最外層div的id
7742
					//設置最外層div的id
7743
					root.id='scrollingListRootDiv';
7743
					root.id='scrollingListRootDiv';
7744
 
7744
 
7745
					//移除重複的選單
7745
					//移除重複的選單
7746
					if(document.getElementById('scrollingListRootDiv')!==null){
7746
					if(document.getElementById('scrollingListRootDiv')!==null){
7747
					
7747
 
7748
						//移除之
7748
						//移除之
7749
						document.getElementById('scrollingListRootDiv').remove();
7749
						document.getElementById('scrollingListRootDiv').remove();
7750
					
7750
 
7751
						}//if end
7751
						}//if end
7752
 
7752
 
7753
					//設置最外層div的樣式
7753
					//設置最外層div的樣式
7754
					root.classList.add('__qbpwcf_scrollingListRootDiv');
7754
					root.classList.add('__qbpwcf_scrollingListRootDiv');
7755
 
7755
 
Line 7762... Line 7762...
7762
					//初始化記錄選擇的選項index
7762
					//初始化記錄選擇的選項index
7763
					var selectedOptionIndex=0;
7763
					var selectedOptionIndex=0;
7764
 
7764
 
7765
					//針對每個選項
7765
					//針對每個選項
7766
					for(var i=0;i<opLen;i++){
7766
					for(var i=0;i<opLen;i++){
7767
					
7767
 
7768
						//取得選項實際數值
7768
						//取得選項實際數值
7769
						var opVal=optionsInfo[i].value;
7769
						var opVal=optionsInfo[i].value;
7770
 
7770
 
7771
						//取得選項顯示名稱
7771
						//取得選項顯示名稱
7772
						var opShow=optionsInfo[i].name;
7772
						var opShow=optionsInfo[i].name;
Line 7777... Line 7777...
7777
						//讓選項上下置中
7777
						//讓選項上下置中
7778
						opDiv.style.paddingTop='15px';
7778
						opDiv.style.paddingTop='15px';
7779
 
7779
 
7780
						//如果是不可以點選的選項
7780
						//如果是不可以點選的選項
7781
						if(fakeScrollingList.mother.noActionOption.name==opShow && fakeScrollingList.mother.noActionOption.value==opVal){
7781
						if(fakeScrollingList.mother.noActionOption.name==opShow && fakeScrollingList.mother.noActionOption.value==opVal){
7782
						
7782
 
7783
							//設置選項div的class
7783
							//設置選項div的class
7784
							opDiv.setAttribute('class','__qbpwcf_inputSelect');
7784
							opDiv.setAttribute('class','__qbpwcf_inputSelect');
7785
							
7785
 
7786
							}//if end
7786
							}//if end
7787
 
7787
 
7788
						//反之為可以點選的選項
7788
						//反之為可以點選的選項
7789
						else{
7789
						else{
7790
						
7790
 
7791
							//設置選項div的class
7791
							//設置選項div的class
7792
							opDiv.setAttribute('class','__qbpwcf_inputSelect __qbpwcf_inputSelect_hover');
7792
							opDiv.setAttribute('class','__qbpwcf_inputSelect __qbpwcf_inputSelect_hover');
7793
							
7793
 
7794
							}//else end
7794
							}//else end
7795
						
7795
 
7796
						//設置裡面的文字要換行的時候改用...表示
7796
						//設置裡面的文字要換行的時候改用...表示
7797
						opDiv.style.whiteSpace='nowrap';
7797
						opDiv.style.whiteSpace='nowrap';
7798
						opDiv.style.width='100%';
7798
						opDiv.style.width='100%';
7799
						opDiv.style.overflow='hidden';
7799
						opDiv.style.overflow='hidden';
7800
						opDiv.style.textOverflow='ellipsis';
7800
						opDiv.style.textOverflow='ellipsis';
7801
						
7801
 
7802
						//偶數欄位
7802
						//偶數欄位
7803
						if(i%2===0){
7803
						if(i%2===0){
7804
						
7804
 
7805
							//設置選項div底色為藍色
7805
							//設置選項div底色為藍色
7806
							opDiv.style.backgroundColor='CCCCFF';
7806
							opDiv.style.backgroundColor='CCCCFF';
7807
						
7807
 
7808
							}//if end
7808
							}//if end
7809
						
7809
 
7810
						//反之為奇數欄位
7810
						//反之為奇數欄位
7811
						else{
7811
						else{
7812
						
7812
 
7813
							//設置選項div底色為紅色
7813
							//設置選項div底色為紅色
7814
							opDiv.style.backgroundColor='FFCCCC';
7814
							opDiv.style.backgroundColor='FFCCCC';
7815
						
7815
 
7816
							}//else end
7816
							}//else end
7817
 
7817
 
7818
						//解析選項的資訊
7818
						//解析選項的資訊
7819
						var oriOptionsInfo=this.options;
7819
						var oriOptionsInfo=this.options;
7820
 
7820
 
Line 7824... Line 7824...
7824
						//將文字放進選項的div
7824
						//將文字放進選項的div
7825
						opDiv.appendChild(textnode);
7825
						opDiv.appendChild(textnode);
7826
 
7826
 
7827
						//設置選項對應的實際數值
7827
						//設置選項對應的實際數值
7828
						opDiv.dataset.val=opVal;
7828
						opDiv.dataset.val=opVal;
7829
						
7829
 
7830
						//設置選項對應的索引
7830
						//設置選項對應的索引
7831
						opDiv.dataset.index=i;
7831
						opDiv.dataset.index=i;
7832
		
7832
 
7833
						//將選項放進為了上下左右置中的div
7833
						//將選項放進為了上下左右置中的div
7834
						divForMiddle.appendChild(opDiv);
7834
						divForMiddle.appendChild(opDiv);
7835
 
7835
 
7836
						}//for end
7836
						}//for end
7837
 
7837
 
Line 7944... Line 7944...
7944
							//取得點擊到的選項名稱
7944
							//取得點擊到的選項名稱
7945
							var clickedName=clickedOption.innerHTML;
7945
							var clickedName=clickedOption.innerHTML;
7946
 
7946
 
7947
							//如果不需要傳送表單
7947
							//如果不需要傳送表單
7948
							if(this.mother.donotSendFrom){
7948
							if(this.mother.donotSendFrom){
7949
							
7949
 
7950
								//取得要移除 scrolling list 的 div
7950
								//取得要移除 scrolling list 的 div
7951
								var divToDel=document.getElementById('scrollingListRootDiv');
7951
								var divToDel=document.getElementById('scrollingListRootDiv');
7952
 
7952
 
7953
								//移除 scrolling list div
7953
								//移除 scrolling list div
7954
								divToDel.remove();
7954
								divToDel.remove();
7955
								
7955
 
7956
								//針對每個要呼叫的 callback func
7956
								//針對每個要呼叫的 callback func
7957
								for(var j=0;j<this.mother.callback.length;j++){
7957
								for(var j=0;j<this.mother.callback.length;j++){
7958
								
7958
 
7959
									//callback
7959
									//callback
7960
									this.mother.callback[j].call(this,clickedValue);
7960
									this.mother.callback[j].call(this,clickedValue);
7961
								
7961
 
7962
									}//for end
7962
									}//for end
7963
 
7963
 
7964
								//復原下拉式選單
7964
								//復原下拉式選單
7965
								inputSelect.style.opacity='unset';
7965
								inputSelect.style.opacity='unset';
7966
							
7966
 
7967
								//結束執行
7967
								//結束執行
7968
								return true;
7968
								return true;
7969
							
7969
 
7970
								}//if end
7970
								}//if end
7971
 
7971
 
7972
							//如果不是不需要傳送數值的選項
7972
							//如果不是不需要傳送數值的選項
7973
							if(fakeScrollingList.mother.noActionOption.name!==clickedName && fakeScrollingList.mother.noActionOption.value!==clickedValue){
7973
							if(fakeScrollingList.mother.noActionOption.name!==clickedName && fakeScrollingList.mother.noActionOption.value!==clickedValue){
7974
							
7974
 
7975
								//建立表單物件
7975
								//建立表單物件
7976
								var queryStr='';
7976
								var queryStr='';
7977
 
7977
 
7978
								//新增表單的名稱與對應的數值
7978
								//新增表單的名稱與對應的數值
7979
								queryStr=queryStr+fakeScrollingList.mother.sendVarName+'='+encodeURIComponent(clickedValue);
7979
								queryStr=queryStr+fakeScrollingList.mother.sendVarName+'='+encodeURIComponent(clickedValue);
7980
 
7980
 
7981
								//針對每個隱藏的表單變數
7981
								//針對每個隱藏的表單變數
7982
								for(var j=0;j<fakeScrollingList.mother.hiddenVar.length;j++){
7982
								for(var j=0;j<fakeScrollingList.mother.hiddenVar.length;j++){
7983
									
7983
 
7984
									//附加到要傳算的表單變數裡面
7984
									//附加到要傳算的表單變數裡面
7985
									queryStr=queryStr+'&'+fakeScrollingList.mother.hiddenVar[j].name+'='+encodeURIComponent(fakeScrollingList.mother.hiddenVar[j].value);
7985
									queryStr=queryStr+'&'+fakeScrollingList.mother.hiddenVar[j].name+'='+encodeURIComponent(fakeScrollingList.mother.hiddenVar[j].value);
7986
									
7986
 
7987
									}//for end
7987
									}//for end
7988
								
7988
 
7989
								//復原下拉式選單
7989
								//復原下拉式選單
7990
								inputSelect.style.opacity='unset';
7990
								inputSelect.style.opacity='unset';
7991
								
7991
 
7992
								/*
7992
								/*
7993
								設置 window.qbpwcf.ajaxP 函數
7993
								設置 window.qbpwcf.ajaxP 函數
7994
								說明:
7994
								說明:
7995
								傳送ajax,指定傳送前要做什麼事情,然後回傳一個Promise.
7995
								傳送ajax,指定傳送前要做什麼事情,然後回傳一個Promise.
7996
								參數:
7996
								參數:
Line 8006... Line 8006...
8006
								*/
8006
								*/
8007
								var params={};
8007
								var params={};
8008
								params.method='POST';
8008
								params.method='POST';
8009
								params.url=fakeScrollingList.mother.recPage;
8009
								params.url=fakeScrollingList.mother.recPage;
8010
								params.data=queryStr;
8010
								params.data=queryStr;
8011
								
8011
 
8012
								//取得回應
8012
								//取得回應
8013
								var res = await window.qbpwcf.ajaxP.call(this,params);
8013
								var res = await window.qbpwcf.ajaxP.call(this,params);
8014
								
8014
 
8015
								//取得要移除 scrolling list 的 div
8015
								//取得要移除 scrolling list 的 div
8016
								var divToDel=document.getElementById('scrollingListRootDiv');
8016
								var divToDel=document.getElementById('scrollingListRootDiv');
8017
 
8017
 
8018
								//移除 scrolling list div
8018
								//移除 scrolling list div
8019
								divToDel.remove();
8019
								divToDel.remove();
8020
								
8020
 
8021
								//針對每個要呼叫的 callback func
8021
								//針對每個要呼叫的 callback func
8022
								for(var j=0;j<fakeScrollingList.mother.callback.length;j++){
8022
								for(var j=0;j<fakeScrollingList.mother.callback.length;j++){
8023
								
8023
 
8024
									//callback
8024
									//callback
8025
									fakeScrollingList.mother.callback[j].call(this,res);
8025
									fakeScrollingList.mother.callback[j].call(this,res);
8026
								
8026
 
8027
									}//for end
8027
									}//for end
8028
								
8028
 
8029
								//如果回應是合法的json
8029
								//如果回應是合法的json
8030
								if(res.compliantJson==true){
8030
								if(res.compliantJson==true){
8031
								
8031
 
8032
									//如果json的回應有error屬性
8032
									//如果json的回應有error屬性
8033
									if(res.json.hasOwnProperty('error')){
8033
									if(res.json.hasOwnProperty('error')){
8034
									
8034
 
8035
										//警示訊息
8035
										//警示訊息
8036
										alert(res.json.error);
8036
										alert(res.json.error);
8037
									
8037
 
8038
										}//if end
8038
										}//if end
8039
									
8039
 
8040
									//如果json的回應有content屬性
8040
									//如果json的回應有content屬性
8041
									else if(res.json.hasOwnProperty('content')){
8041
									else if(res.json.hasOwnProperty('content')){
8042
									
8042
 
8043
										//警示訊息
8043
										//警示訊息
8044
										alert(res.json.content);
8044
										alert(res.json.content);
8045
									
8045
 
8046
										}//else end
8046
										}//else end
8047
									
8047
 
8048
									//如果json的回應有 location屬性
8048
									//如果json的回應有 location屬性
8049
									if(res.json.hasOwnProperty('location')){
8049
									if(res.json.hasOwnProperty('location')){
8050
									
8050
 
8051
										//導頁
8051
										//導頁
8052
										location.href=res.json.location;
8052
										location.href=res.json.location;
8053
									
8053
 
8054
										}//if end
8054
										}//if end
8055
								
8055
 
8056
									}//if end
8056
									}//if end
8057
								
8057
 
8058
								//反之為非json,且要將dom取代當前頁面的內容
8058
								//反之為非json,且要將dom取代當前頁面的內容
8059
								else if(replaceCurrentPageToDomResponse==true){
8059
								else if(replaceCurrentPageToDomResponse==true){
8060
								
8060
 
8061
									//清空畫面
8061
									//清空畫面
8062
									document.replaceChildren();
8062
									document.replaceChildren();
8063
									
8063
 
8064
									//建立html
8064
									//建立html
8065
									var html=document.createElement('html');
8065
									var html=document.createElement('html');
8066
									
8066
 
8067
									//建立head
8067
									//建立head
8068
									var head=document.createElement('head');
8068
									var head=document.createElement('head');
8069
									
8069
 
8070
									//建立body
8070
									//建立body
8071
									var body=document.createElement('body');
8071
									var body=document.createElement('body');
8072
									
8072
 
8073
									//將回應的dom放到body
8073
									//將回應的dom放到body
8074
									body.append(res.dom);
8074
									body.append(res.dom);
8075
									
8075
 
8076
									//將head放到html裡面
8076
									//將head放到html裡面
8077
									html.append(head);
8077
									html.append(head);
8078
									
8078
 
8079
									//將body放到html裡面
8079
									//將body放到html裡面
8080
									html.append(body);
8080
									html.append(body);
8081
									
8081
 
8082
									//置換畫面為新的內榮
8082
									//置換畫面為新的內榮
8083
									document.replaceChildren(html);
8083
									document.replaceChildren(html);
8084
								
8084
 
8085
									}//if end
8085
									}//if end
8086
								
8086
 
8087
								}//if end
8087
								}//if end
8088
 
8088
 
8089
							});//function end
8089
							});//function end
8090
 
8090
 
8091
						}//for end
8091
						}//for end
8092
 
8092
 
8093
					//如果允許關閉選單
8093
					//如果允許關閉選單
8094
					if(fakeScrollingList.mother.disallowClose==false){
8094
					if(fakeScrollingList.mother.disallowClose==false){
8095
					
8095
 
8096
						//建立 close icon
8096
						//建立 close icon
8097
						var closeIcon = document.createElement('img');
8097
						var closeIcon = document.createElement('img');
8098
 
8098
 
8099
						//設置 close icon 的樣式
8099
						//設置 close icon 的樣式
8100
						closeIcon.style['position']='fixed';
8100
						closeIcon.style['position']='fixed';
Line 8129... Line 8129...
8129
							//移除 scrolling list div
8129
							//移除 scrolling list div
8130
							divToDel.remove();
8130
							divToDel.remove();
8131
 
8131
 
8132
							//復原下拉式選單
8132
							//復原下拉式選單
8133
							inputSelect.style.opacity='unset';
8133
							inputSelect.style.opacity='unset';
8134
							
8134
 
8135
							//如果有設置要到導頁到的位置
8135
							//如果有設置要到導頁到的位置
8136
							if(fakeScrollingList.mother.redirectAfterClose!=false){
8136
							if(fakeScrollingList.mother.redirectAfterClose!=false){
8137
							
8137
 
8138
								//進行導頁
8138
								//進行導頁
8139
								window.location.href=fakeScrollingList.mother.redirectAfterClose;
8139
								window.location.href=fakeScrollingList.mother.redirectAfterClose;
8140
							
8140
 
8141
								}//if end
8141
								}//if end
8142
 
8142
 
8143
							});//addEventLister
8143
							});//addEventLister
8144
 
8144
 
8145
						//如果有啟用且只有一個選項則自動點擊最後一個選項
8145
						//如果有啟用且只有一個選項則自動點擊最後一個選項
8146
						if(fakeScrollingList.mother.sendOnClickWhenOnly2options && opLen===2){
8146
						if(fakeScrollingList.mother.sendOnClickWhenOnly2options && opLen===2){
8147
						
8147
 
8148
							//debug
8148
							//debug
8149
							console.log('try auto click last option');
8149
							console.log('try auto click last option');
8150
						
8150
 
8151
							//取得選項們的外框
8151
							//取得選項們的外框
8152
							var optionOutBoderDiv=document.querySelector('div#scrollingListRootDiv').children[0].children[0];
8152
							var optionOutBoderDiv=document.querySelector('div#scrollingListRootDiv').children[0].children[0];
8153
						
8153
 
8154
							//點擊最後一個選項
8154
							//點擊最後一個選項
8155
							optionOutBoderDiv.children[1].click();
8155
							optionOutBoderDiv.children[1].click();
8156
						
8156
 
8157
							}//if end
8157
							}//if end
8158
					
8158
 
8159
						}//if end
8159
						}//if end
8160
 
8160
 
8161
					});//function end
8161
					});//function end
8162
				
8162
 
8163
				//如果要自動觸發
8163
				//如果要自動觸發
8164
				if(this.autoStart===true){
8164
				if(this.autoStart===true){
8165
				
8165
 
8166
					//觸發之
8166
					//觸發之
8167
					this.targetEle.click();
8167
					this.targetEle.click();
8168
				
8168
 
8169
					}//if end
8169
					}//if end
8170
				
8170
 
8171
				}//function active end
8171
				}//function active end
8172
				
8172
 
8173
			}//function end
8173
			}//function end
8174
		
8174
 
8175
		";
8175
		";
8176
		#js function
8176
		#js function
8177
		$conf["javaScript::toScript"]["jsFunciton"][]=
8177
		$conf["javaScript::toScript"]["jsFunciton"][]=
8178
		"
8178
		"
8179
		//如果未設定 window.qbpwcf 物件
8179
		//如果未設定 window.qbpwcf 物件
Line 8189... Line 8189...
8189
 
8189
 
8190
			//設置 window.qbpwcf.ajax  為空物件
8190
			//設置 window.qbpwcf.ajax  為空物件
8191
			window.qbpwcf.ajax={};
8191
			window.qbpwcf.ajax={};
8192
 
8192
 
8193
			}//if end
8193
			}//if end
8194
			
8194
 
8195
		/*
8195
		/*
8196
		設置 window.qbpwcf.ajax 函數
8196
		設置 window.qbpwcf.ajax 函數
8197
		說明:
8197
		說明:
8198
		傳送ajax,指定傳送前要做什麼事情,傳送後要做什麼事情.
8198
		傳送ajax,指定傳送前要做什麼事情,傳送後要做什麼事情.
8199
		參數:
8199
		參數:
Line 8205... Line 8205...
8205
		params.preAc='function name to call before send request';
8205
		params.preAc='function name to call before send request';
8206
		params.aftAc='function name to call after send request,default params is data to send';
8206
		params.aftAc='function name to call after send request,default params is data to send';
8207
		params.data='data to contain','key1=encodeURIComponent(val1)&key2=encodeURIComponent(val2)';if no data please use {};
8207
		params.data='data to contain','key1=encodeURIComponent(val1)&key2=encodeURIComponent(val2)';if no data please use {};
8208
		*/
8208
		*/
8209
		window.qbpwcf.ajax=function(params){
8209
		window.qbpwcf.ajax=function(params){
8210
		
8210
 
8211
			//檢查參數 params.method
8211
			//檢查參數 params.method
8212
			if(params.method===undefined){
8212
			if(params.method===undefined){
8213
				
8213
 
8214
				//初始化為 'POST'
8214
				//初始化為 'POST'
8215
				params.method='POST';
8215
				params.method='POST';
8216
			
8216
 
8217
				}//if end
8217
				}//if end
8218
				
8218
 
8219
			//檢查參數 params.url
8219
			//檢查參數 params.url
8220
			if(params.url===undefined){
8220
			if(params.url===undefined){
8221
			
8221
 
8222
				//初始化為當前頁面
8222
				//初始化為當前頁面
8223
				params.url=location.href;
8223
				params.url=location.href;
8224
			
8224
 
8225
				}//if end
8225
				}//if end
8226
		
8226
 
8227
			//檢查參數 params.resType
8227
			//檢查參數 params.resType
8228
			if(params.resType===undefined){
8228
			if(params.resType===undefined){
8229
			
8229
 
8230
				//初始化為'json'
8230
				//初始化為'json'
8231
				params.resType='json';
8231
				params.resType='json';
8232
			
8232
 
8233
				}//if end
8233
				}//if end
8234
				
8234
 
8235
			//檢查參數 params.preAc
8235
			//檢查參數 params.preAc
8236
			if(params.preAc===undefined){
8236
			if(params.preAc===undefined){
8237
			
8237
 
8238
				//初始化為提示傳送 ajax 前
8238
				//初始化為提示傳送 ajax 前
8239
				params.preAc=function(){
8239
				params.preAc=function(){
8240
				
8240
 
8241
					//debug
8241
					//debug
8242
					if(window.debug){
8242
					if(window.debug){
8243
				
8243
 
8244
						//提示傳送 ajax 前
8244
						//提示傳送 ajax 前
8245
						console.log('before sand request...');
8245
						console.log('before sand request...');
8246
				
8246
 
8247
						}//if end
8247
						}//if end
8248
				
8248
 
8249
					};//funcitno end
8249
					};//funcitno end
8250
			
8250
 
8251
				}//if end
8251
				}//if end
8252
				
8252
 
8253
			//檢查參數 params.aftAc
8253
			//檢查參數 params.aftAc
8254
			if(params.aftAc===undefined){
8254
			if(params.aftAc===undefined){
8255
			
8255
 
8256
				//初始化為提示傳送 ajax 後
8256
				//初始化為提示傳送 ajax 後
8257
				params.aftAc=function(){
8257
				params.aftAc=function(){
8258
				
8258
 
8259
					//debug
8259
					//debug
8260
					if(window.debug){
8260
					if(window.debug){
8261
				
8261
 
8262
						//提示傳送 ajax 後
8262
						//提示傳送 ajax 後
8263
						console.log('after sand request...');
8263
						console.log('after sand request...');
8264
				
8264
 
8265
						}//if end
8265
						}//if end
8266
				
8266
 
8267
					};//funcitno end
8267
					};//funcitno end
8268
			
8268
 
8269
				}//if end
8269
				}//if end
8270
				
8270
 
8271
			//檢查參數 params.data
8271
			//檢查參數 params.data
8272
			if(params.data===undefined){
8272
			if(params.data===undefined){
8273
							
8273
 
8274
				//初始化變數q
8274
				//初始化變數q
8275
				key1='q';
8275
				key1='q';
8276
				
8276
 
8277
				//初始化變數q的數值內容為'test by qbpwcf'
8277
				//初始化變數q的數值內容為'test by qbpwcf'
8278
				v1='test by qbpwcf';
8278
				v1='test by qbpwcf';
8279
				
8279
 
8280
				//初始要傳送的參數
8280
				//初始要傳送的參數
8281
				params.data=key1+'='+encodeURIComponent(v1);
8281
				params.data=key1+'='+encodeURIComponent(v1);
8282
			
8282
 
8283
				}//if end
8283
				}//if end
8284
					
8284
 
8285
			//如果支援 ajax
8285
			//如果支援 ajax
8286
			if(window.XMLHttpRequest){
8286
			if(window.XMLHttpRequest){
8287
 
8287
 
8288
				// code for IE7+, Firefox, Chrome, Opera, Safari
8288
				// code for IE7+, Firefox, Chrome, Opera, Safari
8289
				var xmlhttp=new XMLHttpRequest();
8289
				var xmlhttp=new XMLHttpRequest();
Line 8319... Line 8319...
8319
					if(xmlhttp.status==200){
8319
					if(xmlhttp.status==200){
8320
 
8320
 
8321
						//得到回傳結果後要做的事情,參數為回傳的結果.
8321
						//得到回傳結果後要做的事情,參數為回傳的結果.
8322
						params.aftAc.call(this,xmlhttp.response);
8322
						params.aftAc.call(this,xmlhttp.response);
8323
 
8323
 
8324
						
8324
 
8325
 
8325
 
8326
						}//if end
8326
						}//if end
8327
					
8327
 
8328
					//反之回傳狀態碼	
8328
					//反之回傳狀態碼
8329
					else{
8329
					else{
8330
					
8330
 
8331
						//得到回傳結果後要做的事情,參數為回傳的結果.
8331
						//得到回傳結果後要做的事情,參數為回傳的結果.
8332
						params.aftAc.call(this,xmlhttp.status);
8332
						params.aftAc.call(this,xmlhttp.status);
8333
					
8333
 
8334
						}//else end
8334
						}//else end
8335
 
8335
 
8336
					}//if end
8336
					}//if end
8337
 
8337
 
8338
				}//function end
8338
				}//function end
8339
 
8339
 
8340
			//設定回傳的資料形態
8340
			//設定回傳的資料形態
8341
			xmlhttp.responseType=params.resType;
8341
			xmlhttp.responseType=params.resType;
8342
 
8342
 
8343
			//如果是 'GET' 
8343
			//如果是 'GET'
8344
			if(params.method==='GET'){
8344
			if(params.method==='GET'){
8345
			
8345
 
8346
				//如果data不為空物件
8346
				//如果data不為空物件
8347
				if(params.data.toString()!=='[object Object]'){
8347
				if(params.data.toString()!=='[object Object]'){
8348
			
8348
 
8349
					//加上get用的'?'
8349
					//加上get用的'?'
8350
					params.url=params.url+'?'+params.data;
8350
					params.url=params.url+'?'+params.data;
8351
			
8351
 
8352
					}//if end
8352
					}//if end
8353
				
8353
 
8354
				}//if end
8354
				}//if end
8355
 
8355
 
8356
			//設定要用get傳送的數值
8356
			//設定要用get傳送的數值
8357
			xmlhttp.open(params.method,params.url,true);
8357
			xmlhttp.open(params.method,params.url,true);
8358
 
8358
 
8359
			//如果有設置 header
8359
			//如果有設置 header
8360
			if(params.headers!==undefined){
8360
			if(params.headers!==undefined){
8361
			
8361
 
8362
				//儲存迴圈的次數
8362
				//儲存迴圈的次數
8363
				var count=Object.keys(params.headers).length;
8363
				var count=Object.keys(params.headers).length;
8364
			
8364
 
8365
				//針對每個自己加的 header
8365
				//針對每個自己加的 header
8366
				for(var i=0;i<count;i++){
8366
				for(var i=0;i<count;i++){
8367
					
8367
 
8368
					//加上自定的 header
8368
					//加上自定的 header
8369
					xmlhttp.setRequestHeader(Object.keys(params.headers)[i],Object.values(params.headers)[i]);
8369
					xmlhttp.setRequestHeader(Object.keys(params.headers)[i],Object.values(params.headers)[i]);
8370
			
8370
 
8371
					}//for end
8371
					}//for end
8372
			
8372
 
8373
				}//if end
8373
				}//if end
8374
 
8374
 
8375
			//設定 header
8375
			//設定 header
8376
			xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
8376
			xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
8377
 
8377
 
8378
			//設定要求為ajax 的 header
8378
			//設定要求為ajax 的 header
8379
			xmlhttp.setRequestHeader('X-Requested-With','XMLHttpRequest');
8379
			xmlhttp.setRequestHeader('X-Requested-With','XMLHttpRequest');
8380
 
8380
 
8381
			//如果是 'POST' 
8381
			//如果是 'POST'
8382
			if(params.method==='POST'){
8382
			if(params.method==='POST'){
8383
 
8383
 
8384
				//如果data不為空物件
8384
				//如果data不為空物件
8385
				if(params.data.toString()!=='[object Object]'){
8385
				if(params.data.toString()!=='[object Object]'){
8386
 
8386
 
8387
					//傳送要求
8387
					//傳送要求
8388
					xmlhttp.send(params.data);
8388
					xmlhttp.send(params.data);
8389
 
8389
 
8390
					}//if end
8390
					}//if end
8391
					
8391
 
8392
				//反之data存在資料	
8392
				//反之data存在資料
8393
				else{
8393
				else{
8394
					//傳送要求,POST為空
8394
					//傳送要求,POST為空
8395
					xmlhttp.send();
8395
					xmlhttp.send();
8396
				
8396
 
8397
					}//else end
8397
					}//else end
8398
 
8398
 
8399
				}//if end
8399
				}//if end
8400
 
8400
 
8401
			//反之是 GET 或 HEAD 或 OPTIONS
8401
			//反之是 GET 或 HEAD 或 OPTIONS
8402
			else if(params.method==='GET' || params.method==='HEAD' || params.method==='OPTIONS'){
8402
			else if(params.method==='GET' || params.method==='HEAD' || params.method==='OPTIONS'){
8403
							
8403
 
8404
				//直接傳送要求
8404
				//直接傳送要求
8405
				xmlhttp.send();
8405
				xmlhttp.send();
8406
			
8406
 
8407
				}//else end
8407
				}//else end
8408
						
8408
 
8409
			}//function window.qbpwcf.ajax end
8409
			}//function window.qbpwcf.ajax end
8410
		";
8410
		";
8411
		#js function
8411
		#js function
8412
		$conf["javaScript::toScript"]["jsFunciton"][]=
8412
		$conf["javaScript::toScript"]["jsFunciton"][]=
8413
		"
8413
		"
Line 8424... Line 8424...
8424
 
8424
 
8425
			//設置 window.qbpwcf.ajax  為空物件
8425
			//設置 window.qbpwcf.ajax  為空物件
8426
			window.qbpwcf.ajaxP={};
8426
			window.qbpwcf.ajaxP={};
8427
 
8427
 
8428
			}//if end
8428
			}//if end
8429
			
8429
 
8430
		/*
8430
		/*
8431
		設置 window.qbpwcf.ajaxP 函數
8431
		設置 window.qbpwcf.ajaxP 函數
8432
		說明:
8432
		說明:
8433
		傳送ajax,指定傳送前要做什麼事情,然後回傳一個Promise.
8433
		傳送ajax,指定傳送前要做什麼事情,然後回傳一個Promise.
8434
		await完成後的回傳結果為一物件(res).
8434
		await完成後的回傳結果為一物件(res).
Line 8446... Line 8446...
8446
		參考資料:
8446
		參考資料:
8447
		https://eyesofkids.gitbooks.io/javascript-start-es6-promise/content/contents/ch11_snippets.html
8447
		https://eyesofkids.gitbooks.io/javascript-start-es6-promise/content/contents/ch11_snippets.html
8448
		https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
8448
		https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
8449
		*/
8449
		*/
8450
		window.qbpwcf.ajaxP=function(params){
8450
		window.qbpwcf.ajaxP=function(params){
8451
		
8451
 
8452
			return new Promise(function(resolve, reject){
8452
			return new Promise(function(resolve, reject){
8453
			
8453
 
8454
				//檢查參數 params.method
8454
				//檢查參數 params.method
8455
				if(params.method===undefined){
8455
				if(params.method===undefined){
8456
					
8456
 
8457
					//初始化為 'POST'
8457
					//初始化為 'POST'
8458
					params.method='POST';
8458
					params.method='POST';
8459
				
8459
 
8460
					}//if end
8460
					}//if end
8461
					
8461
 
8462
				//檢查參數 params.url
8462
				//檢查參數 params.url
8463
				if(params.url===undefined){
8463
				if(params.url===undefined){
8464
				
8464
 
8465
					//初始化為當前頁面
8465
					//初始化為當前頁面
8466
					params.url=location.href;
8466
					params.url=location.href;
8467
				
8467
 
8468
					}//if end
8468
					}//if end
8469
			
8469
 
8470
				//檢查參數 params.preAc
8470
				//檢查參數 params.preAc
8471
				if(params.preAc===undefined){
8471
				if(params.preAc===undefined){
8472
				
8472
 
8473
					//初始化為提示傳送 ajax 前
8473
					//初始化為提示傳送 ajax 前
8474
					params.preAc=function(){
8474
					params.preAc=function(){
8475
					
8475
 
8476
						//debug
8476
						//debug
8477
						if(window.debug){
8477
						if(window.debug){
8478
					
8478
 
8479
							//提示傳送 ajax 前
8479
							//提示傳送 ajax 前
8480
							console.log('before sand request...');
8480
							console.log('before sand request...');
8481
							
8481
 
8482
							}//if end
8482
							}//if end
8483
					
8483
 
8484
						};//funcitno end
8484
						};//funcitno end
8485
				
8485
 
8486
					}//if end
8486
					}//if end
8487
				
8487
 
8488
				//檢查參數 params.data
8488
				//檢查參數 params.data
8489
				if(params.data===undefined){
8489
				if(params.data===undefined){
8490
					
8490
 
8491
					//初始化變數q
8491
					//初始化變數q
8492
					key1='q';
8492
					key1='q';
8493
					
8493
 
8494
					//初始化變數q的數值內容為'test by qbpwcf'
8494
					//初始化變數q的數值內容為'test by qbpwcf'
8495
					v1='test by qbpwcf';
8495
					v1='test by qbpwcf';
8496
					
8496
 
8497
					//初始要傳送的參數
8497
					//初始要傳送的參數
8498
					params.data=key1+'='+encodeURIComponent(v1);
8498
					params.data=key1+'='+encodeURIComponent(v1);
8499
				
8499
 
8500
					}//if end
8500
					}//if end
8501
					
8501
 
8502
				//如果支援 ajax
8502
				//如果支援 ajax
8503
				if(window.XMLHttpRequest){
8503
				if(window.XMLHttpRequest){
8504
 
8504
 
8505
					// code for IE7+, Firefox, Chrome, Opera, Safari
8505
					// code for IE7+, Firefox, Chrome, Opera, Safari
8506
					var xmlhttp=new XMLHttpRequest();
8506
					var xmlhttp=new XMLHttpRequest();
Line 8535... Line 8535...
8535
						//且response code為200
8535
						//且response code為200
8536
						if(xmlhttp.status===200){
8536
						if(xmlhttp.status===200){
8537
 
8537
 
8538
							var tmp=document.createElement('div');
8538
							var tmp=document.createElement('div');
8539
							tmp.innerHTML=xmlhttp.response;
8539
							tmp.innerHTML=xmlhttp.response;
8540
							
8540
 
8541
							//初始化記錄結果的變數
8541
							//初始化記錄結果的變數
8542
							var res={};
8542
							var res={};
8543
							
8543
 
8544
							//記錄指定解讀格式的內容
8544
							//記錄指定解讀格式的內容
8545
							res.dom=tmp;
8545
							res.dom=tmp;
8546
 
8546
 
8547
							//記錄得到的純文字內容
8547
							//記錄得到的純文字內容
8548
							res.text=xmlhttp.responseText;
8548
							res.text=xmlhttp.responseText;
8549
 
8549
 
8550
							//嘗試
8550
							//嘗試
8551
							try{
8551
							try{
8552
							
8552
 
8553
								//記錄json格式的內容
8553
								//記錄json格式的內容
8554
								res.json=JSON.parse(res.text);
8554
								res.json=JSON.parse(res.text);
8555
							
8555
 
8556
								}
8556
								}
8557
 
8557
 
8558
							//抓取例外
8558
							//抓取例外
8559
							catch(exception){
8559
							catch(exception){
8560
							
8560
 
8561
								//記錄錯誤訊息
8561
								//記錄錯誤訊息
8562
								res.json=exception;
8562
								res.json=exception;
8563
								
8563
 
8564
								}
8564
								}
8565
 
8565
 
8566
							//設置回應內容為合規的json
8566
							//設置回應內容為合規的json
8567
							res.compliantJson=true;
8567
							res.compliantJson=true;
8568
 
8568
 
8569
							//如果json的回應有name屬性
8569
							//如果json的回應有name屬性
8570
							if(res.json.hasOwnProperty('name')){
8570
							if(res.json.hasOwnProperty('name')){
8571
							
8571
 
8572
								//如果是 SyntaxError
8572
								//如果是 SyntaxError
8573
								if(res.json.name=='SyntaxError'){
8573
								if(res.json.name=='SyntaxError'){
8574
								
8574
 
8575
									//設置回應內容不為合規的json
8575
									//設置回應內容不為合規的json
8576
									res.compliantJson=false;
8576
									res.compliantJson=false;
8577
								
8577
 
8578
									}//if end
8578
									}//if end
8579
							
8579
 
8580
								}//if end
8580
								}//if end
8581
								
8581
 
8582
							//receive
8582
							//receive
8583
							resolve(res);
8583
							resolve(res);
8584
							
8584
 
8585
							}//if end
8585
							}//if end
8586
						
8586
 
8587
						//反之回傳狀態碼	
8587
						//反之回傳狀態碼
8588
						else{
8588
						else{
8589
						
8589
 
8590
							//reject
8590
							//reject
8591
							reject(xmlhttp.status);
8591
							reject(xmlhttp.status);
8592
						
8592
 
8593
							}//else end
8593
							}//else end
8594
 
8594
 
8595
						}//if end
8595
						}//if end
8596
 
8596
 
8597
					}//function end
8597
					}//function end
8598
 
8598
 
8599
				//如果是 'GET' 
8599
				//如果是 'GET'
8600
				if(params.method==='GET'){
8600
				if(params.method==='GET'){
8601
				
8601
 
8602
					//如果data不為空物件
8602
					//如果data不為空物件
8603
					if(params.data.toString()!=='[object Object]'){
8603
					if(params.data.toString()!=='[object Object]'){
8604
				
8604
 
8605
						//加上get用的'?'
8605
						//加上get用的'?'
8606
						params.url=params.url+'?'+params.data;
8606
						params.url=params.url+'?'+params.data;
8607
				
8607
 
8608
						}//if end
8608
						}//if end
8609
					
8609
 
8610
					}//if end
8610
					}//if end
8611
 
8611
 
8612
				//設定要用get傳送的數值
8612
				//設定要用get傳送的數值
8613
				xmlhttp.open(params.method,params.url,true);
8613
				xmlhttp.open(params.method,params.url,true);
8614
 
8614
 
8615
				//如果有設置 header
8615
				//如果有設置 header
8616
				if(params.headers!==undefined){
8616
				if(params.headers!==undefined){
8617
				
8617
 
8618
					//儲存迴圈的次數
8618
					//儲存迴圈的次數
8619
					var count=Object.keys(params.headers).length;
8619
					var count=Object.keys(params.headers).length;
8620
				
8620
 
8621
					//針對每個自己加的 header
8621
					//針對每個自己加的 header
8622
					for(var i=0;i<count;i++){
8622
					for(var i=0;i<count;i++){
8623
						
8623
 
8624
						//加上自定的 header
8624
						//加上自定的 header
8625
						xmlhttp.setRequestHeader(Object.keys(params.headers)[i],Object.values(params.headers)[i]);
8625
						xmlhttp.setRequestHeader(Object.keys(params.headers)[i],Object.values(params.headers)[i]);
8626
				
8626
 
8627
						}//for end
8627
						}//for end
8628
				
8628
 
8629
					}//if end
8629
					}//if end
8630
 
8630
 
8631
				//設定 header
8631
				//設定 header
8632
				xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
8632
				xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
8633
 
8633
 
8634
				//設定要求為ajax 的 header
8634
				//設定要求為ajax 的 header
8635
				xmlhttp.setRequestHeader('X-Requested-With','XMLHttpRequest');
8635
				xmlhttp.setRequestHeader('X-Requested-With','XMLHttpRequest');
8636
 
8636
 
8637
				//如果是 'POST' 
8637
				//如果是 'POST'
8638
				if(params.method==='POST'){
8638
				if(params.method==='POST'){
8639
 
8639
 
8640
					//如果data不為空物件
8640
					//如果data不為空物件
8641
					if(params.data.toString()!=='[object Object]'){
8641
					if(params.data.toString()!=='[object Object]'){
8642
 
8642
 
8643
						//傳送要求
8643
						//傳送要求
8644
						xmlhttp.send(params.data);
8644
						xmlhttp.send(params.data);
8645
 
8645
 
8646
						}//if end
8646
						}//if end
8647
						
8647
 
8648
					//反之data存在資料
8648
					//反之data存在資料
8649
					else{
8649
					else{
8650
						//傳送要求,POST為空
8650
						//傳送要求,POST為空
8651
						xmlhttp.send();
8651
						xmlhttp.send();
8652
					
8652
 
8653
						}//else end
8653
						}//else end
8654
 
8654
 
8655
					}//if end
8655
					}//if end
8656
 
8656
 
8657
				//反之是 GET 或 HEAD 或 OPTIONS
8657
				//反之是 GET 或 HEAD 或 OPTIONS
8658
				else if(params.method==='GET' || params.method==='HEAD' || params.method==='OPTIONS'){
8658
				else if(params.method==='GET' || params.method==='HEAD' || params.method==='OPTIONS'){
8659
				
8659
 
8660
					//直接傳送要求
8660
					//直接傳送要求
8661
					xmlhttp.send();
8661
					xmlhttp.send();
8662
				
8662
 
8663
					}//else end
8663
					}//else end
8664
			
8664
 
8665
				});//Promise end
8665
				});//Promise end
8666
			
8666
 
8667
			}//function window.qbpwcf.ajaxP end
8667
			}//function window.qbpwcf.ajaxP end
8668
		";
8668
		";
8669
		#js function
8669
		#js function
8670
		$conf["javaScript::toScript"]["jsFunciton"][]=
8670
		$conf["javaScript::toScript"]["jsFunciton"][]=
8671
		"
8671
		"
Line 8675... Line 8675...
8675
		window.qbpwcf.tail.url, 提供連線內容的頁面,預設為當前頁面.
8675
		window.qbpwcf.tail.url, 提供連線內容的頁面,預設為當前頁面.
8676
		window.qbpwcf.tail.continue ,true代表繼續執行;false代表暫停.
8676
		window.qbpwcf.tail.continue ,true代表繼續執行;false代表暫停.
8677
		window.qbpwcf.tail.rootDiv.id ,儲存回應的div其id,預設為'qbbpwcfTailRootDivID'.
8677
		window.qbpwcf.tail.rootDiv.id ,儲存回應的div其id,預設為'qbbpwcfTailRootDivID'.
8678
		window.qbpwcf.tail.ajax(line2start) ,啟用該功能的函式,參數line2start為要從第幾行開始讀取,-1代表從最尾端開始.
8678
		window.qbpwcf.tail.ajax(line2start) ,啟用該功能的函式,參數line2start為要從第幾行開始讀取,-1代表從最尾端開始.
8679
		*/
8679
		*/
8680
		
8680
 
8681
		//initial window.qbpwcf
8681
		//initial window.qbpwcf
8682
		if(window.qbpwcf===undefined){
8682
		if(window.qbpwcf===undefined){
8683
 
8683
 
8684
			//初始化 window.qbpwcf
8684
			//初始化 window.qbpwcf
8685
			window.qbpwcf={};
8685
			window.qbpwcf={};
8686
 
8686
 
8687
			}//if end
8687
			}//if end
8688
			
8688
 
8689
		//initial window.qbpwcf.tail
8689
		//initial window.qbpwcf.tail
8690
		if(window.qbpwcf.tail===undefined){
8690
		if(window.qbpwcf.tail===undefined){
8691
 
8691
 
8692
			//初始化 window.qbpwf.tail
8692
			//初始化 window.qbpwf.tail
8693
			window.qbpwcf.tail={};
8693
			window.qbpwcf.tail={};
8694
 
8694
 
8695
			//初始化繼續執行
8695
			//初始化繼續執行
8696
			window.qbpwcf.tail.continue=true;
8696
			window.qbpwcf.tail.continue=true;
8697
 
8697
 
8698
			}//if end
8698
			}//if end
8699
		
8699
 
8700
		//如果沒有指定要求內容的頁面
8700
		//如果沒有指定要求內容的頁面
8701
		if(window.qbpwcf.tail.url===undefined){
8701
		if(window.qbpwcf.tail.url===undefined){
8702
		
8702
 
8703
			//初始化為當前頁面
8703
			//初始化為當前頁面
8704
			window.qbpwcf.tail.url=location.href;
8704
			window.qbpwcf.tail.url=location.href;
8705
		
8705
 
8706
			}//if end
8706
			}//if end
8707
	
8707
 
8708
		//create root div
8708
		//create root div
8709
		window.qbpwcf.tail.rootDiv = document.createElement('div');
8709
		window.qbpwcf.tail.rootDiv = document.createElement('div');
8710
		
8710
 
8711
		//如果位指定div id
8711
		//如果位指定div id
8712
		if(window.qbpwcf.tail.rootDiv.id===undefined || window.qbpwcf.tail.rootDiv.id==='')
8712
		if(window.qbpwcf.tail.rootDiv.id===undefined || window.qbpwcf.tail.rootDiv.id==='')
8713
		{
8713
		{
8714
			//預設為 qbbpwcfTailRootDivID
8714
			//預設為 qbbpwcfTailRootDivID
8715
			window.qbpwcf.tail.rootDiv.id='qbpwcfTailRootDivID';
8715
			window.qbpwcf.tail.rootDiv.id='qbpwcfTailRootDivID';
8716
		
8716
 
8717
		}//if end
8717
		}//if end
8718
	
8718
 
8719
		//設置周期執行的涵式
8719
		//設置周期執行的涵式
8720
		window.qbpwcf.tail.ajax = function(line2start){
8720
		window.qbpwcf.tail.ajax = function(line2start){
8721
			
8721
 
8722
			console.log(window.qbpwcf.tail.rootDiv.id);
8722
			console.log(window.qbpwcf.tail.rootDiv.id);
8723
			
8723
 
8724
			//初始化 root div 的 selector
8724
			//初始化 root div 的 selector
8725
			var selector='div.'+window.qbpwcf.tail.rootDiv.id;
8725
			var selector='div.'+window.qbpwcf.tail.rootDiv.id;
8726
			
8726
 
8727
			//若 root div 不存在
8727
			//若 root div 不存在
8728
			if(document.querySelector(selector)===null){
8728
			if(document.querySelector(selector)===null){
8729
			
8729
 
8730
				//建立之
8730
				//建立之
8731
				document.body.appendChild(window.qbpwcf.tail.rootDiv);
8731
				document.body.appendChild(window.qbpwcf.tail.rootDiv);
8732
				
8732
 
8733
				}//if end
8733
				}//if end
8734
							
8734
 
8735
			xmlhttp=new XMLHttpRequest();
8735
			xmlhttp=new XMLHttpRequest();
8736
			//xmlhttp.responseType='json';
8736
			//xmlhttp.responseType='json';
8737
			xmlhttp.open('POST',window.qbpwcf.tail.url,true);
8737
			xmlhttp.open('POST',window.qbpwcf.tail.url,true);
8738
			xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
8738
			xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
8739
			xmlhttp.setRequestHeader('X-Requested-With','XMLHttpRequest');
8739
			xmlhttp.setRequestHeader('X-Requested-With','XMLHttpRequest');
8740
			xmlhttp.onreadystatechange=function(){
8740
			xmlhttp.onreadystatechange=function(){
8741
 
8741
 
8742
				//如果狀態為4且response code為200
8742
				//如果狀態為4且response code為200
8743
				if(xmlhttp.readyState===4 && xmlhttp.status===200){
8743
				if(xmlhttp.readyState===4 && xmlhttp.status===200){
8744
 
8744
 
8745
					//get response					
8745
					//get response
8746
					res=xmlhttp.response;
8746
					res=xmlhttp.response;
8747
					
8747
 
8748
					//try parse res to json
8748
					//try parse res to json
8749
					//參考資料
8749
					//參考資料
8750
					//https://stackoverflow.com/questions/4467044/proper-way-to-catch-exception-from-json-parse
8750
					//https://stackoverflow.com/questions/4467044/proper-way-to-catch-exception-from-json-parse
8751
					try{
8751
					try{
8752
						json=JSON.parse(res);	
8752
						json=JSON.parse(res);
8753
					 	}
8753
					 	}
8754
					catch(e){
8754
					catch(e){
8755
						//console.log(e);
8755
						//console.log(e);
8756
					 	}
8756
					 	}
8757
						
8757
 
8758
					console.log(json);	
8758
					console.log(json);
8759
											
8759
 
8760
					//如果json不存在
8760
					//如果json不存在
8761
					if(json===undefined || json===null){
8761
					if(json===undefined || json===null){
8762
					
8762
 
8763
						//取得文字結果
8763
						//取得文字結果
8764
						res=xmlhttp.responseText
8764
						res=xmlhttp.responseText
8765
					
8765
 
8766
						//如果輸出有逗號.
8766
						//如果輸出有逗號.
8767
						if(res.includes(',')){
8767
						if(res.includes(',')){
8768
							
8768
 
8769
							//用逗號分割回應
8769
							//用逗號分割回應
8770
							res=res.split(',');
8770
							res=res.split(',');
8771
							
8771
 
8772
							//取得回應的陣列長度
8772
							//取得回應的陣列長度
8773
							rLength=res.length;
8773
							rLength=res.length;
8774
							
8774
 
8775
							}//if end
8775
							}//if end
8776
					
8776
 
8777
						//儲存最新的行內容
8777
						//儲存最新的行內容
8778
						window.qbpwcf.tail.latsLineContent=null;
8778
						window.qbpwcf.tail.latsLineContent=null;
8779
					
8779
 
8780
						//針對每個回應
8780
						//針對每個回應
8781
						for(i=0;i<rLength-1;i++){
8781
						for(i=0;i<rLength-1;i++){
8782
							
8782
 
8783
							//解密內容					
8783
							//解密內容
8784
							res[i]=JSON.parse(decodeURIComponent(atob(res[i])).replaceAll('+',' '));
8784
							res[i]=JSON.parse(decodeURIComponent(atob(res[i])).replaceAll('+',' '));
8785
							
8785
 
8786
							//取得讀取到的行數.
8786
							//取得讀取到的行數.
8787
							window.qbpwcf.tail.lineNum=res[i].lineNum;			
8787
							window.qbpwcf.tail.lineNum=res[i].lineNum;
8788
																		
-
 
-
 
8788
 
8789
							//針對每行輸出
8789
							//針對每行輸出
8790
							for(var j=0;j<res[i].lines;j++){
8790
							for(var j=0;j<res[i].lines;j++){
8791
									
8791
 
8792
								//如果內容跟上一行相同.
8792
								//如果內容跟上一行相同.
8793
								if(window.qbpwcf.tail.latsLineContent===res[i].content[j]){
8793
								if(window.qbpwcf.tail.latsLineContent===res[i].content[j]){
8794
									
8794
 
8795
									//跳過
8795
									//跳過
8796
									continue;
8796
									continue;
8797
									
8797
 
8798
									}//if end	
8798
									}//if end
8799
									
8799
 
8800
								//反之
8800
								//反之
8801
								else{
8801
								else{
8802
								
8802
 
8803
									//更新最新一列的內容
8803
									//更新最新一列的內容
8804
									window.qbpwcf.tail.latsLineContent=res[i].content[j];
8804
									window.qbpwcf.tail.latsLineContent=res[i].content[j];
8805
									
8805
 
8806
									}//else end
8806
									}//else end
8807
									
8807
 
8808
								//set output line
8808
								//set output line
8809
								var div=document.createElement('div');
8809
								var div=document.createElement('div');
8810
								var text=document.createTextNode(res[i].content[j]);
8810
								var text=document.createTextNode(res[i].content[j]);
8811
								div.appendChild(text);
8811
								div.appendChild(text);
8812
													
8812
 
8813
								//如果內容為空
8813
								//如果內容為空
8814
								if(res[i].content[j]==='')
8814
								if(res[i].content[j]==='')
8815
								{
8815
								{
8816
									//建立<br>
8816
									//建立<br>
8817
									var br=document.createElement('br');
8817
									var br=document.createElement('br');
8818
									
8818
 
8819
									//遷入<br>
8819
									//遷入<br>
8820
									div.appendChild(br);
8820
									div.appendChild(br);
8821
								}
8821
								}
8822
								
8822
 
8823
								//show output line
8823
								//show output line
8824
								var rootDiv=document.getElementById(window.qbpwcf.tail.rootDiv.id);
8824
								var rootDiv=document.getElementById(window.qbpwcf.tail.rootDiv.id);
8825
								rootDiv.prepend(div);
8825
								rootDiv.prepend(div);
8826
							
8826
 
8827
								}//for end
8827
								}//for end
8828
						
8828
 
8829
							}//for end
8829
							}//for end
8830
					
8830
 
8831
						}//if end
8831
						}//if end
8832
					
8832
 
8833
					//反之有pasrer出json
8833
					//反之有pasrer出json
8834
					else{
8834
					else{
8835
					
8835
 
8836
						//取得json
8836
						//取得json
8837
						res=json;
8837
						res=json;
8838
					
8838
 
8839
						//取得真實內容
8839
						//取得真實內容
8840
						res=res.content;
8840
						res=res.content;
8841
						
8841
 
8842
						//取得回應的陣列長度
8842
						//取得回應的陣列長度
8843
						rLength=res.length;
8843
						rLength=res.length;
8844
		
8844
 
8845
						//針對每筆輸出
8845
						//針對每筆輸出
8846
						for(var i=0;i<rLength;i++){
8846
						for(var i=0;i<rLength;i++){
8847
						
8847
 
8848
							//針對每行輸出
8848
							//針對每行輸出
8849
							for(var j=0;j<rLength;j++){
8849
							for(var j=0;j<rLength;j++){
8850
							
8850
 
8851
								//set output line
8851
								//set output line
8852
								var div=document.createElement('div');
8852
								var div=document.createElement('div');
8853
								var text=document.createTextNode(res[j]);
8853
								var text=document.createTextNode(res[j]);
8854
								div.appendChild(text);
8854
								div.appendChild(text);
8855
						
8855
 
8856
								//如果內容為空
8856
								//如果內容為空
8857
								if(res[j]==='')
8857
								if(res[j]==='')
8858
								{
8858
								{
8859
									//建立<br>
8859
									//建立<br>
8860
									var br=document.createElement('br');
8860
									var br=document.createElement('br');
8861
									
8861
 
8862
									//遷入<br>
8862
									//遷入<br>
8863
									div.appendChild(br);
8863
									div.appendChild(br);
8864
								}
8864
								}
8865
								
8865
 
8866
								//show output line
8866
								//show output line
8867
								var rootDiv=document.getElementById(window.qbpwcf.tail.rootDiv.id);
8867
								var rootDiv=document.getElementById(window.qbpwcf.tail.rootDiv.id);
8868
								rootDiv.prepend(div);
8868
								rootDiv.prepend(div);
8869
							
8869
 
8870
								}//for end
8870
								}//for end
8871
																			
-
 
-
 
8871
 
8872
							}//for end
8872
							}//for end
8873
							
8873
 
8874
						}//else end
8874
						}//else end
8875
	
8875
 
8876
					//if json !=null
8876
					//if json !=null
8877
					if(json!=null){
8877
					if(json!=null){
8878
	
8878
 
8879
						console.log(json.lineNum);
8879
						console.log(json.lineNum);
8880
							
8880
 
8881
						//遞迴
8881
						//遞迴
8882
						window.qbpwcf.tail.ajax.call(this,json.lineNum+1);
8882
						window.qbpwcf.tail.ajax.call(this,json.lineNum+1);
8883
 
8883
 
8884
						//清空變數
8884
						//清空變數
8885
						json=null;
8885
						json=null;
8886
						
8886
 
8887
						}//if end
8887
						}//if end
8888
						
8888
 
8889
					else{
8889
					else{
8890
						
8890
 
8891
						//如果當前行數不等於空
8891
						//如果當前行數不等於空
8892
						if(window.qbpwcf.tail.lineNum!==undefined && window.qbpwcf.tail.lineNum!==null){
8892
						if(window.qbpwcf.tail.lineNum!==undefined && window.qbpwcf.tail.lineNum!==null){
8893
						
8893
 
8894
							//遞迴
8894
							//遞迴
8895
							window.qbpwcf.tail.ajax.call(this,window.qbpwcf.tail.lineNum);
8895
							window.qbpwcf.tail.ajax.call(this,window.qbpwcf.tail.lineNum);
8896
							
8896
 
8897
							}//if end
8897
							}//if end
8898
					
8898
 
8899
						else{
8899
						else{
8900
					
8900
 
8901
							//遞迴
8901
							//遞迴
8902
							window.qbpwcf.tail.ajax.call(this,-1);
8902
							window.qbpwcf.tail.ajax.call(this,-1);
8903
					
8903
 
8904
							}//else end
8904
							}//else end
8905
					
8905
 
8906
						}//else end
8906
						}//else end
8907
 
8907
 
8908
					}//if end
8908
					}//if end
8909
 
8909
 
8910
				}//function end
8910
				}//function end
8911
			
8911
 
8912
			//如果要繼續	
8912
			//如果要繼續
8913
			if(window.qbpwcf.tail.continue){
8913
			if(window.qbpwcf.tail.continue){
8914
 
8914
 
8915
				//繼續
8915
				//繼續
8916
				xmlhttp.send('line2start='+line2start);
8916
				xmlhttp.send('line2start='+line2start);
8917
 
8917
 
8918
				}//if end
8918
				}//if end
8919
				
8919
 
8920
			//反之要暫停
8920
			//反之要暫停
8921
			else{
8921
			else{
8922
			
8922
 
8923
				//設置無限等待
8923
				//設置無限等待
8924
				var intervalTail = window.setInterval(function(){
8924
				var intervalTail = window.setInterval(function(){
8925
				
8925
 
8926
					//提示已經暫停
8926
					//提示已經暫停
8927
					console.log('paused');
8927
					console.log('paused');
8928
					
8928
 
8929
					//如果要繼續了
8929
					//如果要繼續了
8930
					if(window.qbpwcf.tail.continue){
8930
					if(window.qbpwcf.tail.continue){
8931
					
8931
 
8932
						//清除無限等待
8932
						//清除無限等待
8933
						clearInterval(intervalTail);
8933
						clearInterval(intervalTail);
8934
											
8934
 
8935
						//繼續
8935
						//繼續
8936
						xmlhttp.send('line2start='+line2start);
8936
						xmlhttp.send('line2start='+line2start);
8937
						
8937
 
8938
						}//if end
8938
						}//if end
8939
				
8939
 
8940
					},1000);
8940
					},1000);
8941
			
8941
 
8942
				}//else end
8942
				}//else end
8943
 
8943
 
8944
			}//function end
8944
			}//function end
8945
		";
8945
		";
8946
		#js function
8946
		#js function
Line 8951... Line 8951...
8951
 
8951
 
8952
			//初始化 window.qbpwcf
8952
			//初始化 window.qbpwcf
8953
			window.qbpwcf={};
8953
			window.qbpwcf={};
8954
 
8954
 
8955
			}//if end
8955
			}//if end
8956
			
8956
 
8957
		//initial window.qbpwcf.screenShare
8957
		//initial window.qbpwcf.screenShare
8958
		if(window.qbpwcf.screenShare===undefined){
8958
		if(window.qbpwcf.screenShare===undefined){
8959
 
8959
 
8960
			//初始化 window.qbpwcf.screenShare
8960
			//初始化 window.qbpwcf.screenShare
8961
			window.qbpwcf.screenShare={};
8961
			window.qbpwcf.screenShare={};
8962
 
8962
 
8963
			}//if end
8963
			}//if end
8964
		
8964
 
8965
		/*
8965
		/*
8966
		函式說明:
8966
		函式說明:
8967
		分享螢幕畫面.
8967
		分享螢幕畫面.
8968
		參數說明:
8968
		參數說明:
8969
		parmas={};
8969
		parmas={};
Line 8981... Line 8981...
8981
		https://developer.mozilla.org/zh-TW/docs/Web/API/Blob
8981
		https://developer.mozilla.org/zh-TW/docs/Web/API/Blob
8982
		#備註:
8982
		#備註:
8983
		#錄製好的畫面無法在別的畫面播放.
8983
		#錄製好的畫面無法在別的畫面播放.
8984
		*/
8984
		*/
8985
		window.qbpwcf.screenShare.init=function(params){
8985
		window.qbpwcf.screenShare.init=function(params){
8986
		
8986
 
8987
			//初始化參數
8987
			//初始化參數
8988
			if(params.startEle===undefined){
8988
			if(params.startEle===undefined){
8989
			
8989
 
8990
				params.startEle='';
8990
				params.startEle='';
8991
			
8991
 
8992
				}//if end
8992
				}//if end
8993
			
8993
 
8994
			//初始化參數
8994
			//初始化參數
8995
			if(params.displayOptions===undefined){
8995
			if(params.displayOptions===undefined){
8996
			
8996
 
8997
				//參數
8997
				//參數
8998
				params.displayOptions={
8998
				params.displayOptions={
8999
  					video: {
8999
  					video: {
9000
    						cursor: 'always',
9000
    						cursor: 'always',
9001
  						},
9001
  						},
Line 9003... Line 9003...
9003
  						echoCancellation: true,
9003
  						echoCancellation: true,
9004
    						noiseSuppression: true,
9004
    						noiseSuppression: true,
9005
    						sampleRate: 44100,
9005
    						sampleRate: 44100,
9006
						},
9006
						},
9007
					};
9007
					};
9008
				
9008
 
9009
				}// if end
9009
				}// if end
9010
				 
9010
 
9011
			//全域化 displayOptions
9011
			//全域化 displayOptions
9012
			window.qbpwcf.screenShare.displayOptions=params.displayOptions;
9012
			window.qbpwcf.screenShare.displayOptions=params.displayOptions;
9013
						
9013
 
9014
			//如果無指定點擊後開始分享畫面的元素
9014
			//如果無指定點擊後開始分享畫面的元素
9015
			if(params.startEle==='')
9015
			if(params.startEle==='')
9016
			{
9016
			{
9017
				//移除既有的分享畫面div
9017
				//移除既有的分享畫面div
9018
				screenShareBtn=document.getElementById('window.qbpwcf.screenShare.startId');
9018
				screenShareBtn=document.getElementById('window.qbpwcf.screenShare.startId');
9019
			
9019
 
9020
				//如果有該按鈕
9020
				//如果有該按鈕
9021
				if(screenShareBtn!==null)
9021
				if(screenShareBtn!==null)
9022
				{
9022
				{
9023
					//移除之
9023
					//移除之
9024
					screenShareBtn.remove();
9024
					screenShareBtn.remove();
9025
				}
9025
				}
9026
			
9026
 
9027
				//建立 div 物件
9027
				//建立 div 物件
9028
				div=document.createElement('div');
9028
				div=document.createElement('div');
9029
				
9029
 
9030
				//綁定點擊事件
9030
				//綁定點擊事件
9031
				div.addEventListener('click',function()
9031
				div.addEventListener('click',function()
9032
				{
9032
				{
9033
					window.qbpwcf.screenShare.startCapture();
9033
					window.qbpwcf.screenShare.startCapture();
9034
				});
9034
				});
9035
				
9035
 
9036
				//設置固位置的 css 樣式
9036
				//設置固位置的 css 樣式
9037
				div.style.position='fixed';
9037
				div.style.position='fixed';
9038
				div.style.bottom='10px';
9038
				div.style.bottom='10px';
9039
				div.style.right='10px';
9039
				div.style.right='10px';
9040
				
9040
 
9041
				//設置背景顏色為藍色
9041
				//設置背景顏色為藍色
9042
				div.style.backgroundColor='#AAAAFF';
9042
				div.style.backgroundColor='#AAAAFF';
9043
				
9043
 
9044
				//設置滑鼠指標過去為 pointer
9044
				//設置滑鼠指標過去為 pointer
9045
				div.style.cursor='pointer';
9045
				div.style.cursor='pointer';
9046
				
9046
 
9047
				//設置 div 的 id
9047
				//設置 div 的 id
9048
				div.id='window.qbpwcf.screenShare.startId';
9048
				div.id='window.qbpwcf.screenShare.startId';
9049
				
9049
 
9050
				//給予提文字
9050
				//給予提文字
9051
				div.innerText='按我開始分享畫面';
9051
				div.innerText='按我開始分享畫面';
9052
				
9052
 
9053
				//取得預設的開始錄影參數;
9053
				//取得預設的開始錄影參數;
9054
				params.startEle=div;	
9054
				params.startEle=div;
9055
				
9055
 
9056
				//放置 div
9056
				//放置 div
9057
				document.body.appendChild(div);						
9057
				document.body.appendChild(div);
9058
			
9058
 
9059
			}//if end
9059
			}//if end
9060
			
9060
 
9061
			//反之
9061
			//反之
9062
			else
9062
			else
9063
			{
9063
			{
9064
				//設置點擊就開始分享畫面的事件
9064
				//設置點擊就開始分享畫面的事件
9065
				params.startEle.addEventListener('click',function()
9065
				params.startEle.addEventListener('click',function()
9066
				{
9066
				{
9067
					window.qbpwcf.screenShare.startCapture();
9067
					window.qbpwcf.screenShare.startCapture();
9068
				});
9068
				});
9069
			
9069
 
9070
			}//else end
9070
			}//else end
9071
			
9071
 
9072
			//建立 video div 物件
9072
			//建立 video div 物件
9073
			window.qbpwcf.screenShare.videoElem=document.createElement('video');
9073
			window.qbpwcf.screenShare.videoElem=document.createElement('video');
9074
			window.qbpwcf.screenShare.videoElem.autoplay=true;
9074
			window.qbpwcf.screenShare.videoElem.autoplay=true;
9075
			window.qbpwcf.screenShare.videoElem.style.width='100vw';
9075
			window.qbpwcf.screenShare.videoElem.style.width='100vw';
9076
			window.qbpwcf.screenShare.videoElem.style.height='100vh';
9076
			window.qbpwcf.screenShare.videoElem.style.height='100vh';
9077
			window.qbpwcf.screenShare.videoElem.style.border='solid 1px silver';
9077
			window.qbpwcf.screenShare.videoElem.style.border='solid 1px silver';
9078
			window.qbpwcf.screenShare.videoElem.id='video';
9078
			window.qbpwcf.screenShare.videoElem.id='video';
9079
			
9079
 
9080
			//放置 video div
9080
			//放置 video div
9081
			document.body.appendChild(window.qbpwcf.screenShare.videoElem);
9081
			document.body.appendChild(window.qbpwcf.screenShare.videoElem);
9082
								
9082
 
9083
			}//function window.qbpwcf.screenShare.init end
9083
			}//function window.qbpwcf.screenShare.init end
9084
			
9084
 
9085
		//開始截取畫面
9085
		//開始截取畫面
9086
		window.qbpwcf.screenShare.startCapture = async function(){
9086
		window.qbpwcf.screenShare.startCapture = async function(){
9087
		
9087
 
9088
			//try start
9088
			//try start
9089
			try{
9089
			try{
9090
				//顯示畫面
9090
				//顯示畫面
9091
				window.qbpwcf.screenShare.videoElem.srcObject = await navigator.mediaDevices.getDisplayMedia(window.qbpwcf.screenShare.displayOptions);
9091
				window.qbpwcf.screenShare.videoElem.srcObject = await navigator.mediaDevices.getDisplayMedia(window.qbpwcf.screenShare.displayOptions);
9092
				window.qbpwcf.screenShare.dumpOptionsInfo();
9092
				window.qbpwcf.screenShare.dumpOptionsInfo();
9093
				
9093
 
9094
				//設定錄製畫面的設定
9094
				//設定錄製畫面的設定
9095
				var options = { mimeType: 'video/webm; codecs=vp8' };
9095
				var options = { mimeType: 'video/webm; codecs=vp8' };
9096
				window.qbpwcf.screenShare.mediaRecorder = new MediaRecorder(window.qbpwcf.screenShare.videoElem.srcObject, options);
9096
				window.qbpwcf.screenShare.mediaRecorder = new MediaRecorder(window.qbpwcf.screenShare.videoElem.srcObject, options);
9097
				
9097
 
9098
				//初始化儲存錄影的片段
9098
				//初始化儲存錄影的片段
9099
				window.qbpwcf.screenShare.recordedChunks=[];
9099
				window.qbpwcf.screenShare.recordedChunks=[];
9100
				
9100
 
9101
				//當有資料可以錄製時
9101
				//當有資料可以錄製時
9102
				window.qbpwcf.screenShare.mediaRecorder.ondataavailable=window.qbpwcf.screenShare.handleDataAvailable;
9102
				window.qbpwcf.screenShare.mediaRecorder.ondataavailable=window.qbpwcf.screenShare.handleDataAvailable;
9103
				
9103
 
9104
				//開始錄製
9104
				//開始錄製
9105
				window.qbpwcf.screenShare.mediaRecorder.start();
9105
				window.qbpwcf.screenShare.mediaRecorder.start();
9106
				
9106
 
9107
				//設置每1秒就要求一次錄取的資料
9107
				//設置每1秒就要求一次錄取的資料
9108
				window.qbpwcf.screenShare.interval = setInterval(function(){
9108
				window.qbpwcf.screenShare.interval = setInterval(function(){
9109
				
9109
 
9110
					//debug
9110
					//debug
9111
					if(window.debug){
9111
					if(window.debug){
9112
					
9112
 
9113
						console.log(window.qbpwcf.screenShare.mediaRecorder);
9113
						console.log(window.qbpwcf.screenShare.mediaRecorder);
9114
					
9114
 
9115
						}//if end
9115
						}//if end
9116
					
9116
 
9117
					//如果停止錄影了
9117
					//如果停止錄影了
9118
					if(window.qbpwcf.screenShare.mediaRecorder.state==='inactive'){
9118
					if(window.qbpwcf.screenShare.mediaRecorder.state==='inactive'){
9119
					
9119
 
9120
						//結束循環要求錄取的資料
9120
						//結束循環要求錄取的資料
9121
						clearInterval(window.qbpwcf.screenShare.interval);
9121
						clearInterval(window.qbpwcf.screenShare.interval);
9122
					
9122
 
9123
						}//if end
9123
						}//if end
9124
									
9124
 
9125
					//手動要求目前錄製
9125
					//手動要求目前錄製
9126
					window.qbpwcf.screenShare.mediaRecorder.requestData();
9126
					window.qbpwcf.screenShare.mediaRecorder.requestData();
9127
										
9127
 
9128
					//如果要繼續了
9128
					//如果要繼續了
9129
					if(window.qbpwcf.screenShare.continue){
9129
					if(window.qbpwcf.screenShare.continue){
9130
					
9130
 
9131
						//清除無限等待
9131
						//清除無限等待
9132
						clearInterval(window.qbpwcf.screenShare.interval);
9132
						clearInterval(window.qbpwcf.screenShare.interval);
9133
						
9133
 
9134
						}//if end
9134
						}//if end
9135
				
9135
 
9136
					},1000);
9136
					},1000);
9137
					
9137
 
9138
				} //try end
9138
				} //try end
9139
				
9139
 
9140
			//catch error
9140
			//catch error
9141
			catch(err){
9141
			catch(err){
9142
				
9142
 
9143
				//debug
9143
				//debug
9144
				console.error(err);
9144
				console.error(err);
9145
	 			
9145
 
9146
	 			}//catch end
9146
	 			}//catch end
9147
	 			
9147
 
9148
			}//function end
9148
			}//function end
9149
			
9149
 
9150
		//結束截取畫面跟音訊
9150
		//結束截取畫面跟音訊
9151
		window.qbpwcf.screenShare.stopCapture = function(){
9151
		window.qbpwcf.screenShare.stopCapture = function(){
9152
		
9152
 
9153
			let tracks = window.qbpwcf.screenShare.videoElem.srcObject.getTracks();
9153
			let tracks = window.qbpwcf.screenShare.videoElem.srcObject.getTracks();
9154
 
9154
 
9155
			tracks.forEach(track => track.stop());
9155
			tracks.forEach(track => track.stop());
9156
			  
9156
 
9157
			videoElem.srcObject = null;
9157
			videoElem.srcObject = null;
9158
		
9158
 
9159
			}//funciton end
9159
			}//funciton end
9160
			
9160
 
9161
		//輸出當前錄影的各項資訊
9161
		//輸出當前錄影的各項資訊
9162
		window.qbpwcf.screenShare.dumpOptionsInfo = function(){
9162
		window.qbpwcf.screenShare.dumpOptionsInfo = function(){
9163
		
9163
 
9164
			//debug
9164
			//debug
9165
			if(window.debug){
9165
			if(window.debug){
9166
			
9166
 
9167
				//debug
9167
				//debug
9168
				console.log(window.qbpwcf.screenShare.videoElem.srcObject);
9168
				console.log(window.qbpwcf.screenShare.videoElem.srcObject);
9169
			
9169
 
9170
				}//if end
9170
				}//if end
9171
		
9171
 
9172
			const videoTrack = window.qbpwcf.screenShare.videoElem.srcObject.getVideoTracks()[0];
9172
			const videoTrack = window.qbpwcf.screenShare.videoElem.srcObject.getVideoTracks()[0];
9173
 
9173
 
9174
			//debug
9174
			//debug
9175
			if(window.debug){
9175
			if(window.debug){
9176
 
9176
 
9177
 				console.log('Track settings:');
9177
 				console.log('Track settings:');
9178
  				console.log(JSON.stringify(videoTrack.getSettings(), null, 2));
9178
  				console.log(JSON.stringify(videoTrack.getSettings(), null, 2));
9179
  				console.log('Track constraints:');
9179
  				console.log('Track constraints:');
9180
  				console.log(JSON.stringify(videoTrack.getConstraints(), null, 2));
9180
  				console.log(JSON.stringify(videoTrack.getConstraints(), null, 2));
9181
		
9181
 
9182
				}//if end
9182
				}//if end
9183
		
9183
 
9184
			}//function end
9184
			}//function end
9185
			
9185
 
9186
		//ondataavailable event 要執行的函式
9186
		//ondataavailable event 要執行的函式
9187
		window.qbpwcf.screenShare.handleDataAvailable = function(e){
9187
		window.qbpwcf.screenShare.handleDataAvailable = function(e){
9188
		
9188
 
9189
			//debug
9189
			//debug
9190
			if(window.debug){
9190
			if(window.debug){
9191
		
9191
 
9192
				console.log('data-available');
9192
				console.log('data-available');
9193
				
9193
 
9194
				}//if end
9194
				}//if end
9195
									
9195
 
9196
			//如果有資料
9196
			//如果有資料
9197
			if (e.data.size > 0){
9197
			if (e.data.size > 0){
9198
			
9198
 
9199
				//記錄資料
9199
				//記錄資料
9200
				window.qbpwcf.screenShare.recordedChunks.push(e.data);
9200
				window.qbpwcf.screenShare.recordedChunks.push(e.data);
9201
				
9201
 
9202
				//debug
9202
				//debug
9203
				if(window.debug){
9203
				if(window.debug){
9204
				
9204
 
9205
					console.log(window.qbpwcf.screenShare.recordedChunks);
9205
					console.log(window.qbpwcf.screenShare.recordedChunks);
9206
				
9206
 
9207
					}//if end
9207
					}//if end
9208
				
9208
 
9209
				//取得最舊的資料
9209
				//取得最舊的資料
9210
				blob=window.qbpwcf.screenShare.recordedChunks.shift();
9210
				blob=window.qbpwcf.screenShare.recordedChunks.shift();
9211
					
9211
 
9212
				//debug
9212
				//debug
9213
				if(window.debug){	
9213
				if(window.debug){
9214
					
9214
 
9215
					//blob.type='video/webm; codecs=vp8'
9215
					//blob.type='video/webm; codecs=vp8'
9216
					console.log(blob);	
9216
					console.log(blob);
9217
						
9217
 
9218
					}//if end
9218
					}//if end
9219
															
9219
 
9220
				//建立 reader 物件
9220
				//建立 reader 物件
9221
				reader = new FileReader();
9221
				reader = new FileReader();
9222
				
9222
 
9223
				//如果開啟完畢
9223
				//如果開啟完畢
9224
				reader.addEventListener('loadend',function(e){
9224
				reader.addEventListener('loadend',function(e){
9225
				
9225
 
9226
					//debug
9226
					//debug
9227
					if(window.debug){
9227
					if(window.debug){
9228
				
9228
 
9229
						console.log(e);
9229
						console.log(e);
9230
					
9230
 
9231
						}//if end
9231
						}//if end
9232
												
9232
 
9233
					//取得 arrayBUffer
9233
					//取得 arrayBUffer
9234
					buf=e.originalTarget.result;
9234
					buf=e.originalTarget.result;
9235
				
9235
 
9236
					//debug
9236
					//debug
9237
					if(window.debug){
9237
					if(window.debug){
9238
				
9238
 
9239
						console.log(buf);
9239
						console.log(buf);
9240
						
9240
 
9241
						}//if end
9241
						}//if end
9242
				
9242
 
9243
					//用8位數2進位來表示
9243
					//用8位數2進位來表示
9244
					intArray = new Int8Array(buf);
9244
					intArray = new Int8Array(buf);
9245
										
9245
 
9246
					//儲存成json字串
9246
					//儲存成json字串
9247
					json = JSON.stringify(intArray);
9247
					json = JSON.stringify(intArray);
9248
				
9248
 
9249
					//初始化要傳遞的變數物件內容
9249
					//初始化要傳遞的變數物件內容
9250
					toDb={};
9250
					toDb={};
9251
					toDb.dbAddr='localhost';
9251
					toDb.dbAddr='localhost';
9252
					toDb.dbName='qbpwcf';
9252
					toDb.dbName='qbpwcf';
9253
					toDb.dbUser='root';
9253
					toDb.dbUser='root';
9254
					toDb.dbPass='dolbyhometheater';
9254
					toDb.dbPass='dolbyhometheater';
9255
					toDb.dtName='int8array';
9255
					toDb.dtName='int8array';
9256
					toDb.cols=['json'];
9256
					toDb.cols=['json'];
9257
					toDb.vals=[json];
9257
					toDb.vals=[json];
9258
					
9258
 
9259
					//加密要傳輸的變數
9259
					//加密要傳輸的變數
9260
					toDb=btoa(encodeURIComponent(JSON.stringify(toDb)));
9260
					toDb=btoa(encodeURIComponent(JSON.stringify(toDb)));
9261
				
9261
 
9262
					//儲存到資料庫
9262
					//儲存到資料庫
9263
					params={};
9263
					params={};
9264
					params.method='POST';
9264
					params.method='POST';
9265
					params.url='/qbpwcf/db/toDb.php';
9265
					params.url='/qbpwcf/db/toDb.php';
9266
					params.resType='json';
9266
					params.resType='json';
9267
					//params.preAc='function name to call before send request';
9267
					//params.preAc='function name to call before send request';
9268
					//params.aftAc='function name to call after send request';
9268
					//params.aftAc='function name to call after send request';
9269
					params.data='params='+toDb;
9269
					params.data='params='+toDb;
9270
					window.qbpwcf.ajax(params);
9270
					window.qbpwcf.ajax(params);
9271
										
9271
 
9272
					});//funciton  end
9272
					});//funciton  end
9273
									
9273
 
9274
				//讀取 blob 成 arrayBuffer
9274
				//讀取 blob 成 arrayBuffer
9275
				reader.readAsArrayBuffer(blob);
9275
				reader.readAsArrayBuffer(blob);
9276
													
9276
 
9277
				}//if end
9277
				}//if end
9278
						
9278
 
9279
			}//function end
9279
			}//function end
9280
			
9280
 
9281
		//用戶觀賞分享的畫面	
9281
		//用戶觀賞分享的畫面
9282
		window.qbpwcf.screenShare.client=function(){
9282
		window.qbpwcf.screenShare.client=function(){
9283
		
9283
 
9284
			//建立 videoR div 物件
9284
			//建立 videoR div 物件
9285
			window.qbpwcf.screenShare.videoR=document.createElement('video');
9285
			window.qbpwcf.screenShare.videoR=document.createElement('video');
9286
			window.qbpwcf.screenShare.videoR.autoplay=true;
9286
			window.qbpwcf.screenShare.videoR.autoplay=true;
9287
			window.qbpwcf.screenShare.videoR.style.width='100vw';
9287
			window.qbpwcf.screenShare.videoR.style.width='100vw';
9288
			window.qbpwcf.screenShare.videoR.style.height='100vh';
9288
			window.qbpwcf.screenShare.videoR.style.height='100vh';
9289
			window.qbpwcf.screenShare.videoR.style.border='solid 1px silver';
9289
			window.qbpwcf.screenShare.videoR.style.border='solid 1px silver';
9290
			window.qbpwcf.screenShare.videoR.id='videoR';
9290
			window.qbpwcf.screenShare.videoR.id='videoR';
9291
			
9291
 
9292
			//放置 videoR div
9292
			//放置 videoR div
9293
			document.body.appendChild(window.qbpwcf.screenShare.videoR);
9293
			document.body.appendChild(window.qbpwcf.screenShare.videoR);
9294
			
9294
 
9295
			//建立 media source 物件
9295
			//建立 media source 物件
9296
			window.qbpwcf.screenShare.mediaSourceForR = new MediaSource();	
9296
			window.qbpwcf.screenShare.mediaSourceForR = new MediaSource();
9297
			
9297
 
9298
			//設置 video tag 的內容來源		
9298
			//設置 video tag 的內容來源
9299
			//window.qbpwcf.screenShare.videoR.src=URL.createObjectURL(window.qbpwcf.screenShare.mediaSourceForR); //old method
9299
			//window.qbpwcf.screenShare.videoR.src=URL.createObjectURL(window.qbpwcf.screenShare.mediaSourceForR); //old method
9300
			window.qbpwcf.screenShare.videoR.srcObject=window.qbpwcf.screenShare.mediaSourceForR; //new method
9300
			window.qbpwcf.screenShare.videoR.srcObject=window.qbpwcf.screenShare.mediaSourceForR; //new method
9301
			
9301
 
9302
			//初始化用戶取得的最新視訊片段id
9302
			//初始化用戶取得的最新視訊片段id
9303
			window.qbpwcf.screenShare.clientDataId=0;
9303
			window.qbpwcf.screenShare.clientDataId=0;
9304
			
9304
 
9305
			//建立當打開媒體來源時
9305
			//建立當打開媒體來源時
9306
			window.qbpwcf.screenShare.mediaSourceForR.addEventListener('sourceopen',window.qbpwcf.screenShare.clientRecursive);
9306
			window.qbpwcf.screenShare.mediaSourceForR.addEventListener('sourceopen',window.qbpwcf.screenShare.clientRecursive);
9307
			
9307
 
9308
			}//functino end
9308
			}//functino end
9309
		
9309
 
9310
		//用戶觀賞分享的畫面用的遞回函式
9310
		//用戶觀賞分享的畫面用的遞回函式
9311
		window.qbpwcf.screenShare.clientRecursive=function(event){
9311
		window.qbpwcf.screenShare.clientRecursive=function(event){
9312
		
9312
 
9313
			//debug
9313
			//debug
9314
			if(window.debug){
9314
			if(window.debug){
9315
		
9315
 
9316
				console.log(event);
9316
				console.log(event);
9317
				
9317
 
9318
				}//if end
9318
				}//if end
9319
		
9319
 
9320
			//如果尚無資料
9320
			//如果尚無資料
9321
			if(window.qbpwcf.screenShare.clientDataId===0){
9321
			if(window.qbpwcf.screenShare.clientDataId===0){
9322
		
9322
 
9323
				//設置輸出的編碼			
9323
				//設置輸出的編碼
9324
				window.qbpwcf.screenShare.sourceBuffer = window.qbpwcf.screenShare.mediaSourceForR.addSourceBuffer('video/webm; codecs=vp8');
9324
				window.qbpwcf.screenShare.sourceBuffer = window.qbpwcf.screenShare.mediaSourceForR.addSourceBuffer('video/webm; codecs=vp8');
9325
		
9325
 
9326
				}//if end
9326
				}//if end
9327
		
9327
 
9328
			//初始化要傳遞的變數物件內容
9328
			//初始化要傳遞的變數物件內容
9329
			toDb={};
9329
			toDb={};
9330
			toDb.dbAddr='localhost';
9330
			toDb.dbAddr='localhost';
9331
			toDb.dbName='qbpwcf';
9331
			toDb.dbName='qbpwcf';
9332
			toDb.dbUser='root';
9332
			toDb.dbUser='root';
Line 9337... Line 9337...
9337
			toDb.ascORdesc='desc';
9337
			toDb.ascORdesc='desc';
9338
			toDb.numLimit='1';
9338
			toDb.numLimit='1';
9339
			//toDb.WhereColumnName=['id'];
9339
			//toDb.WhereColumnName=['id'];
9340
			//toDb.WhereColumnOperator=['>'];
9340
			//toDb.WhereColumnOperator=['>'];
9341
			//toDb.WhereColumnValue=[window.qbpwcf.screenShare.clientDataId+''];
9341
			//toDb.WhereColumnValue=[window.qbpwcf.screenShare.clientDataId+''];
9342
			
9342
 
9343
			//debug
9343
			//debug
9344
			if(window.debug){
9344
			if(window.debug){
9345
			
9345
 
9346
				console.log(toDb);
9346
				console.log(toDb);
9347
				
9347
 
9348
				}//if end	
9348
				}//if end
9349
							
9349
 
9350
			//加密要傳輸的變數
9350
			//加密要傳輸的變數
9351
			toDb=btoa(encodeURIComponent(JSON.stringify(toDb)));
9351
			toDb=btoa(encodeURIComponent(JSON.stringify(toDb)));
9352
					
9352
 
9353
			//從Server取得資料
9353
			//從Server取得資料
9354
			params={};
9354
			params={};
9355
			params.method='POST';
9355
			params.method='POST';
9356
			params.url='/qbpwcf/db/dbOut.php';
9356
			params.url='/qbpwcf/db/dbOut.php';
9357
			params.resType='json';
9357
			params.resType='json';
9358
			params.preAc=function(res){
9358
			params.preAc=function(res){
9359
			
9359
 
9360
				//debug
9360
				//debug
9361
				if(window.debug){
9361
				if(window.debug){
9362
				
9362
 
9363
					console.log('loading');
9363
					console.log('loading');
9364
					
9364
 
9365
					}//if end
9365
					}//if end
9366
				};
9366
				};
9367
			params.aftAc=function(res){
9367
			params.aftAc=function(res){
9368
				
9368
 
9369
				//debug
9369
				//debug
9370
				if(window.debug){
9370
				if(window.debug){
9371
				
9371
 
9372
					console.log(res);
9372
					console.log(res);
9373
				
9373
 
9374
					}//if end
9374
					}//if end
9375
				
9375
 
9376
				//如果尚無資料
9376
				//如果尚無資料
9377
				if(res.dataContent===null){
9377
				if(res.dataContent===null){
9378
				
9378
 
9379
					//debug
9379
					//debug
9380
					if(window.debug){
9380
					if(window.debug){
9381
				
9381
 
9382
						//提示讀取到結尾了
9382
						//提示讀取到結尾了
9383
						console.log('read EOL');
9383
						console.log('read EOL');
9384
			
9384
 
9385
						}//if end
9385
						}//if end
9386
			
9386
 
9387
					//遞迴
9387
					//遞迴
9388
					window.qbpwcf.screenShare.clientRecursive();
9388
					window.qbpwcf.screenShare.clientRecursive();
9389
					
9389
 
9390
					//結束執行
9390
					//結束執行
9391
					return true;
9391
					return true;
9392
				
9392
 
9393
					}//if end
9393
					}//if end
9394
				
9394
 
9395
				//取得id
9395
				//取得id
9396
				id=res.dataContent.id[0];
9396
				id=res.dataContent.id[0];
9397
				
9397
 
9398
				//如果id有變
9398
				//如果id有變
9399
				if(window.qbpwcf.screenShare.clientDataId!==id){
9399
				if(window.qbpwcf.screenShare.clientDataId!==id){
9400
				
9400
 
9401
					//取得新id
9401
					//取得新id
9402
					window.qbpwcf.screenShare.clientDataId=id;
9402
					window.qbpwcf.screenShare.clientDataId=id;
9403
				
9403
 
9404
					//讀取片段資料
9404
					//讀取片段資料
9405
					json=res.dataContent.json[0];
9405
					json=res.dataContent.json[0];
9406
					
9406
 
9407
					//debug
9407
					//debug
9408
					if(window.debug){
9408
					if(window.debug){
9409
					
9409
 
9410
						console.log(json);
9410
						console.log(json);
9411
					
9411
 
9412
						}//if end
9412
						}//if end
9413
							
9413
 
9414
					//parse json											
9414
					//parse json
9415
					json=JSON.parse(json);
9415
					json=JSON.parse(json);
9416
					
9416
 
9417
					//debug
9417
					//debug
9418
					if(window.debug){
9418
					if(window.debug){
9419
					
9419
 
9420
						console.log(json);
9420
						console.log(json);
9421
					
9421
 
9422
						}//if end
9422
						}//if end
9423
					
9423
 
9424
					//用int8Array的方式儲存
9424
					//用int8Array的方式儲存
9425
					intArray=new Int8Array(Object.values(json));
9425
					intArray=new Int8Array(Object.values(json));
9426
					
9426
 
9427
					//debug
9427
					//debug
9428
					if(window.debug){
9428
					if(window.debug){
9429
					
9429
 
9430
						console.log(intArray);
9430
						console.log(intArray);
9431
					
9431
 
9432
						}//if end
9432
						}//if end
9433
					
9433
 
9434
						
9434
 
9435
					//debug
9435
					//debug
9436
					if(window.debug){
9436
					if(window.debug){
9437
					
9437
 
9438
						console.log(intArray.buffer);
9438
						console.log(intArray.buffer);
9439
					
9439
 
9440
						}//if end
9440
						}//if end
9441
					
9441
 
9442
					//轉換成blob
9442
					//轉換成blob
9443
					blob=new Blob(intArray,{type:'video/webm'});
9443
					blob=new Blob(intArray,{type:'video/webm'});
9444
					
9444
 
9445
					//debug
9445
					//debug
9446
					if(window.debug){
9446
					if(window.debug){
9447
					
9447
 
9448
						console.log(blob);
9448
						console.log(blob);
9449
					
9449
 
9450
						}//if end
9450
						}//if end
9451
					
9451
 
9452
					//建立 reader 物件
9452
					//建立 reader 物件
9453
					readerR = new FileReader();
9453
					readerR = new FileReader();
9454
					
9454
 
9455
					//如果開啟完畢
9455
					//如果開啟完畢
9456
					readerR.addEventListener('loadend',function(e){
9456
					readerR.addEventListener('loadend',function(e){
9457
					
9457
 
9458
						//debug
9458
						//debug
9459
						if(window.debug){
9459
						if(window.debug){
9460
					
9460
 
9461
							console.log(e);
9461
							console.log(e);
9462
						
9462
 
9463
							}//if end
9463
							}//if end
9464
													
9464
 
9465
						//取得 arrayBUffer
9465
						//取得 arrayBUffer
9466
						buf=e.originalTarget.result;
9466
						buf=e.originalTarget.result;
9467
						
9467
 
9468
						//debug
9468
						//debug
9469
						if(window.debug){
9469
						if(window.debug){
9470
					
9470
 
9471
							console.log(buf);
9471
							console.log(buf);
9472
						
9472
 
9473
							}//if end	
9473
							}//if end
9474
						
9474
 
9475
						//debug
9475
						//debug
9476
						if(window.debug){
9476
						if(window.debug){
9477
					
9477
 
9478
							console.log(window.qbpwcf.screenShare.sourceBuffer);	
9478
							console.log(window.qbpwcf.screenShare.sourceBuffer);
9479
						
9479
 
9480
							}//if end
9480
							}//if end
9481
						
9481
 
9482
						//append buffer
9482
						//append buffer
9483
						window.qbpwcf.screenShare.sourceBuffer.appendBuffer(buf);	
9483
						window.qbpwcf.screenShare.sourceBuffer.appendBuffer(buf);
9484
						
9484
 
9485
						// Wait for the sourcebuffer to be ready to load all other chunks
9485
						// Wait for the sourcebuffer to be ready to load all other chunks
9486
						window.qbpwcf.screenShare.sourceBuffer.addEventListener('updateend',window.qbpwcf.screenShare.clientRecursive);
9486
						window.qbpwcf.screenShare.sourceBuffer.addEventListener('updateend',window.qbpwcf.screenShare.clientRecursive);
9487
						
9487
 
9488
						//debug
9488
						//debug
9489
						if(window.debug){
9489
						if(window.debug){
9490
					
9490
 
9491
							console.log(window.qbpwcf.screenShare.sourceBuffer);	
9491
							console.log(window.qbpwcf.screenShare.sourceBuffer);
9492
						
9492
 
9493
							}//if end	
9493
							}//if end
9494
						
9494
 
9495
						});//addEventListener end	
9495
						});//addEventListener end
9496
																		
-
 
-
 
9496
 
9497
					//讀取 blob 成 arrayBuffer
9497
					//讀取 blob 成 arrayBuffer
9498
					readerR.readAsArrayBuffer(blob);
9498
					readerR.readAsArrayBuffer(blob);
9499
										
9499
 
9500
					//遞迴
9500
					//遞迴
9501
					window.qbpwcf.screenShare.clientRecursive();					
9501
					window.qbpwcf.screenShare.clientRecursive();
9502
				
9502
 
9503
					}//if end
9503
					}//if end
9504
					
9504
 
9505
				//反之
9505
				//反之
9506
				else{
9506
				else{
9507
				
9507
 
9508
					//遞迴
9508
					//遞迴
9509
					window.qbpwcf.screenShare.clientRecursive();	
9509
					window.qbpwcf.screenShare.clientRecursive();
9510
				
9510
 
9511
					}//else end
9511
					}//else end
9512
							
9512
 
9513
				}//function end
9513
				}//function end
9514
				
9514
 
9515
			params.data='params='+toDb;
9515
			params.data='params='+toDb;
9516
			window.qbpwcf.ajax(params);
9516
			window.qbpwcf.ajax(params);
9517
						
9517
 
9518
			}//function end
9518
			}//function end
9519
		";
9519
		";
9520
		
9520
 
9521
		/*
9521
		/*
9522
		desc:
9522
		desc:
9523
		等待既有圖片讀取完畢後,再讀取更清楚的圖片,取代之.
9523
		等待既有圖片讀取完畢後,再讀取更清楚的圖片,取代之.
9524
		參考資料:
9524
		參考資料:
9525
		https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
9525
		https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
9526
		*/
9526
		*/
9527
		$conf["javaScript::toScript"]["jsFunciton"][]=
9527
		$conf["javaScript::toScript"]["jsFunciton"][]=
9528
		"
9528
		"
9529
		//img thumbnails 效果
9529
		//img thumbnails 效果
9530
		window.qbpwcf.imgThumbnails=function(thumbnails,oriImgUrl){
9530
		window.qbpwcf.imgThumbnails=function(thumbnails,oriImgUrl){
9531
		
9531
 
9532
			//如果變數 thumbnails 跟 oriImg 其中一個不是 object
9532
			//如果變數 thumbnails 跟 oriImg 其中一個不是 object
9533
			if( typeof(thumbnails)!=='object' || typeof(oriImgUrl)!=='string' ){
9533
			if( typeof(thumbnails)!=='object' || typeof(oriImgUrl)!=='string' ){
9534
			
9534
 
9535
				//提示錯誤訊息
9535
				//提示錯誤訊息
9536
				console.error('thumbnails not a object');
9536
				console.error('thumbnails not a object');
9537
				
9537
 
9538
				//提示錯誤訊息
9538
				//提示錯誤訊息
9539
				console.error('oriImgUrl not a string');
9539
				console.error('oriImgUrl not a string');
9540
			
9540
 
9541
				//結束執行
9541
				//結束執行
9542
				return false;
9542
				return false;
9543
			
9543
 
9544
				}//if end
9544
				}//if end
9545
 
9545
 
9546
			//event只跑一次的設定參數
9546
			//event只跑一次的設定參數
9547
			var Optional={};
9547
			var Optional={};
9548
			Optional.once=true;
9548
			Optional.once=true;
9549
 
9549
 
9550
			//事件,當圖片檔案讀取完畢後執行
9550
			//事件,當圖片檔案讀取完畢後執行
9551
			thumbnails.addEventListener('load',function(e){
9551
			thumbnails.addEventListener('load',function(e){
9552
			
9552
 
9553
				/*
9553
				/*
9554
				設置 window.qbpwcf.ajax 函數
9554
				設置 window.qbpwcf.ajax 函數
9555
				說明:
9555
				說明:
9556
				傳送ajax,指定傳送前要做什麼事情,傳送後要做什麼事情.
9556
				傳送ajax,指定傳送前要做什麼事情,傳送後要做什麼事情.
9557
				參數:
9557
				參數:
Line 9567... Line 9567...
9567
				params={};
9567
				params={};
9568
				params.method='GET';
9568
				params.method='GET';
9569
				params.url=oriImgUrl;
9569
				params.url=oriImgUrl;
9570
				params.resType='blob';
9570
				params.resType='blob';
9571
				//帶入 img obj
9571
				//帶入 img obj
9572
				params.imgObj=e.target; 
9572
				params.imgObj=e.target;
9573
				params.aftAc=function(res){
9573
				params.aftAc=function(res){
9574
					
9574
 
9575
					//new reader obj
9575
					//new reader obj
9576
					var reader = new FileReader();
9576
					var reader = new FileReader();
9577
					
9577
 
9578
					//reader evevnt
9578
					//reader evevnt
9579
					reader.addEventListener('loadend', function(e){
9579
					reader.addEventListener('loadend', function(e){
9580
						
9580
 
9581
						//置換圖片位置為 base64 data url
9581
						//置換圖片位置為 base64 data url
9582
						reader.imgObj.src=e.target.result;
9582
						reader.imgObj.src=e.target.result;
9583
					});
9583
					});
9584
					
9584
 
9585
					//帶入 img obj
9585
					//帶入 img obj
9586
					reader.imgObj=params.imgObj;
9586
					reader.imgObj=params.imgObj;
9587
					
9587
 
9588
					//讀取圖片為 data url
9588
					//讀取圖片為 data url
9589
					reader.readAsDataURL(res);
9589
					reader.readAsDataURL(res);
9590
 
9590
 
9591
					};
9591
					};
9592
				window.qbpwcf.ajax(params);
9592
				window.qbpwcf.ajax(params);
9593
 
9593
 
9594
				},Optional);//functino end
9594
				},Optional);//functino end
9595
				
9595
 
9596
			}//function end
9596
			}//function end
9597
		";
9597
		";
9598
		
9598
 
9599
		/*
9599
		/*
9600
		desc:
9600
		desc:
9601
		低解析度的指定圖片讀取完畢後,再讀取更清楚的圖片,取代之.
9601
		低解析度的指定圖片讀取完畢後,再讀取更清楚的圖片,取代之.
9602
		參考資料:
9602
		參考資料:
9603
		https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous
9603
		https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous
9604
		*/
9604
		*/
9605
		$conf["javaScript::toScript"]["jsFunciton"][]=
9605
		$conf["javaScript::toScript"]["jsFunciton"][]=
9606
		"
9606
		"
9607
		//img thumbnails 效果,用 async 實作
9607
		//img thumbnails 效果,用 async 實作
9608
		window.qbpwcf.imgThumbAsync=async function(element,thumbUrl,oriImgUrl){
9608
		window.qbpwcf.imgThumbAsync=async function(element,thumbUrl,oriImgUrl){
9609
		
9609
 
9610
			//如果變數 element 不是 object 或 thumbUrl 跟 oriImg 其中一個不是 string
9610
			//如果變數 element 不是 object 或 thumbUrl 跟 oriImg 其中一個不是 string
9611
			if( typeof(element)!=='object' || typeof(thumbUrl)!=='string' || typeof(oriImgUrl)!=='string' ){
9611
			if( typeof(element)!=='object' || typeof(thumbUrl)!=='string' || typeof(oriImgUrl)!=='string' ){
9612
			
9612
 
9613
				//提示錯誤訊息
9613
				//提示錯誤訊息
9614
				console.error('element is not a object');
9614
				console.error('element is not a object');
9615
				
9615
 
9616
				//提示錯誤訊息
9616
				//提示錯誤訊息
9617
				console.error('thumbUrl is not a string');
9617
				console.error('thumbUrl is not a string');
9618
				
9618
 
9619
				//提示錯誤訊息
9619
				//提示錯誤訊息
9620
				console.error('oriImgUrl is not a string');
9620
				console.error('oriImgUrl is not a string');
9621
			
9621
 
9622
				//結束執行
9622
				//結束執行
9623
				return false;
9623
				return false;
9624
			
9624
 
9625
				}//if end
9625
				}//if end
9626
			
9626
 
9627
			//載入低解析度的圖片,將Promise儲存到res裡面
9627
			//載入低解析度的圖片,將Promise儲存到res裡面
9628
			var res = await fetch(thumbUrl);
9628
			var res = await fetch(thumbUrl);
9629
			
9629
 
9630
			//如果沒有讀取成功
9630
			//如果沒有讀取成功
9631
			if(await res.status!==200){
9631
			if(await res.status!==200){
9632
			
9632
 
9633
				//回傳失敗
9633
				//回傳失敗
9634
				return false;
9634
				return false;
9635
			
9635
 
9636
				}//if end
9636
				}//if end
9637
			
9637
 
9638
			//顯示低解析度的圖片
9638
			//顯示低解析度的圖片
9639
			element.src=URL.createObjectURL(await res.blob());
9639
			element.src=URL.createObjectURL(await res.blob());
9640
			
9640
 
9641
			//載入原始圖片,將Promise儲存到res裡面
9641
			//載入原始圖片,將Promise儲存到res裡面
9642
			var res = await fetch(oriImgUrl);
9642
			var res = await fetch(oriImgUrl);
9643
			
9643
 
9644
			//如果沒有讀取成功
9644
			//如果沒有讀取成功
9645
			if(await res.status!==200){
9645
			if(await res.status!==200){
9646
			
9646
 
9647
				//回傳失敗
9647
				//回傳失敗
9648
				return false;
9648
				return false;
9649
			
9649
 
9650
				}//if end
9650
				}//if end
9651
			
9651
 
9652
			//顯示原始的圖片
9652
			//顯示原始的圖片
9653
			element.src=URL.createObjectURL(await res.blob());
9653
			element.src=URL.createObjectURL(await res.blob());
9654
			
9654
 
9655
			//回傳正確
9655
			//回傳正確
9656
			return true;
9656
			return true;
9657
			
9657
 
9658
			}//function end
9658
			}//function end
9659
		";
9659
		";
9660
		
9660
 
9661
		/*
9661
		/*
9662
		desc:
9662
		desc:
9663
		低解析度的多個指定圖片讀取完畢後,再讀取更清楚的圖片,取代之,且同步執行.
9663
		低解析度的多個指定圖片讀取完畢後,再讀取更清楚的圖片,取代之,且同步執行.
9664
		參考資料:
9664
		參考資料:
9665
		https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous/Async_await
9665
		https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous/Async_await
9666
		*/
9666
		*/
9667
		$conf["javaScript::toScript"]["jsFunciton"][]=
9667
		$conf["javaScript::toScript"]["jsFunciton"][]=
9668
		"
9668
		"
9669
		//多張img thumbnails 效果,用 async 實作
9669
		//多張img thumbnails 效果,用 async 實作
9670
		window.qbpwcf.multiImgThumbAsync=async function(element,thumbUrl,oriImgUrl){
9670
		window.qbpwcf.multiImgThumbAsync=async function(element,thumbUrl,oriImgUrl){
9671
		
9671
 
9672
			//儲存要同步執行的工作
9672
			//儲存要同步執行的工作
9673
			var tasks=[];
9673
			var tasks=[];
9674
		
9674
 
9675
			//針對每個陣列元素做事情,不需要中斷.
9675
			//針對每個陣列元素做事情,不需要中斷.
9676
			element.forEach(function(value,key)
9676
			element.forEach(function(value,key)
9677
			{
9677
			{
9678
				//不等待結果趕緊執行下一個
9678
				//不等待結果趕緊執行下一個
9679
				tasks.push(window.qbpwcf.imgThumbAsync(value,thumbUrl[key],oriImgUrl[key]));
9679
				tasks.push(window.qbpwcf.imgThumbAsync(value,thumbUrl[key],oriImgUrl[key]));
9680
			});
9680
			});
9681
			
9681
 
9682
			//等待每個工作執行結束
9682
			//等待每個工作執行結束
9683
			await Promise.all(tasks);
9683
			await Promise.all(tasks);
9684
					
9684
 
9685
			//回傳正確
9685
			//回傳正確
9686
			return true;		
9686
			return true;
9687
						
9687
 
9688
			}//function end
9688
			}//function end
9689
		";
9689
		";
9690
		
9690
 
9691
		$conf["javaScript::toScript"]["jsFunciton"][]=
9691
		$conf["javaScript::toScript"]["jsFunciton"][]=
9692
		"
9692
		"
9693
		/*
9693
		/*
9694
		說明:
9694
		說明:
9695
		偷偷摸摸地傳送表單,並觸發事件
9695
		偷偷摸摸地傳送表單,並觸發事件
Line 9699... Line 9699...
9699
		params.target='';為表單要傳送到的目的地.
9699
		params.target='';為表單要傳送到的目的地.
9700
		params.successFunc='';為表單回覆為成功時要做的事情,回應為一物件,有一屬性為'status',其數值為'true'.
9700
		params.successFunc='';為表單回覆為成功時要做的事情,回應為一物件,有一屬性為'status',其數值為'true'.
9701
		params.failedFunc='';為表單回覆為失敗時要做的事情,回應為一物件,有一屬性為'status',其數值為'false'.
9701
		params.failedFunc='';為表單回覆為失敗時要做的事情,回應為一物件,有一屬性為'status',其數值為'false'.
9702
		*/
9702
		*/
9703
		window.qbpwcf.slientSubmit=function(params){
9703
		window.qbpwcf.slientSubmit=function(params){
9704
		
9704
 
9705
			//取得表單元素的key
9705
			//取得表單元素的key
9706
			var formKeys=Object.keys(params.formEle);
9706
			var formKeys=Object.keys(params.formEle);
9707
		
9707
 
9708
			//取得表單key的數量
9708
			//取得表單key的數量
9709
			var formLength=formKeys.length;
9709
			var formLength=formKeys.length;
9710
		
9710
 
9711
			//針對每個 key
9711
			//針對每個 key
9712
			for(var i=0;i<formLength;i++){
9712
			for(var i=0;i<formLength;i++){
9713
			
9713
 
9714
				//該表單,綁定失去焦點的事件,看其來沒有效果
9714
				//該表單,綁定失去焦點的事件,看其來沒有效果
9715
				params.formEle[i].addEventListener('focusout',function(e){
9715
				params.formEle[i].addEventListener('focusout',function(e){
9716
				
9716
 
9717
					//如果輸入內容為空
9717
					//如果輸入內容為空
9718
					if(e.target.value===''){
9718
					if(e.target.value===''){
9719
						
9719
 
9720
						//聚焦選單
9720
						//聚焦選單
9721
						e.target.focus();
9721
						e.target.focus();
9722
				
9722
 
9723
						}//if end
9723
						}//if end
9724
				
9724
 
9725
					});//event blur end
9725
					});//event blur end
9726
					
9726
 
9727
				//該表單,綁定內容變化的事件
9727
				//該表單,綁定內容變化的事件
9728
				params.formEle[i].addEventListener('change',function(e){
9728
				params.formEle[i].addEventListener('change',function(e){
9729
								
9729
 
9730
					//針對每個表單
9730
					//針對每個表單
9731
					for(var j=0;j<formLength;j++){
9731
					for(var j=0;j<formLength;j++){
9732
					
9732
 
9733
						//如果有表單未填寫
9733
						//如果有表單未填寫
9734
						if(params.formEle[j].value===''){
9734
						if(params.formEle[j].value===''){
9735
						
9735
 
9736
							//結束迴圈	
9736
							//結束迴圈
9737
							break;
9737
							break;
9738
							
9738
 
9739
							}//if end
9739
							}//if end
9740
					
9740
 
9741
						//到這邊代表表單都有填寫
9741
						//到這邊代表表單都有填寫
9742
						if(j===formLength-1){
9742
						if(j===formLength-1){
9743
						
9743
 
9744
							//驗證表單 - start 
9744
							//驗證表單 - start
9745
							
9745
 
9746
							//初始化表單變數
9746
							//初始化表單變數
9747
							var post='';
9747
							var post='';
9748
							
9748
 
9749
							//針對每個表單
9749
							//針對每個表單
9750
							for(var k=0;k<formLength;k++){
9750
							for(var k=0;k<formLength;k++){
9751
							
9751
 
9752
								//記錄表單名稱
9752
								//記錄表單名稱
9753
								var formName=params.formEle[k].name;
9753
								var formName=params.formEle[k].name;
9754
								
9754
 
9755
								//記錄表單數值
9755
								//記錄表單數值
9756
								var formValue=params.formEle[k].value;
9756
								var formValue=params.formEle[k].value;
9757
								
9757
 
9758
								//當是第一個表單時
9758
								//當是第一個表單時
9759
								if(k==0){
9759
								if(k==0){
9760
								
9760
 
9761
									//串接變數
9761
									//串接變數
9762
									post=post+formName+'='+encodeURIComponent(formValue);
9762
									post=post+formName+'='+encodeURIComponent(formValue);
9763
							
9763
 
9764
									}//if end
9764
									}//if end
9765
									
9765
 
9766
								//中間的表單
9766
								//中間的表單
9767
								else{
9767
								else{
9768
								
9768
 
9769
									//串接變數
9769
									//串接變數
9770
									post=post+'&'+formName+'='+encodeURIComponent(formValue);
9770
									post=post+'&'+formName+'='+encodeURIComponent(formValue);
9771
								
9771
 
9772
									}//else end
9772
									}//else end
9773
							
9773
 
9774
								}//for end
9774
								}//for end
9775
						
9775
 
9776
							/*
9776
							/*
9777
							設置 window.qbpwcf.ajax 函數
9777
							設置 window.qbpwcf.ajax 函數
9778
							說明:
9778
							說明:
9779
							傳送ajax,指定傳送前要做什麼事情,傳送後要做什麼事情.
9779
							傳送ajax,指定傳送前要做什麼事情,傳送後要做什麼事情.
9780
							參數:
9780
							參數:
Line 9791... Line 9791...
9791
							ajParams.method='POST';
9791
							ajParams.method='POST';
9792
							ajParams.url=params.target;
9792
							ajParams.url=params.target;
9793
							ajParams.resType='json';
9793
							ajParams.resType='json';
9794
							ajParams.data=post;
9794
							ajParams.data=post;
9795
							ajParams.aftAc=function(res){
9795
							ajParams.aftAc=function(res){
9796
							
9796
 
9797
								//驗證正確
9797
								//驗證正確
9798
								if(res.status==='true'){
9798
								if(res.status==='true'){
9799
							
9799
 
9800
									//運行驗證成功的函式
9800
									//運行驗證成功的函式
9801
									params.successFunc(res);
9801
									params.successFunc(res);
9802
									
9802
 
9803
									}//if end
9803
									}//if end
9804
									
9804
 
9805
								//反之驗證失敗
9805
								//反之驗證失敗
9806
								else if(params.failedFunc!==undefined){
9806
								else if(params.failedFunc!==undefined){
9807
								
9807
 
9808
									//運行驗證失敗的函式
9808
									//運行驗證失敗的函式
9809
									params.failedFunc(res);
9809
									params.failedFunc(res);
9810
								
9810
 
9811
									}//if end
9811
									}//if end
9812
								
9812
 
9813
								};
9813
								};
9814
								
9814
 
9815
							window.qbpwcf.ajax(ajParams);
9815
							window.qbpwcf.ajax(ajParams);
9816
							
9816
 
9817
						
9817
 
9818
							//驗證表單 - end
9818
							//驗證表單 - end
9819
						
9819
 
9820
							}//if end
9820
							}//if end
9821
					
9821
 
9822
						}//for end
9822
						}//for end
9823
				
9823
 
9824
					//結束程式
9824
					//結束程式
9825
					return false;
9825
					return false;
9826
				
9826
 
9827
					});//event blur end
9827
					});//event blur end
9828
			
9828
 
9829
				}//for end
9829
				}//for end
9830
		
9830
 
9831
			}//function end
9831
			}//function end
9832
		";
9832
		";
9833
		
9833
 
9834
		#js function
9834
		#js function
9835
		$conf["javaScript::toScript"]["jsFunciton"][]=
9835
		$conf["javaScript::toScript"]["jsFunciton"][]=
9836
		"
9836
		"
9837
		/*
9837
		/*
9838
		說明:
9838
		說明:
Line 9843... Line 9843...
9843
		params.timeout,偵測的毫秒數上限.
9843
		params.timeout,偵測的毫秒數上限.
9844
		params.callback,偵測完服務後要執行的函式,參數為偵測的結果可以連線為true,不可連線為false.
9844
		params.callback,偵測完服務後要執行的函式,參數為偵測的結果可以連線為true,不可連線為false.
9845
		*/
9845
		*/
9846
		window.qbpwcf.connectable={};
9846
		window.qbpwcf.connectable={};
9847
		window.qbpwcf.connectable.func=function(params){
9847
		window.qbpwcf.connectable.func=function(params){
9848
		
9848
 
9849
			//如果 url 未定義
9849
			//如果 url 未定義
9850
			if(params===undefined){
9850
			if(params===undefined){
9851
			
9851
 
9852
				//回傳 false
9852
				//回傳 false
9853
				return false;
9853
				return false;
9854
			
9854
 
9855
				}//if end
9855
				}//if end
9856
		
9856
 
9857
			//如果 url 未定義
9857
			//如果 url 未定義
9858
			if(params.url===undefined){
9858
			if(params.url===undefined){
9859
			
9859
 
9860
				//初始化為 https://www.google.com
9860
				//初始化為 https://www.google.com
9861
				this.url='https://www.google.com';
9861
				this.url='https://www.google.com';
9862
			
9862
 
9863
				}//if end
9863
				}//if end
9864
			
9864
 
9865
			//反之
9865
			//反之
9866
			else{
9866
			else{
9867
				//設置 url
9867
				//設置 url
9868
				this.url=params.url;
9868
				this.url=params.url;
9869
			
9869
 
9870
				}//else end
9870
				}//else end
9871
			
9871
 
9872
			//如果 timeout 未定義
9872
			//如果 timeout 未定義
9873
			if(params.timeout===undefined){
9873
			if(params.timeout===undefined){
9874
			
9874
 
9875
				//初始化為1秒鐘
9875
				//初始化為1秒鐘
9876
				this.timeout=1000;
9876
				this.timeout=1000;
9877
			
9877
 
9878
				}//if end
9878
				}//if end
9879
			
9879
 
9880
			//反之
9880
			//反之
9881
			else{
9881
			else{
9882
			
9882
 
9883
				//設置 timeout
9883
				//設置 timeout
9884
				this.timeout=params.timeout;
9884
				this.timeout=params.timeout;
9885
			
9885
 
9886
				}//else end
9886
				}//else end
9887
				
9887
 
9888
			//如果 callback 未定義
9888
			//如果 callback 未定義
9889
			if(params.callback===undefined){
9889
			if(params.callback===undefined){
9890
			
9890
 
9891
				//初始化 callback
9891
				//初始化 callback
9892
				this.callback=function(res){
9892
				this.callback=function(res){
9893
				
9893
 
9894
					console.log(res);
9894
					console.log(res);
9895
				
9895
 
9896
					}//function end
9896
					}//function end
9897
			
9897
 
9898
				}//if end
9898
				}//if end
9899
			
9899
 
9900
			//反之
9900
			//反之
9901
			else{
9901
			else{
9902
			
9902
 
9903
				//設置 callback
9903
				//設置 callback
9904
				this.callback=params.callback;
9904
				this.callback=params.callback;
9905
			
9905
 
9906
				}//else end
9906
				}//else end
9907
			
9907
 
9908
			//預設尚未偵測完成 params.url 的服務狀況
9908
			//預設尚未偵測完成 params.url 的服務狀況
9909
			this.detectServiceFin=false;
9909
			this.detectServiceFin=false;
9910
			
9910
 
9911
			//預設 params.url 的服務狀況為正常
9911
			//預設 params.url 的服務狀況為正常
9912
			this.serviceBlock=false;
9912
			this.serviceBlock=false;
9913
			
9913
 
9914
			//儲存timeout物件
9914
			//儲存timeout物件
9915
			this.checkServiceBlockTimeout={};
9915
			this.checkServiceBlockTimeout={};
9916
			
9916
 
9917
			/*
9917
			/*
9918
			說明:
9918
			說明:
9919
			傳送ajax,指定傳送前要做什麼事情,傳送後要做什麼事情.
9919
			傳送ajax,指定傳送前要做什麼事情,傳送後要做什麼事情.
9920
			參數:
9920
			參數:
9921
			params={};
9921
			params={};
Line 9935... Line 9935...
9935
			params.callback=this.callback;
9935
			params.callback=this.callback;
9936
			params.method='GET';
9936
			params.method='GET';
9937
			params.data={};
9937
			params.data={};
9938
			params.url=this.url;
9938
			params.url=this.url;
9939
			params.preAc=function(){
9939
			params.preAc=function(){
9940
			
9940
 
9941
				//取得 xmlhttp物件
9941
				//取得 xmlhttp物件
9942
				var xmlhttp=this;
9942
				var xmlhttp=this;
9943
				
9943
 
9944
				//設置過了 params.timeout 秒中後要做的事情.
9944
				//設置過了 params.timeout 秒中後要做的事情.
9945
				params.checkServiceBlockTimeout=setTimeout(function(){
9945
				params.checkServiceBlockTimeout=setTimeout(function(){
9946
				
9946
 
9947
					//中斷連線
9947
					//中斷連線
9948
					xmlhttp.abort();
9948
					xmlhttp.abort();
9949
					
9949
 
9950
					//提示目標被封鎖了
9950
					//提示目標被封鎖了
9951
					console.log(params.url+' is blocked');
9951
					console.log(params.url+' is blocked');
9952
					
9952
 
9953
					//設置服務不正常,被阻擋了
9953
					//設置服務不正常,被阻擋了
9954
					params.serviceBlock=true;
9954
					params.serviceBlock=true;
9955
					
9955
 
9956
					//設置偵測google連線完畢
9956
					//設置偵測google連線完畢
9957
					params.detectServiceFin=true;
9957
					params.detectServiceFin=true;
9958
					
9958
 
9959
					},params.timeout,xmlhttp);
9959
					},params.timeout,xmlhttp);
9960
				
9960
 
9961
				}
9961
				}
9962
			params.aftAc=function(res){
9962
			params.aftAc=function(res){
9963
			
9963
 
9964
				//debug
9964
				//debug
9965
				console.log('res='+res);
9965
				console.log('res='+res);
9966
			
9966
 
9967
				//清除 timeout 的 flag
9967
				//清除 timeout 的 flag
9968
				clearTimeout(params.checkServiceBlockTimeout);
9968
				clearTimeout(params.checkServiceBlockTimeout);
9969
				
9969
 
9970
				//設置偵測google連線完畢
9970
				//設置偵測google連線完畢
9971
				params.detectServiceFin=true;
9971
				params.detectServiceFin=true;
9972
			
9972
 
9973
				}
9973
				}
9974
			window.qbpwcf.ajax(params);
9974
			window.qbpwcf.ajax(params);
9975
			
9975
 
9976
			//設置無限等待
9976
			//設置無限等待
9977
			var intervalTail = window.setInterval(function(){
9977
			var intervalTail = window.setInterval(function(){
9978
			
9978
 
9979
				//如果已經偵測好google的連線狀況
9979
				//如果已經偵測好google的連線狀況
9980
				if(params.detectServiceFin){
9980
				if(params.detectServiceFin){
9981
				
9981
 
9982
					//清除無限等待
9982
					//清除無限等待
9983
					clearInterval(intervalTail);
9983
					clearInterval(intervalTail);
9984
					
9984
 
9985
					console.log(params.callback);
9985
					console.log(params.callback);
9986
					
9986
 
9987
					//如果存在要callback的函式
9987
					//如果存在要callback的函式
9988
					if(params.callback!==undefined){
9988
					if(params.callback!==undefined){
9989
					
9989
 
9990
						//debug
9990
						//debug
9991
						console.log('beafore callback');
9991
						console.log('beafore callback');
9992
					
9992
 
9993
						//callback
9993
						//callback
9994
						params.callback.call(this,params.serviceBlock);
9994
						params.callback.call(this,params.serviceBlock);
9995
						
9995
 
9996
						}//if end
9996
						}//if end
9997
					
9997
 
9998
					}//if end
9998
					}//if end
9999
			
9999
 
10000
				},100);
10000
				},100);
10001
		
10001
 
10002
			}//function window.qbpwcf.connectable end
10002
			}//function window.qbpwcf.connectable end
10003
		";
10003
		";
10004
		
10004
 
10005
		#js function
10005
		#js function
10006
		$conf["javaScript::toScript"]["jsFunciton"][]=
10006
		$conf["javaScript::toScript"]["jsFunciton"][]=
10007
		"
10007
		"
10008
		/*
10008
		/*
10009
		說明:
10009
		說明:
Line 10025... Line 10025...
10025
		https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/fromBase64 => bytes array from base64 encode string
10025
		https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/fromBase64 => bytes array from base64 encode string
10026
		#備註:
10026
		#備註:
10027
		#server必須要有該字形.
10027
		#server必須要有該字形.
10028
		*/
10028
		*/
10029
		window.qbpwcf.fonts={};
10029
		window.qbpwcf.fonts={};
10030
		
10030
 
10031
		//default font binary
10031
		//default font binary
10032
		window.qbpwcf.fonts.bufferArray=new ArrayBuffer();
10032
		window.qbpwcf.fonts.bufferArray=new ArrayBuffer();
10033
		
10033
 
10034
		//load font function
10034
		//load font function
10035
		window.qbpwcf.fonts.load=async function(){
10035
		window.qbpwcf.fonts.load=async function(){
10036
		
10036
 
10037
			//建立font物件
10037
			//建立font物件
10038
			var font = new FontFace('qbpwcfFont', window.qbpwcf.fonts.bufferArray);
10038
			var font = new FontFace('qbpwcfFont', window.qbpwcf.fonts.bufferArray);
10039
			
10039
 
10040
			//告訴瀏覽器載入字形,並等待其執行完再往下執行
10040
			//告訴瀏覽器載入字形,並等待其執行完再往下執行
10041
			//因為 FontFace 類別的 load 方法回傳為 Promise ,因此要等待其回傳結果所以要用 await 關鍵字.
10041
			//因為 FontFace 類別的 load 方法回傳為 Promise ,因此要等待其回傳結果所以要用 await 關鍵字.
10042
			await font.load();
10042
			await font.load();
10043
		
10043
 
10044
			//新增字形到網頁文件
10044
			//新增字形到網頁文件
10045
			document.fonts.add(font);
10045
			document.fonts.add(font);
10046
			
10046
 
10047
			//新增 qbpwcfFont 類別的網頁字形
10047
			//新增 qbpwcfFont 類別的網頁字形
10048
			document.styleSheets[0].insertRule("."'.qbpwcfFont {font-family:qbpwcfFont;}'".");
10048
			document.styleSheets[0].insertRule("."'.qbpwcfFont {font-family:qbpwcfFont;}'".");
10049
			
10049
 
10050
			//避免重複新增class,先移除之
10050
			//避免重複新增class,先移除之
10051
			document.body.classList.remove('qbpwcfFont');
10051
			document.body.classList.remove('qbpwcfFont');
10052
			
10052
 
10053
			//套用字形
10053
			//套用字形
10054
			document.body.classList.add('qbpwcfFont');
10054
			document.body.classList.add('qbpwcfFont');
10055
		
10055
 
10056
			}//function end
10056
			}//function end
10057
		
10057
 
10058
		//list aviable fonts
10058
		//list aviable fonts
10059
		window.qbpwcf.fonts.list=function(){
10059
		window.qbpwcf.fonts.list=function(){
10060
			
10060
 
10061
			//開發中
10061
			//開發中
10062
			console.log('list fonts');
10062
			console.log('list fonts');
10063
	
10063
 
10064
			}//function end
10064
			}//function end
10065
 
10065
 
10066
		";
10066
		";
10067
		
10067
 
10068
		#js function
10068
		#js function
10069
		$conf["javaScript::toScript"]["jsFunciton"][]=
10069
		$conf["javaScript::toScript"]["jsFunciton"][]=
10070
		"
10070
		"
10071
		//記錄點擊當下的用戶資訊
10071
		//記錄點擊當下的用戶資訊
10072
		window.qbpwcf.recordClientInfo=function(){
10072
		window.qbpwcf.recordClientInfo=function(){
10073
		
10073
 
10074
			console.log('建構中');
10074
			console.log('建構中');
10075
		
10075
 
10076
			}//function end
10076
			}//function end
10077
		";
10077
		";
10078
		
10078
 
10079
		#js function
10079
		#js function
10080
		$conf["javaScript::toScript"]["jsFunciton"][]=
10080
		$conf["javaScript::toScript"]["jsFunciton"][]=
10081
		"
10081
		"
10082
		/*
10082
		/*
10083
		說明:
10083
		說明:
10084
		解析cookie資料
10084
		解析cookie資料
10085
		*/
10085
		*/
10086
		window.qbpwcf.cookie={};
10086
		window.qbpwcf.cookie={};
10087
		
10087
 
10088
		//記錄原始cookie
10088
		//記錄原始cookie
10089
		window.qbpwcf.cookie.ori=document.cookie;
10089
		window.qbpwcf.cookie.ori=document.cookie;
10090
		
10090
 
10091
		//如果有 cookie 存在
10091
		//如果有 cookie 存在
10092
		if(window.qbpwcf.cookie.ori!=''){
10092
		if(window.qbpwcf.cookie.ori!=''){
10093
		
10093
 
10094
			//記錄cookie的數量
10094
			//記錄cookie的數量
10095
			window.qbpwcf.cookie.count=document.cookie.split(';').length;
10095
			window.qbpwcf.cookie.count=document.cookie.split(';').length;
10096
			
10096
 
10097
			//初始化用名稱來記錄cookie的內容
10097
			//初始化用名稱來記錄cookie的內容
10098
			window.qbpwcf.cookie.byName={};
10098
			window.qbpwcf.cookie.byName={};
10099
			
10099
 
10100
			//有幾個cookie就執行幾次
10100
			//有幾個cookie就執行幾次
10101
			for(var i=0;i<window.qbpwcf.cookie.count;i++){
10101
			for(var i=0;i<window.qbpwcf.cookie.count;i++){
10102
			
10102
 
10103
				//取得cookie
10103
				//取得cookie
10104
				var cookieStr=document.cookie.split(';')[i];
10104
				var cookieStr=document.cookie.split(';')[i];
10105
			
10105
 
10106
				//取得cookie名稱
10106
				//取得cookie名稱
10107
				var cookieName=cookieStr.split('=')[0];
10107
				var cookieName=cookieStr.split('=')[0];
10108
				
10108
 
10109
				//取得cookie內容
10109
				//取得cookie內容
10110
				var cookieValue=cookieStr.split('=')[1];
10110
				var cookieValue=cookieStr.split('=')[1];
10111
			
10111
 
10112
				//記錄coockie
10112
				//記錄coockie
10113
				eval('window.qbpwcf.cookie.byName[\''+cookieName+'\']=cookieValue');
10113
				eval('window.qbpwcf.cookie.byName[\''+cookieName+'\']=cookieValue');
10114
				
10114
 
10115
				//如果有經過編碼
10115
				//如果有經過編碼
10116
				if(cookieValue!==decodeURIComponent(cookieValue)){
10116
				if(cookieValue!==decodeURIComponent(cookieValue)){
10117
				
10117
 
10118
					/*
10118
					/*
10119
					設置 window.qbpwcf.ajax 函數
10119
					設置 window.qbpwcf.ajax 函數
10120
					說明:
10120
					說明:
10121
					傳送ajax,指定傳送前要做什麼事情,傳送後要做什麼事情.
10121
					傳送ajax,指定傳送前要做什麼事情,傳送後要做什麼事情.
10122
					參數:
10122
					參數:
Line 10130... Line 10130...
10130
					params.data='data to contain','key1=encodeURIComponent(val1)&key2=encodeURIComponent(val2)';if no data please use {};
10130
					params.data='data to contain','key1=encodeURIComponent(val1)&key2=encodeURIComponent(val2)';if no data please use {};
10131
					*/
10131
					*/
10132
					params={};
10132
					params={};
10133
					params.method='POST';
10133
					params.method='POST';
10134
					params.url='/qbpwcf/unserialize/';
10134
					params.url='/qbpwcf/unserialize/';
10135
					
10135
 
10136
					//帶入 cookieName
10136
					//帶入 cookieName
10137
					params.cookieName=cookieName; 
10137
					params.cookieName=cookieName;
10138
					
10138
 
10139
					params.aftAc=function(res){
10139
					params.aftAc=function(res){
10140
 
10140
 
10141
						//如果有json回應				
10141
						//如果有json回應
10142
						if(res!==null){
10142
						if(res!==null){
10143
 
10143
 
10144
							//取得cookie解析後的結果
10144
							//取得cookie解析後的結果
10145
							eval('window.qbpwcf.cookie.byName.'+params.cookieName+'=res');
10145
							eval('window.qbpwcf.cookie.byName.'+params.cookieName+'=res');
10146
						
10146
 
10147
							}//if end
10147
							}//if end
10148
						
10148
 
10149
						};
10149
						};
10150
						
10150
 
10151
					params.data='data='+cookieValue;
10151
					params.data='data='+cookieValue;
10152
					window.qbpwcf.ajax.call(this,params);
10152
					window.qbpwcf.ajax.call(this,params);
10153
					
10153
 
10154
					}//if end
10154
					}//if end
10155
 
10155
 
10156
				}//for end
10156
				}//for end
10157
		
10157
 
10158
			}//if end
10158
			}//if end
10159
		
10159
 
10160
		";
10160
		";
10161
		
10161
 
10162
		#js function
10162
		#js function
10163
		$conf["javaScript::toScript"]["jsFunciton"][]=
10163
		$conf["javaScript::toScript"]["jsFunciton"][]=
10164
		"
10164
		"
10165
		/*
10165
		/*
10166
		說明:
10166
		說明:
10167
		dialog,類似modal的方法.
10167
		dialog,類似modal的方法.
10168
		*/
10168
		*/
10169
		window.qbpwcf.dialog={};
10169
		window.qbpwcf.dialog={};
10170
		
10170
 
10171
		/*
10171
		/*
10172
		用dialog確認要做的事情
10172
		用dialog確認要做的事情
10173
		*/
10173
		*/
10174
		//初始化儲存 confirm dialog 物件
10174
		//初始化儲存 confirm dialog 物件
10175
		window.qbpwcf.dialog.confirm={};
10175
		window.qbpwcf.dialog.confirm={};
10176
		
10176
 
10177
		//初始化相關屬性
10177
		//初始化相關屬性
10178
		window.qbpwcf.dialog.confirm.clear=function(){
10178
		window.qbpwcf.dialog.confirm.clear=function(){
10179
		
10179
 
10180
			//初始化儲存 confirm dialog 的實體
10180
			//初始化儲存 confirm dialog 的實體
10181
			window.qbpwcf.dialog.confirm.instance=null;
10181
			window.qbpwcf.dialog.confirm.instance=null;
10182
			
10182
 
10183
			//初始化儲存 confirm dialog 結束後取得的內容
10183
			//初始化儲存 confirm dialog 結束後取得的內容
10184
			window.qbpwcf.dialog.confirm.result={};
10184
			window.qbpwcf.dialog.confirm.result={};
10185
			
10185
 
10186
			//初始化儲存 confirm dialog 詢問的內容文字
10186
			//初始化儲存 confirm dialog 詢問的內容文字
10187
			window.qbpwcf.dialog.confirm.text='Are you sure?';
10187
			window.qbpwcf.dialog.confirm.text='Are you sure?';
10188
			
10188
 
10189
			//初始化儲存 confirm dialog 取消按鈕的顯示文字
10189
			//初始化儲存 confirm dialog 取消按鈕的顯示文字
10190
			window.qbpwcf.dialog.confirm.cancelBtnText='Cancel';
10190
			window.qbpwcf.dialog.confirm.cancelBtnText='Cancel';
10191
			
10191
 
10192
			//初始化儲存 confirm dialog 確定按鈕的顯示文字
10192
			//初始化儲存 confirm dialog 確定按鈕的顯示文字
10193
			window.qbpwcf.dialog.confirm.okBtnText='Confirm';
10193
			window.qbpwcf.dialog.confirm.okBtnText='Confirm';
10194
			
10194
 
10195
			//初始化 confirm dialog 的內容
10195
			//初始化 confirm dialog 的內容
10196
			window.qbpwcf.dialog.confirm.content='';
10196
			window.qbpwcf.dialog.confirm.content='';
10197
			
10197
 
10198
			//初始化 confirm dialog 的 dom 內容
10198
			//初始化 confirm dialog 的 dom 內容
10199
			window.qbpwcf.dialog.confirm.customDom={};
10199
			window.qbpwcf.dialog.confirm.customDom={};
10200
		
10200
 
10201
			}//function end
10201
			}//function end
10202
 
10202
 
10203
		//立刻初始化相關屬性
10203
		//立刻初始化相關屬性
10204
		window.qbpwcf.dialog.confirm.clear();
10204
		window.qbpwcf.dialog.confirm.clear();
10205
		
10205
 
10206
		//初始化設置好 confirm dialog 後要觸發的函式
10206
		//初始化設置好 confirm dialog 後要觸發的函式
10207
		window.qbpwcf.dialog.confirm.prepareCallback=function(){
10207
		window.qbpwcf.dialog.confirm.prepareCallback=function(){
10208
		
10208
 
10209
			//取得 cancel 的按鈕
10209
			//取得 cancel 的按鈕
10210
			var cancel_btn=document.querySelector('button#dialog_cancel_btn');
10210
			var cancel_btn=document.querySelector('button#dialog_cancel_btn');
10211
		
10211
 
10212
			//按鈕的事件
10212
			//按鈕的事件
10213
			cancel_btn.addEventListener('click',function(){
10213
			cancel_btn.addEventListener('click',function(){
10214
			
10214
 
10215
				//設置結果為 'false'
10215
				//設置結果為 'false'
10216
				window.qbpwcf.dialog.confirm.result='false';
10216
				window.qbpwcf.dialog.confirm.result='false';
10217
			
10217
 
10218
				//關閉dialog
10218
				//關閉dialog
10219
				window.qbpwcf.dialog.confirm.instance.close();
10219
				window.qbpwcf.dialog.confirm.instance.close();
10220
			
10220
 
10221
				});
10221
				});
10222
		
10222
 
10223
			//取得 confirm 的按鈕
10223
			//取得 confirm 的按鈕
10224
			var confirm_btn=document.querySelector('button#dialog_confirm_btn');
10224
			var confirm_btn=document.querySelector('button#dialog_confirm_btn');
10225
		
10225
 
10226
			//按鈕的事件
10226
			//按鈕的事件
10227
			confirm_btn.addEventListener('click',function(){
10227
			confirm_btn.addEventListener('click',function(){
10228
			
10228
 
10229
				//設置結果為 'true'
10229
				//設置結果為 'true'
10230
				window.qbpwcf.dialog.confirm.result='true';
10230
				window.qbpwcf.dialog.confirm.result='true';
10231
			
10231
 
10232
				//關閉dialog
10232
				//關閉dialog
10233
				window.qbpwcf.dialog.confirm.instance.close();
10233
				window.qbpwcf.dialog.confirm.instance.close();
10234
			
10234
 
10235
				});
10235
				});
10236
		
10236
 
10237
			}//function end
10237
			}//function end
10238
			
10238
 
10239
		/*
10239
		/*
10240
		初始化關閉 confirm dialog 後要觸發的函式
10240
		初始化關閉 confirm dialog 後要觸發的函式
10241
		params為取得的內容結果.
10241
		params為取得的內容結果.
10242
		*/
10242
		*/
10243
		window.qbpwcf.dialog.confirm.closeCallback=function(params){
10243
		window.qbpwcf.dialog.confirm.closeCallback=function(params){
10244
		
10244
 
10245
			//debug
10245
			//debug
10246
			console.log(params);
10246
			console.log(params);
10247
		
10247
 
10248
			}//fucntion end
10248
			}//fucntion end
10249
			
10249
 
10250
		//顯示 confirm dialog
10250
		//顯示 confirm dialog
10251
		window.qbpwcf.dialog.confirm.func=function(){
10251
		window.qbpwcf.dialog.confirm.func=function(){
10252
		
10252
 
10253
			//回傳 Promise
10253
			//回傳 Promise
10254
			return new Promise(function(resolve, reject){
10254
			return new Promise(function(resolve, reject){
10255
			
10255
 
10256
				//建立dialog物件
10256
				//建立dialog物件
10257
				var dialog=document.createElement('dialog');
10257
				var dialog=document.createElement('dialog');
10258
				
10258
 
10259
				//取得參考
10259
				//取得參考
10260
				window.qbpwcf.dialog.confirm.instance=dialog;
10260
				window.qbpwcf.dialog.confirm.instance=dialog;
10261
				
10261
 
10262
				//dialog的確認內容
10262
				//dialog的確認內容
10263
				var dialogConfirmText=document.createTextNode(window.qbpwcf.dialog.confirm.text);
10263
				var dialogConfirmText=document.createTextNode(window.qbpwcf.dialog.confirm.text);
10264
				
10264
 
10265
				//建立放置按鈕的div
10265
				//建立放置按鈕的div
10266
				var divDialogButton=document.createElement('div');
10266
				var divDialogButton=document.createElement('div');
10267
				
10267
 
10268
				//建立放置取消按鈕的span
10268
				//建立放置取消按鈕的span
10269
				var spanCancelButton=document.createElement('span');
10269
				var spanCancelButton=document.createElement('span');
10270
				
10270
 
10271
				//設置取消按鈕靠左對齊
10271
				//設置取消按鈕靠左對齊
10272
				spanCancelButton.style.float='left';
10272
				spanCancelButton.style.float='left';
10273
				
10273
 
10274
				//建立dialog cancel按鈕
10274
				//建立dialog cancel按鈕
10275
				var buttonDialogCancel=document.createElement('button');
10275
				var buttonDialogCancel=document.createElement('button');
10276
				
10276
 
10277
				//設置dialog cancel按鈕的id
10277
				//設置dialog cancel按鈕的id
10278
				buttonDialogCancel.id='dialog_cancel_btn';
10278
				buttonDialogCancel.id='dialog_cancel_btn';
10279
				
10279
 
10280
				//設置dialog cancel按鈕的文字內容
10280
				//設置dialog cancel按鈕的文字內容
10281
				buttonDialogCancel.innerText=window.qbpwcf.dialog.confirm.cancelBtnText;
10281
				buttonDialogCancel.innerText=window.qbpwcf.dialog.confirm.cancelBtnText;
10282
				
10282
 
10283
				//將取消按鈕放置到span
10283
				//將取消按鈕放置到span
10284
				spanCancelButton.appendChild(buttonDialogCancel);
10284
				spanCancelButton.appendChild(buttonDialogCancel);
10285
				
10285
 
10286
				//放置取消按鈕span到div
10286
				//放置取消按鈕span到div
10287
				divDialogButton.append(spanCancelButton);
10287
				divDialogButton.append(spanCancelButton);
10288
				
10288
 
10289
				//建立放置確認按鈕的span
10289
				//建立放置確認按鈕的span
10290
				var spanConfirmButton=document.createElement('span');
10290
				var spanConfirmButton=document.createElement('span');
10291
				
10291
 
10292
				//設置確認按鈕靠右對齊
10292
				//設置確認按鈕靠右對齊
10293
				spanConfirmButton.style.float='right';
10293
				spanConfirmButton.style.float='right';
10294
				
10294
 
10295
				//建立dialog confirm按鈕
10295
				//建立dialog confirm按鈕
10296
				var buttonDialogConfirm=document.createElement('button');
10296
				var buttonDialogConfirm=document.createElement('button');
10297
				
10297
 
10298
				//設置dialog confirm按鈕的id
10298
				//設置dialog confirm按鈕的id
10299
				buttonDialogConfirm.id='dialog_confirm_btn';
10299
				buttonDialogConfirm.id='dialog_confirm_btn';
10300
				
10300
 
10301
				//設置dialog confirm按鈕的文字內容
10301
				//設置dialog confirm按鈕的文字內容
10302
				buttonDialogConfirm.innerText=window.qbpwcf.dialog.confirm.okBtnText;
10302
				buttonDialogConfirm.innerText=window.qbpwcf.dialog.confirm.okBtnText;
10303
				
10303
 
10304
				//將確認鈕放置到span
10304
				//將確認鈕放置到span
10305
				spanConfirmButton.appendChild(buttonDialogConfirm);
10305
				spanConfirmButton.appendChild(buttonDialogConfirm);
10306
				
10306
 
10307
				//放置確認按鈕span到div
10307
				//放置確認按鈕span到div
10308
				divDialogButton.append(spanConfirmButton);
10308
				divDialogButton.append(spanConfirmButton);
10309
				
10309
 
10310
				//建立要作為dialog內容的div
10310
				//建立要作為dialog內容的div
10311
				var divDialogConent=document.createElement('div');
10311
				var divDialogConent=document.createElement('div');
10312
				
10312
 
10313
				//建立dialog確認內容的div
10313
				//建立dialog確認內容的div
10314
				var divDialogConfrimText=document.createElement('div');
10314
				var divDialogConfrimText=document.createElement('div');
10315
				
10315
 
10316
				//設置dialog確認內容的文字要置中
10316
				//設置dialog確認內容的文字要置中
10317
				divDialogConfrimText.style.textAlign='center';
10317
				divDialogConfrimText.style.textAlign='center';
10318
				
10318
 
10319
				//設置dialog確認內容的文字
10319
				//設置dialog確認內容的文字
10320
				divDialogConfrimText.appendChild(dialogConfirmText);
10320
				divDialogConfrimText.appendChild(dialogConfirmText);
10321
				
10321
 
10322
				//放置dialog的確認內容
10322
				//放置dialog的確認內容
10323
				divDialogConent.appendChild(divDialogConfrimText);
10323
				divDialogConent.appendChild(divDialogConfrimText);
10324
				
10324
 
10325
				//放置dialog的按鈕
10325
				//放置dialog的按鈕
10326
				divDialogConent.appendChild(divDialogButton);
10326
				divDialogConent.appendChild(divDialogButton);
10327
				
10327
 
10328
				//如果有指定 dom 內容
10328
				//如果有指定 dom 內容
10329
				if(window.qbpwcf.dialog.confirm.customDom.outerHTML!=undefined){
10329
				if(window.qbpwcf.dialog.confirm.customDom.outerHTML!=undefined){
10330
				
10330
 
10331
					//建立 div
10331
					//建立 div
10332
					var div=document.createElement('div');
10332
					var div=document.createElement('div');
10333
				
10333
 
10334
					//將dom放置到div裡面
10334
					//將dom放置到div裡面
10335
					div.appendChild(window.qbpwcf.dialog.confirm.customDom);
10335
					div.appendChild(window.qbpwcf.dialog.confirm.customDom);
10336
				
10336
 
10337
					//設置 div dom 內容在前
10337
					//設置 div dom 內容在前
10338
					divDialogConent.prepend(div);
10338
					divDialogConent.prepend(div);
10339
				
10339
 
10340
					}//if end
10340
					}//if end
10341
				
10341
 
10342
				//更新 confirm dialog 的內容
10342
				//更新 confirm dialog 的內容
10343
				window.qbpwcf.dialog.confirm.content=divDialogConent;
10343
				window.qbpwcf.dialog.confirm.content=divDialogConent;
10344
				
10344
 
10345
				//設置dialog的內容
10345
				//設置dialog的內容
10346
				dialog.appendChild(window.qbpwcf.dialog.confirm.content);
10346
				dialog.appendChild(window.qbpwcf.dialog.confirm.content);
10347
									
10347
 
10348
				//設置id
10348
				//設置id
10349
				dialog.id='qbpwcf_dialog';
10349
				dialog.id='qbpwcf_dialog';
10350
			
10350
 
10351
				//放置dialog
10351
				//放置dialog
10352
				document.body.appendChild(dialog);
10352
				document.body.appendChild(dialog);
10353
				
10353
 
10354
				//呼叫 window.qbpwcf.dialog.confirm.prepareCallback
10354
				//呼叫 window.qbpwcf.dialog.confirm.prepareCallback
10355
				window.qbpwcf.dialog.confirm.prepareCallback.call(this);
10355
				window.qbpwcf.dialog.confirm.prepareCallback.call(this);
10356
			
10356
 
10357
				//取得dialog
10357
				//取得dialog
10358
				var qbpwcf_dialog=document.querySelector('dialog#qbpwcf_dialog');
10358
				var qbpwcf_dialog=document.querySelector('dialog#qbpwcf_dialog');
10359
				
10359
 
10360
				//顯示modal
10360
				//顯示modal
10361
				qbpwcf_dialog.showModal();
10361
				qbpwcf_dialog.showModal();
10362
			
10362
 
10363
				//當dialog關閉時觸發
10363
				//當dialog關閉時觸發
10364
				qbpwcf_dialog.addEventListener('close',function(event){
10364
				qbpwcf_dialog.addEventListener('close',function(event){
10365
				
10365
 
10366
					//取得dialog回傳的結果
10366
					//取得dialog回傳的結果
10367
					var result=window.qbpwcf.dialog.confirm.result;
10367
					var result=window.qbpwcf.dialog.confirm.result;
10368
				
10368
 
10369
					//將回傳結果交給函式 window.qbpwcf.dialog.confirm.callback處理
10369
					//將回傳結果交給函式 window.qbpwcf.dialog.confirm.callback處理
10370
					window.qbpwcf.dialog.confirm.closeCallback.call(this,result);
10370
					window.qbpwcf.dialog.confirm.closeCallback.call(this,result);
10371
					
10371
 
10372
					//回傳結果給Promise
10372
					//回傳結果給Promise
10373
					resolve(result);
10373
					resolve(result);
10374
					
10374
 
10375
					//移除dialog元素
10375
					//移除dialog元素
10376
					qbpwcf_dialog.remove();
10376
					qbpwcf_dialog.remove();
10377
				
10377
 
10378
					});
10378
					});
10379
			
10379
 
10380
				});
10380
				});
10381
		
10381
 
10382
			}//function end
10382
			}//function end
10383
		
10383
 
10384
		/*
10384
		/*
10385
		用dialog取得密碼.
10385
		用dialog取得密碼.
10386
		*/
10386
		*/
10387
		//初始化儲存 getPassword dialog 的物件
10387
		//初始化儲存 getPassword dialog 的物件
10388
		window.qbpwcf.dialog.getPassword={};
10388
		window.qbpwcf.dialog.getPassword={};
10389
		
10389
 
10390
		//初始化儲存 getPassword dialog 的實體
10390
		//初始化儲存 getPassword dialog 的實體
10391
		window.qbpwcf.dialog.getPassword.instance=null;
10391
		window.qbpwcf.dialog.getPassword.instance=null;
10392
		
10392
 
10393
		//初始化儲存 getPassword dialog 結束後取得的內容
10393
		//初始化儲存 getPassword dialog 結束後取得的內容
10394
		window.qbpwcf.dialog.getPassword.result={};
10394
		window.qbpwcf.dialog.getPassword.result={};
10395
		
10395
 
10396
		//初始化儲存 getPassword dialog 確認輸入的按鈕顯示文字
10396
		//初始化儲存 getPassword dialog 確認輸入的按鈕顯示文字
10397
		window.qbpwcf.dialog.getPassword.text='Next';
10397
		window.qbpwcf.dialog.getPassword.text='Next';
10398
		
10398
 
10399
		//初始化getPassword dialog的內容
10399
		//初始化getPassword dialog的內容
10400
		window.qbpwcf.dialog.getPassword.content='';
10400
		window.qbpwcf.dialog.getPassword.content='';
10401
		
10401
 
10402
		//初始化設置好getPassword dialog內容要觸發的函式
10402
		//初始化設置好getPassword dialog內容要觸發的函式
10403
		window.qbpwcf.dialog.getPassword.prepareCallback=function(){
10403
		window.qbpwcf.dialog.getPassword.prepareCallback=function(){
10404
		
10404
 
10405
			//取得輸入的密碼
10405
			//取得輸入的密碼
10406
			var password=document.querySelector('input#dialog_pass');
10406
			var password=document.querySelector('input#dialog_pass');
10407
		
10407
 
10408
			//如果輸入內容改變
10408
			//如果輸入內容改變
10409
			password.addEventListener('change',function(){
10409
			password.addEventListener('change',function(){
10410
			
10410
 
10411
				//儲存輸入的密碼
10411
				//儲存輸入的密碼
10412
				window.qbpwcf.dialog.getPassword.result=password.value;
10412
				window.qbpwcf.dialog.getPassword.result=password.value;
10413
			
10413
 
10414
				});
10414
				});
10415
		
10415
 
10416
			//取得關閉的按鈕
10416
			//取得關閉的按鈕
10417
			var closeBtn=document.querySelector('button#dialog_btn');
10417
			var closeBtn=document.querySelector('button#dialog_btn');
10418
		
10418
 
10419
			//關閉按鈕的事件
10419
			//關閉按鈕的事件
10420
			closeBtn.addEventListener('click',function(){
10420
			closeBtn.addEventListener('click',function(){
10421
			
10421
 
10422
				//關閉dialog
10422
				//關閉dialog
10423
				window.qbpwcf.dialog.getPassword.instance.close();
10423
				window.qbpwcf.dialog.getPassword.instance.close();
10424
			
10424
 
10425
				});
10425
				});
10426
		
10426
 
10427
			}//function end
10427
			}//function end
10428
		
10428
 
10429
		/*
10429
		/*
10430
		初始化關閉getPassword dialog後要觸發的函式
10430
		初始化關閉getPassword dialog後要觸發的函式
10431
		params為取得的內容結果.
10431
		params為取得的內容結果.
10432
		*/
10432
		*/
10433
		window.qbpwcf.dialog.getPassword.closeCallback=function(params){
10433
		window.qbpwcf.dialog.getPassword.closeCallback=function(params){
10434
		
10434
 
10435
			//debug
10435
			//debug
10436
			console.log(params);
10436
			console.log(params);
10437
		
10437
 
10438
			}//fucntion end
10438
			}//fucntion end
10439
		
10439
 
10440
		//顯示 getPassword dialog
10440
		//顯示 getPassword dialog
10441
		window.qbpwcf.dialog.getPassword.func=function(){
10441
		window.qbpwcf.dialog.getPassword.func=function(){
10442
		
10442
 
10443
			//建立dialog物件
10443
			//建立dialog物件
10444
			var dialog=document.createElement('dialog');
10444
			var dialog=document.createElement('dialog');
10445
			
10445
 
10446
			//取得參考
10446
			//取得參考
10447
			window.qbpwcf.dialog.getPassword.instance=dialog;
10447
			window.qbpwcf.dialog.getPassword.instance=dialog;
10448
			
10448
 
10449
			//更新 dialog 的內容
10449
			//更新 dialog 的內容
10450
			window.qbpwcf.dialog.getPassword.content='<input type=\'password\' value=\'\' autocomplete=\'off\' id=\'dialog_pass\'><button id=\'dialog_btn\'>'+window.qbpwcf.dialog.getPassword.text+'</button>';
10450
			window.qbpwcf.dialog.getPassword.content='<input type=\'password\' value=\'\' autocomplete=\'off\' id=\'dialog_pass\'><button id=\'dialog_btn\'>'+window.qbpwcf.dialog.getPassword.text+'</button>';
10451
					
10451
 
10452
			//設置dialog的內容
10452
			//設置dialog的內容
10453
			dialog.innerHTML=window.qbpwcf.dialog.getPassword.content;
10453
			dialog.innerHTML=window.qbpwcf.dialog.getPassword.content;
10454
						
10454
 
10455
			//設置id
10455
			//設置id
10456
			dialog.id='qbpwcf_dialog';
10456
			dialog.id='qbpwcf_dialog';
10457
		
10457
 
10458
			//放置dialog
10458
			//放置dialog
10459
			document.body.appendChild(dialog);
10459
			document.body.appendChild(dialog);
10460
			
10460
 
10461
			//呼叫 window.qbpwcf.dialog.getPassword.prepareCallback
10461
			//呼叫 window.qbpwcf.dialog.getPassword.prepareCallback
10462
			window.qbpwcf.dialog.getPassword.prepareCallback.call(this);
10462
			window.qbpwcf.dialog.getPassword.prepareCallback.call(this);
10463
		
10463
 
10464
			//取得dialog
10464
			//取得dialog
10465
			var qbpwcf_dialog=document.querySelector('dialog#qbpwcf_dialog');
10465
			var qbpwcf_dialog=document.querySelector('dialog#qbpwcf_dialog');
10466
			
10466
 
10467
			//顯示modal
10467
			//顯示modal
10468
			qbpwcf_dialog.showModal();
10468
			qbpwcf_dialog.showModal();
10469
		
10469
 
10470
			//當dialog關閉時觸發
10470
			//當dialog關閉時觸發
10471
			qbpwcf_dialog.addEventListener('close',function(event){
10471
			qbpwcf_dialog.addEventListener('close',function(event){
10472
			
10472
 
10473
				//取得輸入的密碼
10473
				//取得輸入的密碼
10474
				var password=document.querySelector('input#dialog_pass');
10474
				var password=document.querySelector('input#dialog_pass');
10475
		
10475
 
10476
				//儲存輸入的密碼
10476
				//儲存輸入的密碼
10477
				window.qbpwcf.dialog.getPassword.result=password.value;
10477
				window.qbpwcf.dialog.getPassword.result=password.value;
10478
			
10478
 
10479
				//取得dialog回傳的結果
10479
				//取得dialog回傳的結果
10480
				var result=window.qbpwcf.dialog.getPassword.result;
10480
				var result=window.qbpwcf.dialog.getPassword.result;
10481
			
10481
 
10482
				//將回傳結果交給函式 window.qbpwcf.dialog.getPassword.callback處理
10482
				//將回傳結果交給函式 window.qbpwcf.dialog.getPassword.callback處理
10483
				window.qbpwcf.dialog.getPassword.closeCallback.call(this,result);
10483
				window.qbpwcf.dialog.getPassword.closeCallback.call(this,result);
10484
				
10484
 
10485
				//移除dialog元素
10485
				//移除dialog元素
10486
				qbpwcf_dialog.remove();
10486
				qbpwcf_dialog.remove();
10487
			
10487
 
10488
				});
10488
				});
10489
			
10489
 
10490
			}//function end
10490
			}//function end
10491
		";
10491
		";
10492
		
10492
 
10493
		#js function
10493
		#js function
10494
		$conf["javaScript::toScript"]["jsFunciton"][]=
10494
		$conf["javaScript::toScript"]["jsFunciton"][]=
10495
		"
10495
		"
10496
		/*
10496
		/*
10497
		說明:
10497
		說明:
10498
		sleep
10498
		sleep
10499
		*/
10499
		*/
10500
		
10500
 
10501
		//初始化
10501
		//初始化
10502
		window.qbpwcf.sleep={};
10502
		window.qbpwcf.sleep={};
10503
		
10503
 
10504
		//執行的定義
10504
		//執行的定義
10505
		//參數sec代表要sleep多久,單位為秒.
10505
		//參數sec代表要sleep多久,單位為秒.
10506
		window.qbpwcf.sleep.func=function(sec){
10506
		window.qbpwcf.sleep.func=function(sec){
10507
		
10507
 
10508
			//回傳 Promise
10508
			//回傳 Promise
10509
			return new Promise(resolve => {
10509
			return new Promise(resolve => {
10510
				
10510
 
10511
				//sec秒後才會結束
10511
				//sec秒後才會結束
10512
				setTimeout(() => {
10512
				setTimeout(() => {
10513
					
10513
 
10514
					resolve(sec);
10514
					resolve(sec);
10515
					
10515
 
10516
					}, sec*1000);
10516
					}, sec*1000);
10517
				
10517
 
10518
				});
10518
				});
10519
		
10519
 
10520
			}//window.qbpwcf.sleep.func end
10520
			}//window.qbpwcf.sleep.func end
10521
		";
10521
		";
10522
		
10522
 
10523
		#js function
10523
		#js function
10524
		$conf["javaScript::toScript"]["jsFunciton"][]=
10524
		$conf["javaScript::toScript"]["jsFunciton"][]=
10525
		"
10525
		"
10526
		/*
10526
		/*
10527
		說明:
10527
		說明:
10528
		slide,輪播任何東西.
10528
		slide,輪播任何東西.
10529
		*/
10529
		*/
10530
		
10530
 
10531
		//初始化
10531
		//初始化
10532
		window.qbpwcf.slide={};
10532
		window.qbpwcf.slide={};
10533
		
10533
 
10534
		//初始化要播放的內容 html、css、javaScript 字串.
10534
		//初始化要播放的內容 html、css、javaScript 字串.
10535
		//https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Unterminated_string_literal
10535
		//https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Unterminated_string_literal
10536
		window.qbpwcf.slide.eles=[];
10536
		window.qbpwcf.slide.eles=[];
10537
		
10537
 
10538
		//初始化放置投影片的div區域
10538
		//初始化放置投影片的div區域
10539
		window.qbpwcf.slide.displayDivByQuerySelector='div#slide';
10539
		window.qbpwcf.slide.displayDivByQuerySelector='div#slide';
10540
		
10540
 
10541
		//初始化投影片的滯留時間,預設為3秒,時間到就換下一個投影片.
10541
		//初始化投影片的滯留時間,預設為3秒,時間到就換下一個投影片.
10542
		window.qbpwcf.slide.showTime=3;
10542
		window.qbpwcf.slide.showTime=3;
10543
		
10543
 
10544
		//說明:
10544
		//說明:
10545
		//將 html、css、javaScript 轉換為 dom
10545
		//將 html、css、javaScript 轉換為 dom
10546
		//參數:
10546
		//參數:
10547
		//htmlStr 內容必須有此結構 html > body > div > anyTag(content to show)
10547
		//htmlStr 內容必須有此結構 html > body > div > anyTag(content to show)
10548
		window.qbpwcf.slide.toDom=function(htmlStr){
10548
		window.qbpwcf.slide.toDom=function(htmlStr){
10549
		
10549
 
10550
			//回傳 Promise
10550
			//回傳 Promise
10551
			return new Promise(resolve => {
10551
			return new Promise(resolve => {
10552
				
10552
 
10553
				//debug
10553
				//debug
10554
				//console.log(htmlStr);
10554
				//console.log(htmlStr);
10555
				
10555
 
10556
				//initial DOMParser
10556
				//initial DOMParser
10557
				var domParser = new DOMParser();
10557
				var domParser = new DOMParser();
10558
				
10558
 
10559
				//確保內容格式正確,若為影片,則播放結束後才會結束.
10559
				//確保內容格式正確,若為影片,則播放結束後才會結束.
10560
				
10560
 
10561
				//script start
10561
				//script start
10562
				htmlStr=htmlStr+'\<script\>';
10562
				htmlStr=htmlStr+'\<script\>';
10563
				
10563
 
10564
				//綁定 load 事件
10564
				//綁定 load 事件
10565
				htmlStr=htmlStr+'window.addEventListener(\'load\',function(event){';
10565
				htmlStr=htmlStr+'window.addEventListener(\'load\',function(event){';
10566
				
10566
 
10567
				//debug
10567
				//debug
10568
				//htmlStr=htmlStr+'console.log(document.querySelector(\'div\'));';
10568
				//htmlStr=htmlStr+'console.log(document.querySelector(\'div\'));';
10569
				
10569
 
10570
				//取得第一個div
10570
				//取得第一個div
10571
				htmlStr=htmlStr+'var containerDiv=document.querySelector(\'div\');';
10571
				htmlStr=htmlStr+'var containerDiv=document.querySelector(\'div\');';
10572
				
10572
 
10573
				//debug
10573
				//debug
10574
				//htmlStr=htmlStr+'console.log(event);';
10574
				//htmlStr=htmlStr+'console.log(event);';
10575
				//htmlStr=htmlStr+'console.log(containerDiv);';
10575
				//htmlStr=htmlStr+'console.log(containerDiv);';
10576
				
10576
 
10577
				//如果不存在,則提示錯誤
10577
				//如果不存在,則提示錯誤
10578
				htmlStr=htmlStr+'if(containerDiv===null){console.error(\'containerDiv div not exixt\');}';
10578
				htmlStr=htmlStr+'if(containerDiv===null){console.error(\'containerDiv div not exixt\');}';
10579
				
10579
 
10580
				//設置container div 的 id 為 window_qbpwcf_slide
10580
				//設置container div 的 id 為 window_qbpwcf_slide
10581
				htmlStr=htmlStr+'containerDiv.id=\'window_qbpwcf_slide\';';
10581
				htmlStr=htmlStr+'containerDiv.id=\'window_qbpwcf_slide\';';
10582
				
10582
 
10583
				//設置container div 為背景 
10583
				//設置container div 為背景
10584
				htmlStr=htmlStr+'containerDiv.style.zIndex=-1;';
10584
				htmlStr=htmlStr+'containerDiv.style.zIndex=-1;';
10585
				
10585
 
10586
				//設置container div 為透明
10586
				//設置container div 為透明
10587
				htmlStr=htmlStr+'containerDiv.style.opacity=0;';
10587
				htmlStr=htmlStr+'containerDiv.style.opacity=0;';
10588
				
10588
 
10589
				//設置container div 為相對位置
10589
				//設置container div 為相對位置
10590
				htmlStr=htmlStr+'containerDiv.style.position=\'absolute\';';
10590
				htmlStr=htmlStr+'containerDiv.style.position=\'absolute\';';
10591
				
10591
 
10592
				//設置最小寬度跟父元素一樣
10592
				//設置最小寬度跟父元素一樣
10593
				htmlStr=htmlStr+'containerDiv.style.minWidth=\'inherit\';';
10593
				htmlStr=htmlStr+'containerDiv.style.minWidth=\'inherit\';';
10594
				
10594
 
10595
				//設置最大寬度跟父元素一樣
10595
				//設置最大寬度跟父元素一樣
10596
				htmlStr=htmlStr+'containerDiv.style.maxWidth=\'inherit\';';
10596
				htmlStr=htmlStr+'containerDiv.style.maxWidth=\'inherit\';';
10597
				
10597
 
10598
				//設置最小高度跟父元素一樣
10598
				//設置最小高度跟父元素一樣
10599
				htmlStr=htmlStr+'containerDiv.style.minHeight=\'inherit\';';
10599
				htmlStr=htmlStr+'containerDiv.style.minHeight=\'inherit\';';
10600
				
10600
 
10601
				//設置最大高度跟父元素一樣
10601
				//設置最大高度跟父元素一樣
10602
				htmlStr=htmlStr+'containerDiv.style.maxHeight=\'inherit\';';
10602
				htmlStr=htmlStr+'containerDiv.style.maxHeight=\'inherit\';';
10603
				
10603
 
10604
				//如果有里層元素 - start
10604
				//如果有里層元素 - start
10605
				htmlStr=htmlStr+'if(containerDiv.children.length!==0){';
10605
				htmlStr=htmlStr+'if(containerDiv.children.length!==0){';
10606
				
10606
 
10607
				//設置最小寬度跟父元素一樣
10607
				//設置最小寬度跟父元素一樣
10608
				htmlStr=htmlStr+'containerDiv.children[0].style.minWidth=\'inherit\';';
10608
				htmlStr=htmlStr+'containerDiv.children[0].style.minWidth=\'inherit\';';
10609
				
10609
 
10610
				//設置最大寬度跟父元素一樣
10610
				//設置最大寬度跟父元素一樣
10611
				htmlStr=htmlStr+'containerDiv.children[0].style.maxWidth=\'inherit\';';
10611
				htmlStr=htmlStr+'containerDiv.children[0].style.maxWidth=\'inherit\';';
10612
				
10612
 
10613
				//設置最小高度跟父元素一樣
10613
				//設置最小高度跟父元素一樣
10614
				htmlStr=htmlStr+'containerDiv.children[0].style.minHeight=\'inherit\';';
10614
				htmlStr=htmlStr+'containerDiv.children[0].style.minHeight=\'inherit\';';
10615
				
10615
 
10616
				//設置最大高度跟父元素一樣
10616
				//設置最大高度跟父元素一樣
10617
				htmlStr=htmlStr+'containerDiv.children[0].style.maxHeight=\'inherit\';';
10617
				htmlStr=htmlStr+'containerDiv.children[0].style.maxHeight=\'inherit\';';
10618
				
10618
 
10619
				//取得要呈現的內容
10619
				//取得要呈現的內容
10620
				htmlStr=htmlStr+'var contentToShow=containerDiv.children[0];';
10620
				htmlStr=htmlStr+'var contentToShow=containerDiv.children[0];';
10621
				
10621
 
10622
				//如果有里層元素 - end
10622
				//如果有里層元素 - end
10623
				htmlStr=htmlStr+'}';
10623
				htmlStr=htmlStr+'}';
10624
				
10624
 
10625
				//反之裡層不為element,可能為textNode - start
10625
				//反之裡層不為element,可能為textNode - start
10626
				htmlStr=htmlStr+'else{';
10626
				htmlStr=htmlStr+'else{';
10627
				
10627
 
10628
				//取得要呈現的內容
10628
				//取得要呈現的內容
10629
				htmlStr=htmlStr+'var contentToShow=containerDiv.childNodes[0];';
10629
				htmlStr=htmlStr+'var contentToShow=containerDiv.childNodes[0];';
10630
				
10630
 
10631
				//設置內容左右置中
10631
				//設置內容左右置中
10632
				htmlStr=htmlStr+'containerDiv.style.textAlign=\'center\';';
10632
				htmlStr=htmlStr+'containerDiv.style.textAlign=\'center\';';
10633
				
10633
 
10634
				//設置內容高度為 100vh
10634
				//設置內容高度為 100vh
10635
				htmlStr=htmlStr+'containerDiv.style.lineHeight=\'100vh\';';
10635
				htmlStr=htmlStr+'containerDiv.style.lineHeight=\'100vh\';';
10636
				
10636
 
10637
				//反之裡層不為element,可能為textNode - end
10637
				//反之裡層不為element,可能為textNode - end
10638
				htmlStr=htmlStr+'}';
10638
				htmlStr=htmlStr+'}';
10639
				
10639
 
10640
				//若內容是不為video,設置可立即換頁.
10640
				//若內容是不為video,設置可立即換頁.
10641
				htmlStr=htmlStr+'if(contentToShow.tagName!==\'VIDEO\'){containerDiv.dataset.canChangeNow=true;}';
10641
				htmlStr=htmlStr+'if(contentToShow.tagName!==\'VIDEO\'){containerDiv.dataset.canChangeNow=true;}';
10642
								
10642
 
10643
				//反之內容為video
10643
				//反之內容為video
10644
				htmlStr=htmlStr+'else{';
10644
				htmlStr=htmlStr+'else{';
10645
				
10645
 
10646
				//設置不可立即換頁
10646
				//設置不可立即換頁
10647
				htmlStr=htmlStr+'containerDiv.dataset.canChangeNow=false;';
10647
				htmlStr=htmlStr+'containerDiv.dataset.canChangeNow=false;';
10648
				
10648
 
10649
				//設置影片靜音
10649
				//設置影片靜音
10650
				htmlStr=htmlStr+'contentToShow.muted=true;';
10650
				htmlStr=htmlStr+'contentToShow.muted=true;';
10651
				
10651
 
10652
				//禁止影片自動播放
10652
				//禁止影片自動播放
10653
				htmlStr=htmlStr+'contentToShow.autoplay=false;';
10653
				htmlStr=htmlStr+'contentToShow.autoplay=false;';
10654
				
10654
 
10655
				//新增影片播放完之後的事件
10655
				//新增影片播放完之後的事件
10656
				htmlStr=htmlStr+'contentToShow.addEventListener(\'ended\',function(){';
10656
				htmlStr=htmlStr+'contentToShow.addEventListener(\'ended\',function(){';
10657
				
10657
 
10658
				//設置可立即換頁
10658
				//設置可立即換頁
10659
				htmlStr=htmlStr+'containerDiv.dataset.canChangeNow=true;';
10659
				htmlStr=htmlStr+'containerDiv.dataset.canChangeNow=true;';
10660
				
10660
 
10661
				//ended 事件結束
10661
				//ended 事件結束
10662
				htmlStr=htmlStr+'});';
10662
				htmlStr=htmlStr+'});';
10663
				
10663
 
10664
				//else end
10664
				//else end
10665
				htmlStr=htmlStr+'}';
10665
				htmlStr=htmlStr+'}';
10666
				
10666
 
10667
				//若內容是img,設置按照比例自動縮放
10667
				//若內容是img,設置按照比例自動縮放
10668
				//https://code-boxx.com/keep-image-aspect-ratio/
10668
				//https://code-boxx.com/keep-image-aspect-ratio/
10669
				htmlStr=htmlStr+'if(contentToShow.tagName===\'IMG\'){contentToShow.style.objectFit=\'scale-down\';}';
10669
				htmlStr=htmlStr+'if(contentToShow.tagName===\'IMG\'){contentToShow.style.objectFit=\'scale-down\';}';
10670
								
10670
 
10671
				//load 事件結束
10671
				//load 事件結束
10672
				htmlStr=htmlStr+'});';				
10672
				htmlStr=htmlStr+'});';
10673
								
10673
 
10674
				//script end
10674
				//script end
10675
				htmlStr=htmlStr+'\</script\>';
10675
				htmlStr=htmlStr+'\</script\>';
10676
				
10676
 
10677
				//html to dom
10677
				//html to dom
10678
				var dom=domParser.parseFromString(htmlStr,'text/html');
10678
				var dom=domParser.parseFromString(htmlStr,'text/html');
10679
				
10679
 
10680
				//回傳轉成 dom 的 html
10680
				//回傳轉成 dom 的 html
10681
				resolve(dom.documentElement);
10681
				resolve(dom.documentElement);
10682
								
10682
 
10683
				});
10683
				});
10684
		
10684
 
10685
			}//window.qbpwcf.slide.toDom end
10685
			}//window.qbpwcf.slide.toDom end
10686
		
10686
 
10687
		//將多個 html、css、javaScript 轉換為 dom
10687
		//將多個 html、css、javaScript 轉換為 dom
10688
		window.qbpwcf.slide.toDoms=function(htmlStrArray){
10688
		window.qbpwcf.slide.toDoms=function(htmlStrArray){
10689
		
10689
 
10690
			//回傳 Promise
10690
			//回傳 Promise
10691
			return new Promise(resolve => {
10691
			return new Promise(resolve => {
10692
				
10692
 
10693
				//初始化要回傳的內容
10693
				//初始化要回傳的內容
10694
				var doms=[];
10694
				var doms=[];
10695
				
10695
 
10696
				//初始化用來存放排序後的 doms
10696
				//初始化用來存放排序後的 doms
10697
				var tempDoms=[];
10697
				var tempDoms=[];
10698
				
10698
 
10699
				//針對每個要輪播的內容
10699
				//針對每個要輪播的內容
10700
				htmlStrArray.forEach(async function(value,key){
10700
				htmlStrArray.forEach(async function(value,key){
10701
				
10701
 
10702
					//將 html to dom
10702
					//將 html to dom
10703
					var dom=await window.qbpwcf.slide.toDom.call(this,value);
10703
					var dom=await window.qbpwcf.slide.toDom.call(this,value);
10704
					
10704
 
10705
					//記錄排序順序
10705
					//記錄排序順序
10706
					dom.order=key;
10706
					dom.order=key;
10707
					
10707
 
10708
					//保存到 doms 陣列裡面
10708
					//保存到 doms 陣列裡面
10709
					doms.push(dom);
10709
					doms.push(dom);
10710
										
10710
 
10711
					//如果每個都解析成 dom 了
10711
					//如果每個都解析成 dom 了
10712
					if(doms.length===htmlStrArray.length){
10712
					if(doms.length===htmlStrArray.length){
10713
					
10713
 
10714
						//初始化要尋找的索引
10714
						//初始化要尋找的索引
10715
						var indexToFind=0;
10715
						var indexToFind=0;
10716
						
10716
 
10717
						//初始化最後的索引
10717
						//初始化最後的索引
10718
						var maxlidex=htmlStrArray.length-1;
10718
						var maxlidex=htmlStrArray.length-1;
10719
					
10719
 
10720
						//按照 order 重新排序
10720
						//按照 order 重新排序
10721
						for(var i=0;i<=maxlidex;i++){
10721
						for(var i=0;i<=maxlidex;i++){
10722
						
10722
 
10723
							//如果是要找的索引
10723
							//如果是要找的索引
10724
							if(doms[i].order===indexToFind){
10724
							if(doms[i].order===indexToFind){
10725
							
10725
 
10726
								//放置dom
10726
								//放置dom
10727
								tempDoms.push(doms[i]);
10727
								tempDoms.push(doms[i]);
10728
							
10728
 
10729
								//要尋找的索引+1
10729
								//要尋找的索引+1
10730
								indexToFind++;
10730
								indexToFind++;
10731
								
10731
 
10732
								//重新搜尋
10732
								//重新搜尋
10733
								i=-1;
10733
								i=-1;
10734
								
10734
 
10735
								//繼續迴圈
10735
								//繼續迴圈
10736
								continue;
10736
								continue;
10737
							
10737
 
10738
								}//if end
10738
								}//if end
10739
						
10739
 
10740
							}//for end
10740
							}//for end
10741
					
10741
 
10742
						//回傳轉成 dom 的 array
10742
						//回傳轉成 dom 的 array
10743
						resolve(tempDoms);
10743
						resolve(tempDoms);
10744
					
10744
 
10745
						}//if end
10745
						}//if end
10746
				
10746
 
10747
					});//forEach end
10747
					});//forEach end
10748
								
10748
 
10749
				});//回傳 Promise end
10749
				});//回傳 Promise end
10750
		
10750
 
10751
			}//window.qbpwcf.slide.toDoms end
10751
			}//window.qbpwcf.slide.toDoms end
10752
		
10752
 
10753
		//將 dom 給 ifrmae 執行完後,回傳其 document 
10753
		//將 dom 給 ifrmae 執行完後,回傳其 document
10754
		window.qbpwcf.slide.loadDom=function(dom){
10754
		window.qbpwcf.slide.loadDom=function(dom){
10755
		
10755
 
10756
			//回傳 Promise
10756
			//回傳 Promise
10757
			return new Promise(resolve => {
10757
			return new Promise(resolve => {
10758
			
10758
 
10759
				//建立 iframe
10759
				//建立 iframe
10760
				var iframe=document.createElement('iframe');
10760
				var iframe=document.createElement('iframe');
10761
				
10761
 
10762
				//隱藏 iframe
10762
				//隱藏 iframe
10763
				iframe.style.display='none';
10763
				iframe.style.display='none';
10764
				
10764
 
10765
				//放置 iframe
10765
				//放置 iframe
10766
				document.body.appendChild(iframe);
10766
				document.body.appendChild(iframe);
10767
				
10767
 
10768
				//取得 iframe 的 document
10768
				//取得 iframe 的 document
10769
				var documentInIframe=iframe.contentDocument;
10769
				var documentInIframe=iframe.contentDocument;
10770
				
10770
 
10771
				//讓 iframe 開始接收內容
10771
				//讓 iframe 開始接收內容
10772
				documentInIframe.open();
10772
				documentInIframe.open();
10773
				
10773
 
10774
				//綁定 iframe load 事件
10774
				//綁定 iframe load 事件
10775
				iframe.addEventListener('load',function(){
10775
				iframe.addEventListener('load',function(){
10776
					
10776
 
10777
					//回傳 iframe document
10777
					//回傳 iframe document
10778
					resolve(documentInIframe.documentElement);
10778
					resolve(documentInIframe.documentElement);
10779
					
10779
 
10780
					});
10780
					});
10781
					
10781
 
10782
				//讓 iframe 接收指定內容	
10782
				//讓 iframe 接收指定內容
10783
				documentInIframe.write(dom.outerHTML);
10783
				documentInIframe.write(dom.outerHTML);
10784
				
10784
 
10785
				//讓 iframe 結束接收內容
10785
				//讓 iframe 結束接收內容
10786
				documentInIframe.close();
10786
				documentInIframe.close();
10787
				
10787
 
10788
				});//回傳 Promise end
10788
				});//回傳 Promise end
10789
		
10789
 
10790
			}//window.qbpwcf.slide.loadDom end
10790
			}//window.qbpwcf.slide.loadDom end
10791
		
10791
 
10792
		//將多個 dom 給 ifrmae 執行完後,回傳其 document 集合 
10792
		//將多個 dom 給 ifrmae 執行完後,回傳其 document 集合
10793
		window.qbpwcf.slide.loadDoms=function(doms){
10793
		window.qbpwcf.slide.loadDoms=function(doms){
10794
		
10794
 
10795
			//回傳 Promise
10795
			//回傳 Promise
10796
			return new Promise(resolve => {
10796
			return new Promise(resolve => {
10797
			
10797
 
10798
				//初始化儲存 iframe document
10798
				//初始化儲存 iframe document
10799
				var iframeDocs=[];
10799
				var iframeDocs=[];
10800
				
10800
 
10801
				//初始化儲存排序過後的 iframe document
10801
				//初始化儲存排序過後的 iframe document
10802
				var tempIframeDocs=[];
10802
				var tempIframeDocs=[];
10803
				
10803
 
10804
				//針對每個dom
10804
				//針對每個dom
10805
				doms.forEach(async function(value,key){
10805
				doms.forEach(async function(value,key){
10806
								
10806
 
10807
					//取得 iframe document
10807
					//取得 iframe document
10808
					var iframeDoc=await window.qbpwcf.slide.loadDom.call(this,value);
10808
					var iframeDoc=await window.qbpwcf.slide.loadDom.call(this,value);
10809
					
10809
 
10810
					//記錄排序順序
10810
					//記錄排序順序
10811
					iframeDoc.order=key;
10811
					iframeDoc.order=key;
10812
					
10812
 
10813
					//儲存
10813
					//儲存
10814
					iframeDocs.push(iframeDoc);
10814
					iframeDocs.push(iframeDoc);
10815
				
10815
 
10816
					//如果每個都解析成 dom 了
10816
					//如果每個都解析成 dom 了
10817
					if(iframeDocs.length===doms.length){
10817
					if(iframeDocs.length===doms.length){
10818
					
10818
 
10819
						//初始化要尋找的索引
10819
						//初始化要尋找的索引
10820
						var indexToFind=0;
10820
						var indexToFind=0;
10821
						
10821
 
10822
						//初始化最後的索引
10822
						//初始化最後的索引
10823
						var maxlidex=doms.length-1;
10823
						var maxlidex=doms.length-1;
10824
						
10824
 
10825
						//按照 order 重新排序
10825
						//按照 order 重新排序
10826
						for(var i=0;i<=maxlidex;i++){
10826
						for(var i=0;i<=maxlidex;i++){
10827
						
10827
 
10828
							//如果是要找的索引
10828
							//如果是要找的索引
10829
							if(iframeDocs[i].order===indexToFind){
10829
							if(iframeDocs[i].order===indexToFind){
10830
							
10830
 
10831
								//放置iframeDoc
10831
								//放置iframeDoc
10832
								tempIframeDocs.push(iframeDocs[i]);
10832
								tempIframeDocs.push(iframeDocs[i]);
10833
							
10833
 
10834
								//要尋找的索引+1
10834
								//要尋找的索引+1
10835
								indexToFind++;
10835
								indexToFind++;
10836
								
10836
 
10837
								//重新搜尋
10837
								//重新搜尋
10838
								i=-1;
10838
								i=-1;
10839
								
10839
 
10840
								//繼續迴圈
10840
								//繼續迴圈
10841
								continue;
10841
								continue;
10842
							
10842
 
10843
								}//if end
10843
								}//if end
10844
						
10844
 
10845
							}//for end
10845
							}//for end
10846
					
10846
 
10847
						//回傳各個 iframe document
10847
						//回傳各個 iframe document
10848
						resolve(tempIframeDocs);
10848
						resolve(tempIframeDocs);
10849
					
10849
 
10850
						}//if end
10850
						}//if end
10851
				
10851
 
10852
					});//forEach end
10852
					});//forEach end
10853
							
10853
 
10854
				});//回傳 Promise end
10854
				});//回傳 Promise end
10855
				
10855
 
10856
			}//window.qbpwcf.slide.loadDoms end
10856
			}//window.qbpwcf.slide.loadDoms end
10857
		
10857
 
10858
		//執行的定義
10858
		//執行的定義
10859
		window.qbpwcf.slide.func=async function(){
10859
		window.qbpwcf.slide.func=async function(){
10860
			
10860
 
10861
			//取得要輪播的元素
10861
			//取得要輪播的元素
10862
			var eles=window.qbpwcf.slide.eles;
10862
			var eles=window.qbpwcf.slide.eles;
10863
			
10863
 
10864
			//如果沒有要輪播的內容
10864
			//如果沒有要輪播的內容
10865
			if(eles.length===0){
10865
			if(eles.length===0){
10866
			
10866
 
10867
				//提示錯誤訊息
10867
				//提示錯誤訊息
10868
				console.error('Array(window.qbpwcf.slide.eles) should not be empty');
10868
				console.error('Array(window.qbpwcf.slide.eles) should not be empty');
10869
			
10869
 
10870
				//結束執行
10870
				//結束執行
10871
				return false;
10871
				return false;
10872
				
10872
 
10873
				}//if end
10873
				}//if end
10874
			
10874
 
10875
			//取得放置輪播的div QuerySelectorString
10875
			//取得放置輪播的div QuerySelectorString
10876
			var displayDivByQuerySelector=window.qbpwcf.slide.displayDivByQuerySelector;
10876
			var displayDivByQuerySelector=window.qbpwcf.slide.displayDivByQuerySelector;
10877
			
10877
 
10878
			//取得放置輪播的div
10878
			//取得放置輪播的div
10879
			var displayDiv=document.querySelector(displayDivByQuerySelector);
10879
			var displayDiv=document.querySelector(displayDivByQuerySelector);
10880
			
10880
 
10881
			//如果沒有找到放置輪播內容的div
10881
			//如果沒有找到放置輪播內容的div
10882
			if(displayDiv===null){
10882
			if(displayDiv===null){
10883
			
10883
 
10884
				//提示錯誤訊息
10884
				//提示錯誤訊息
10885
				console.error('result of querySelector by '+displayDivByQuerySelector+' is null');
10885
				console.error('result of querySelector by '+displayDivByQuerySelector+' is null');
10886
			
10886
 
10887
				//結束執行
10887
				//結束執行
10888
				return false;
10888
				return false;
10889
			
10889
 
10890
				}//if end
10890
				}//if end
10891
			
10891
 
10892
			//取得每個slide的最小播放時間
10892
			//取得每個slide的最小播放時間
10893
			var showTime=window.qbpwcf.slide.showTime;
10893
			var showTime=window.qbpwcf.slide.showTime;
10894
			
10894
 
10895
			//將輪播內容轉換為doms
10895
			//將輪播內容轉換為doms
10896
			var doms = await window.qbpwcf.slide.toDoms.call(this,eles);
10896
			var doms = await window.qbpwcf.slide.toDoms.call(this,eles);
10897
			
10897
 
10898
			//debug
10898
			//debug
10899
			//console.log(doms);
10899
			//console.log(doms);
10900
			
10900
 
10901
			//取得每個 iframe 的 document
10901
			//取得每個 iframe 的 document
10902
			var iframeDocs = await window.qbpwcf.slide.loadDoms.call(this,doms);
10902
			var iframeDocs = await window.qbpwcf.slide.loadDoms.call(this,doms);
10903
			
10903
 
10904
			//debug
10904
			//debug
10905
			//console.log(iframeDocs);
10905
			//console.log(iframeDocs);
10906
			
10906
 
10907
			//放置讀取好的投影片
10907
			//放置讀取好的投影片
10908
			for(var i=0;i<iframeDocs.length;i++){
10908
			for(var i=0;i<iframeDocs.length;i++){
10909
			
10909
 
10910
				//取得容器 div
10910
				//取得容器 div
10911
				var containerDiv=iframeDocs[i].querySelector('div');
10911
				var containerDiv=iframeDocs[i].querySelector('div');
10912
			
10912
 
10913
				//放置要播放的內容
10913
				//放置要播放的內容
10914
				displayDiv.appendChild(containerDiv);
10914
				displayDiv.appendChild(containerDiv);
10915
			
10915
 
10916
				}//for end
10916
				}//for end
10917
			
10917
 
10918
			//初始化索引為0
10918
			//初始化索引為0
10919
			i=0;
10919
			i=0;
10920
			
10920
 
10921
			//無窮迴圈
10921
			//無窮迴圈
10922
			while(true){
10922
			while(true){
10923
			
10923
 
10924
				//如果目標不存在
10924
				//如果目標不存在
10925
				if(iframeDocs[i]===undefined){
10925
				if(iframeDocs[i]===undefined){
10926
				
10926
 
10927
					//重新計數
10927
					//重新計數
10928
					i=0;
10928
					i=0;
10929
					
10929
 
10930
					//下一輪
10930
					//下一輪
10931
					continue;
10931
					continue;
10932
				
10932
 
10933
					}//if end
10933
					}//if end
10934
									
10934
 
10935
				//取得所有投影片
10935
				//取得所有投影片
10936
				var slides=displayDiv.querySelectorAll('div#window_qbpwcf_slide');
10936
				var slides=displayDiv.querySelectorAll('div#window_qbpwcf_slide');
10937
				
10937
 
10938
				//針對每個投影片
10938
				//針對每個投影片
10939
				for(var j=0;j<slides.length;j++){
10939
				for(var j=0;j<slides.length;j++){
10940
				
10940
 
10941
					//設置放在背景
10941
					//設置放在背景
10942
					slides[j].style.zIndex=-1;
10942
					slides[j].style.zIndex=-1;
10943
					
10943
 
10944
					//設置為透明
10944
					//設置為透明
10945
					slides[j].style.opacity=0;
10945
					slides[j].style.opacity=0;
10946
					
10946
 
10947
					//設置為absolute,不占用空間
10947
					//設置為absolute,不占用空間
10948
					slides[j].style.position='absolute';
10948
					slides[j].style.position='absolute';
10949
					
10949
 
10950
					}//for end
10950
					}//for end
10951
				
10951
 
10952
				//取得當前播放的內容
10952
				//取得當前播放的內容
10953
				var prePlayContent=displayDiv.querySelectorAll('div#window_qbpwcf_slide')[i];
10953
				var prePlayContent=displayDiv.querySelectorAll('div#window_qbpwcf_slide')[i];
10954
				
10954
 
10955
				//當前要播放的內容移到前景
10955
				//當前要播放的內容移到前景
10956
				prePlayContent.style.zIndex='unset';
10956
				prePlayContent.style.zIndex='unset';
10957
				
10957
 
10958
				//顯示當前要播放的內容
10958
				//顯示當前要播放的內容
10959
				prePlayContent.style.opacity='unset';
10959
				prePlayContent.style.opacity='unset';
10960
				
10960
 
10961
				//設置為unset,要占用空間
10961
				//設置為unset,要占用空間
10962
				prePlayContent.style.position='unset';
10962
				prePlayContent.style.position='unset';
10963
				
10963
 
10964
				//如果有子元素
10964
				//如果有子元素
10965
				if(prePlayContent.children.length>0){
10965
				if(prePlayContent.children.length>0){
10966
				
10966
 
10967
					//如果是影片
10967
					//如果是影片
10968
					if(prePlayContent.children[0].tagName==='VIDEO'){
10968
					if(prePlayContent.children[0].tagName==='VIDEO'){
10969
					
10969
 
10970
						//播放之
10970
						//播放之
10971
						prePlayContent.children[0].play();
10971
						prePlayContent.children[0].play();
10972
										
10972
 
10973
						}//if end
10973
						}//if end
10974
					
10974
 
10975
					}//if end
10975
					}//if end
10976
				
10976
 
10977
				//播放 showTime 秒
10977
				//播放 showTime 秒
10978
				await window.qbpwcf.sleep.func(showTime);
10978
				await window.qbpwcf.sleep.func(showTime);
10979
				
10979
 
10980
				//如果尚不行置換slide
10980
				//如果尚不行置換slide
10981
				while(prePlayContent.dataset.canChangeNow==='false'){
10981
				while(prePlayContent.dataset.canChangeNow==='false'){
10982
				
10982
 
10983
					//多播放 1 秒
10983
					//多播放 1 秒
10984
					await window.qbpwcf.sleep.func(1);
10984
					await window.qbpwcf.sleep.func(1);
10985
				
10985
 
10986
					}//while end
10986
					}//while end
10987
				
10987
 
10988
				//如果有子元素
10988
				//如果有子元素
10989
				if(prePlayContent.children.length>0){
10989
				if(prePlayContent.children.length>0){
10990
				
10990
 
10991
					//如果是影片
10991
					//如果是影片
10992
					if(prePlayContent.children[0].tagName==='VIDEO'){
10992
					if(prePlayContent.children[0].tagName==='VIDEO'){
10993
					
10993
 
10994
						//設置下次要等待影片播放完才能換頁
10994
						//設置下次要等待影片播放完才能換頁
10995
						prePlayContent.dataset.canChangeNow=false;
10995
						prePlayContent.dataset.canChangeNow=false;
10996
										
10996
 
10997
						}//if end
10997
						}//if end
10998
						
10998
 
10999
					}//if end
10999
					}//if end
11000
				
11000
 
11001
				//執行到這邊代表可以置換slide了
11001
				//執行到這邊代表可以置換slide了
11002
				
11002
 
11003
				//計數增加
11003
				//計數增加
11004
				i++;
11004
				i++;
11005
			
11005
 
11006
				}//while end
11006
				}//while end
11007
										
11007
 
11008
			}//window.qbpwcf.slide.func end
11008
			}//window.qbpwcf.slide.func end
11009
		
11009
 
11010
		";
11010
		";
11011
		
11011
 
11012
		#js function
11012
		#js function
11013
		$conf["javaScript::toScript"]["jsFunciton"][]=
11013
		$conf["javaScript::toScript"]["jsFunciton"][]=
11014
		"
11014
		"
11015
		/*
11015
		/*
11016
		說明:
11016
		說明:
11017
		取得用戶端的檔案.
11017
		取得用戶端的檔案.
11018
		回傳結果:
11018
		回傳結果:
11019
		result.data,取得檔案的 base64 data
11019
		result.data,取得檔案的 base64 data
11020
		result.mime,取得檔案的 mime	
11020
		result.mime,取得檔案的 mime
11021
		result.base64,取得檔案的純 base64 部分
11021
		result.base64,取得檔案的純 base64 部分
11022
		參考資料:
11022
		參考資料:
11023
		https://developer.mozilla.org/en-US/docs/Web/API/File
11023
		https://developer.mozilla.org/en-US/docs/Web/API/File
11024
		https://developer.mozilla.org/en-US/docs/Web/API/FileList
11024
		https://developer.mozilla.org/en-US/docs/Web/API/FileList
11025
		https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept
11025
		https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept
11026
		https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL_static
11026
		https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL_static
11027
		https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL
11027
		https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL
11028
		*/
11028
		*/
11029
		
11029
 
11030
		//初始化
11030
		//初始化
11031
		window.qbpwcf.clientFile={};
11031
		window.qbpwcf.clientFile={};
11032
		
11032
 
11033
		//取得用戶端檔案的參數設定
11033
		//取得用戶端檔案的參數設定
11034
		window.qbpwcf.clientFile.params={};
11034
		window.qbpwcf.clientFile.params={};
11035
		
11035
 
11036
		//初始化multiple參數為false
11036
		//初始化multiple參數為false
11037
		window.qbpwcf.clientFile.params.multiple=false;
11037
		window.qbpwcf.clientFile.params.multiple=false;
11038
		
11038
 
11039
		//初始化accept參數為''
11039
		//初始化accept參數為''
11040
		window.qbpwcf.clientFile.params.accept='';
11040
		window.qbpwcf.clientFile.params.accept='';
11041
		
11041
 
11042
		//設置只接受video
11042
		//設置只接受video
11043
		window.qbpwcf.clientFile.acceptVideoOnly=function(){
11043
		window.qbpwcf.clientFile.acceptVideoOnly=function(){
11044
		
11044
 
11045
			//設置accept為'video/*'
11045
			//設置accept為'video/*'
11046
			window.qbpwcf.clientFile.params.accept='video/*';
11046
			window.qbpwcf.clientFile.params.accept='video/*';
11047
		
11047
 
11048
			}//function end
11048
			}//function end
11049
			
11049
 
11050
		//設置只接受audio
11050
		//設置只接受audio
11051
		window.qbpwcf.clientFile.acceptAudioOnly=function(){
11051
		window.qbpwcf.clientFile.acceptAudioOnly=function(){
11052
		
11052
 
11053
			//設置accept為'audio/*'
11053
			//設置accept為'audio/*'
11054
			window.qbpwcf.clientFile.params.accept='audio/*';
11054
			window.qbpwcf.clientFile.params.accept='audio/*';
11055
		
11055
 
11056
			}//function end
11056
			}//function end
11057
			
11057
 
11058
		//設置只接受image
11058
		//設置只接受image
11059
		window.qbpwcf.clientFile.acceptImageOnly=function(){
11059
		window.qbpwcf.clientFile.acceptImageOnly=function(){
11060
		
11060
 
11061
			//設置accept為'image/*'
11061
			//設置accept為'image/*'
11062
			window.qbpwcf.clientFile.params.accept='image/*';
11062
			window.qbpwcf.clientFile.params.accept='image/*';
11063
		
11063
 
11064
			}//function end
11064
			}//function end
11065
			
11065
 
11066
		//累加允許的檔案類型
11066
		//累加允許的檔案類型
11067
		window.qbpwcf.clientFile.acceptAppend=function(type){
11067
		window.qbpwcf.clientFile.acceptAppend=function(type){
11068
		
11068
 
11069
			//如果已經有內容
11069
			//如果已經有內容
11070
			if(window.qbpwcf.clientFile.params.accept!=''){
11070
			if(window.qbpwcf.clientFile.params.accept!=''){
11071
			
11071
 
11072
				//增加允許的類型
11072
				//增加允許的類型
11073
				window.qbpwcf.clientFile.params.accept=window.qbpwcf.clientFile.params.accept+','+type;
11073
				window.qbpwcf.clientFile.params.accept=window.qbpwcf.clientFile.params.accept+','+type;
11074
			
11074
 
11075
				}//if end
11075
				}//if end
11076
				
11076
 
11077
			//反之尚無設定
11077
			//反之尚無設定
11078
			else{
11078
			else{
11079
			
11079
 
11080
				//設置允許的類型
11080
				//設置允許的類型
11081
				window.qbpwcf.clientFile.params.accept=type;
11081
				window.qbpwcf.clientFile.params.accept=type;
11082
			
11082
 
11083
				}//else end
11083
				}//else end
11084
				
11084
 
11085
			}//function end
11085
			}//function end
11086
		
11086
 
11087
		//觸發選擇檔案的視窗後,若沒有選擇到的檔案,會強制使用者再度選擇,預設為'false'不啟用;反之為'true'要啟用.
11087
		//觸發選擇檔案的視窗後,若沒有選擇到的檔案,會強制使用者再度選擇,預設為'false'不啟用;反之為'true'要啟用.
11088
		window.qbpwcf.clientFile.forceSelectFileAfterTrigger='false';
11088
		window.qbpwcf.clientFile.forceSelectFileAfterTrigger='false';
11089
		
11089
 
11090
		//取得用戶端的檔案,使用時前面請加上 await 才能取得回應.
11090
		//取得用戶端的檔案,使用時前面請加上 await 才能取得回應.
11091
		window.qbpwcf.clientFile.init=async function(){
11091
		window.qbpwcf.clientFile.init=async function(){
11092
		
11092
 
11093
			//建立 input
11093
			//建立 input
11094
			var input=document.createElement('input');
11094
			var input=document.createElement('input');
11095
		
11095
 
11096
			//設置 type 為檔案
11096
			//設置 type 為檔案
11097
			input.type='file';
11097
			input.type='file';
11098
						
11098
 
11099
			//設置multiple參數
11099
			//設置multiple參數
11100
			input.multiple=window.qbpwcf.clientFile.params.multiple;
11100
			input.multiple=window.qbpwcf.clientFile.params.multiple;
11101
		
11101
 
11102
			//設置multiple參數
11102
			//設置multiple參數
11103
			input.accept=window.qbpwcf.clientFile.params.accept;
11103
			input.accept=window.qbpwcf.clientFile.params.accept;
11104
			
11104
 
11105
			//初始化要回傳的結果物件
11105
			//初始化要回傳的結果物件
11106
			input.result={};
11106
			input.result={};
11107
			
11107
 
11108
			//預設使用者尚未取消選取檔案
11108
			//預設使用者尚未取消選取檔案
11109
			input.canceled='false';
11109
			input.canceled='false';
11110
			
11110
 
11111
			//當選擇的檔案有異動
11111
			//當選擇的檔案有異動
11112
			input.onchange=function(){
11112
			input.onchange=function(){
11113
			
11113
 
11114
				//轉換與取得ObjectURL
11114
				//轉換與取得ObjectURL
11115
				input.result.url=URL.createObjectURL(input.files[0]);
11115
				input.result.url=URL.createObjectURL(input.files[0]);
11116
 
11116
 
11117
				//初始化 FileReader
11117
				//初始化 FileReader
11118
				var reader = new FileReader();
11118
				var reader = new FileReader();
11119
			
11119
 
11120
				//讀取檔案
11120
				//讀取檔案
11121
				reader.readAsDataURL(input.files[0]);
11121
				reader.readAsDataURL(input.files[0]);
11122
			
11122
 
11123
				//當檔案讀取完畢後
11123
				//當檔案讀取完畢後
11124
				reader.onload=function(){
11124
				reader.onload=function(){
11125
				
11125
 
11126
					//取得檔案的 base64 data
11126
					//取得檔案的 base64 data
11127
					input.result.data = reader.result;
11127
					input.result.data = reader.result;
11128
					
11128
 
11129
					//取得檔案的 mime
11129
					//取得檔案的 mime
11130
					input.result.mime = input.result.data.split(':')[1].split(';')[0];
11130
					input.result.mime = input.result.data.split(':')[1].split(';')[0];
11131
					
11131
 
11132
					//取得檔案的純 base64 部分
11132
					//取得檔案的純 base64 部分
11133
					input.result.base64 = input.result.data.split(',')[1];
11133
					input.result.base64 = input.result.data.split(',')[1];
11134
					
11134
 
11135
					}//function end
11135
					}//function end
11136
			
11136
 
11137
				};//function end
11137
				};//function end
11138
			
11138
 
11139
			//綁定使用按下取消的事件
11139
			//綁定使用按下取消的事件
11140
			//參考資料:
11140
			//參考資料:
11141
			//https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/cancel_event
11141
			//https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/cancel_event
11142
			input.addEventListener('cancel',function(event){
11142
			input.addEventListener('cancel',function(event){
11143
 
11143
 
11144
				//debug
11144
				//debug
11145
				//console.log(event,Object.keys(input.result).length);return false;
11145
				//console.log(event,Object.keys(input.result).length);return false;
11146
 
11146
 
11147
				//如果沒有結果
11147
				//如果沒有結果
11148
				if(Object.keys(input.result).length===0){
11148
				if(Object.keys(input.result).length===0){
11149
				
11149
 
11150
					//設置被按下cancel了
11150
					//設置被按下cancel了
11151
					input.canceled='true';
11151
					input.canceled='true';
11152
				
11152
 
11153
					}//if end
11153
					}//if end
11154
			
11154
 
11155
				});
11155
				});
11156
						
11156
 
11157
			//觸發使用者選擇檔案
11157
			//觸發使用者選擇檔案
11158
			input.click();
11158
			input.click();
11159
			
11159
 
11160
			//無窮迴圈
11160
			//無窮迴圈
11161
			while(true){
11161
			while(true){
11162
			
11162
 
11163
				//如果使用者取消了
11163
				//如果使用者取消了
11164
				if(input.canceled==='true'){
11164
				if(input.canceled==='true'){
11165
				
11165
 
11166
					//回傳結果
11166
					//回傳結果
11167
					return input.result;
11167
					return input.result;
11168
				
11168
 
11169
					}//if end
11169
					}//if end
11170
			
11170
 
11171
				//休息一秒
11171
				//休息一秒
11172
				await window.qbpwcf.sleep.func(1);
11172
				await window.qbpwcf.sleep.func(1);
11173
			
11173
 
11174
				//debug
11174
				//debug
11175
				console.log('wait file selected');
11175
				console.log('wait file selected');
11176
				
11176
 
11177
				//如果有結果
11177
				//如果有結果
11178
				if(input.result!={}){
11178
				if(input.result!={}){
11179
				
11179
 
11180
					//如果
11180
					//如果
11181
					if(
11181
					if(
11182
						
11182
 
11183
						//url存在
11183
						//url存在
11184
						input.result.url!=undefined 
11184
						input.result.url!=undefined
11185
					
11185
 
11186
						&& 
11186
						&&
11187
					
11187
 
11188
						//data存在
11188
						//data存在
11189
						input.result.data!=undefined 
11189
						input.result.data!=undefined
11190
					
11190
 
11191
						&&
11191
						&&
11192
					
11192
 
11193
						//mime存在
11193
						//mime存在
11194
						input.result.mime!=undefined
11194
						input.result.mime!=undefined
11195
					
11195
 
11196
						&&
11196
						&&
11197
					
11197
 
11198
						//base64存在
11198
						//base64存在
11199
						input.result.base64!=undefined
11199
						input.result.base64!=undefined
11200
						
11200
 
11201
						){
11201
						){
11202
						
11202
 
11203
						//執行到這代表資料都有了
11203
						//執行到這代表資料都有了
11204
						
11204
 
11205
						//結束迴圈
11205
						//結束迴圈
11206
						break;
11206
						break;
11207
					
11207
 
11208
						}//if end
11208
						}//if end
11209
				
11209
 
11210
					}//if end
11210
					}//if end
11211
			
11211
 
11212
				}//while end
11212
				}//while end
11213
						
11213
 
11214
			//回傳結果
11214
			//回傳結果
11215
			return input.result;
11215
			return input.result;
11216
			
11216
 
11217
			};
11217
			};
11218
		
11218
 
11219
		";
11219
		";
11220
		
11220
 
11221
		#js function
11221
		#js function
11222
		$conf["javaScript::toScript"]["jsFunciton"][]=
11222
		$conf["javaScript::toScript"]["jsFunciton"][]=
11223
		"
11223
		"
11224
		/*
11224
		/*
11225
		說明:
11225
		說明:
11226
		text_editor,編輯文字.
11226
		text_editor,編輯文字.
11227
		*/
11227
		*/
11228
		
11228
 
11229
		//初始化
11229
		//初始化
11230
		window.qbpwcf.text_editor={};
11230
		window.qbpwcf.text_editor={};
11231
		
11231
 
11232
		//用於取得顯示輸入內容的區塊
11232
		//用於取得顯示輸入內容的區塊
11233
		window.qbpwcf.text_editor.selector='';
11233
		window.qbpwcf.text_editor.selector='';
11234
		
11234
 
11235
		//執行
11235
		//執行
11236
		window.qbpwcf.text_editor.init=function(){
11236
		window.qbpwcf.text_editor.init=function(){
11237
		
11237
 
11238
			//取得用來顯示輸入內容的 selector
11238
			//取得用來顯示輸入內容的 selector
11239
			var displayTag=document.querySelector(window.qbpwcf.text_editor.selector);
11239
			var displayTag=document.querySelector(window.qbpwcf.text_editor.selector);
11240
			
11240
 
11241
			//取得一開始的內容,用一個div代表一行.
11241
			//取得一開始的內容,用一個div代表一行.
11242
			var lines=displayTag.children;
11242
			var lines=displayTag.children;
11243
		
11243
 
11244
			//關注用來顯示輸入內容的元素後
11244
			//關注用來顯示輸入內容的元素後
11245
			displayTag.addEventListener('focus',function(event){
11245
			displayTag.addEventListener('focus',function(event){
11246
			
11246
 
11247
				//取得觸發的元素
11247
				//取得觸發的元素
11248
				var eTarget=event.target;
11248
				var eTarget=event.target;
11249
			
11249
 
11250
				//debug
11250
				//debug
11251
				console.log(eTarget);
11251
				console.log(eTarget);
11252
			
11252
 
11253
				//建立暫存的textInput
11253
				//建立暫存的textInput
11254
				var tempInput=document.createElement('input');
11254
				var tempInput=document.createElement('input');
11255
				
11255
 
11256
				//設置為單行輸入
11256
				//設置為單行輸入
11257
				tempInput.type='text';
11257
				tempInput.type='text';
11258
				
11258
 
11259
				//break point
11259
				//break point
11260
				return;
11260
				return;
11261
				
11261
 
11262
				//初始化內容
11262
				//初始化內容
11263
				tempInput.value=contentOfTag;
11263
				tempInput.value=contentOfTag;
11264
				
11264
 
11265
				//關注之
11265
				//關注之
11266
				tempInput.focus();
11266
				tempInput.focus();
11267
				
11267
 
11268
				//若內容有改變
11268
				//若內容有改變
11269
				tempInput.addEventListener('change',function(event){
11269
				tempInput.addEventListener('change',function(event){
11270
				
11270
 
11271
					//更新用來顯示輸入的內容
11271
					//更新用來顯示輸入的內容
11272
					displayTag.innerText=this.value;
11272
					displayTag.innerText=this.value;
11273
				
11273
 
11274
					});
11274
					});
11275
			
11275
 
11276
				});
11276
				});
11277
		
11277
 
11278
			}
11278
			}
11279
		";
11279
		";
11280
		
11280
 
11281
		#js function
11281
		#js function
11282
		$conf["javaScript::toScript"]["jsFunciton"][]=
11282
		$conf["javaScript::toScript"]["jsFunciton"][]=
11283
		"
11283
		"
11284
		
11284
 
11285
		/*
11285
		/*
11286
		說明:
11286
		說明:
11287
		openWindow,由javaScript開啟可管控的視窗,甚至存取其內容.
11287
		openWindow,由javaScript開啟可管控的視窗,甚至存取其內容.
11288
		
11288
 
11289
		範例:
11289
		範例:
11290
		
11290
 
11291
		//第一段
11291
		//第一段
11292
		var script=document.createElement('script');
11292
		var script=document.createElement('script');
11293
		script.src='https://latest.qbpwcf.org/qbpwcf/javaScript/qbpwcf.php';
11293
		script.src='https://latest.qbpwcf.org/qbpwcf/javaScript/qbpwcf.php';
11294
		document.head.appendChild(script);
11294
		document.head.appendChild(script);
11295
		
11295
 
11296
		//第二段
11296
		//第二段
11297
		window.qbpwcf.openWindow.params.url=window.location.href;
11297
		window.qbpwcf.openWindow.params.url=window.location.href;
11298
		window.qbpwcf.openWindow.saveSourceAtTheEnd='true';
11298
		window.qbpwcf.openWindow.saveSourceAtTheEnd='true';
11299
		await window.qbpwcf.openWindow.func();
11299
		await window.qbpwcf.openWindow.func();
11300
		
11300
 
11301
		參考資料:
11301
		參考資料:
11302
		https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL
11302
		https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL
11303
		https://developer.mozilla.org/en-US/docs/Web/API/File/File		
11303
		https://developer.mozilla.org/en-US/docs/Web/API/File/File
11304
		*/
11304
		*/
11305
		
11305
 
11306
		//初始化物件
11306
		//初始化物件
11307
		window.qbpwcf.openWindow={};
11307
		window.qbpwcf.openWindow={};
11308
		
11308
 
11309
		//初始化參數
11309
		//初始化參數
11310
		window.qbpwcf.openWindow.init=function(){
11310
		window.qbpwcf.openWindow.init=function(){
11311
		
11311
 
11312
			//初始化參數物件
11312
			//初始化參數物件
11313
			window.qbpwcf.openWindow.params={};
11313
			window.qbpwcf.openWindow.params={};
11314
		
11314
 
11315
			//初始化目標網址
11315
			//初始化目標網址
11316
			window.qbpwcf.openWindow.params.url='https://sourceforge.net/projects/qbpwc/';
11316
			window.qbpwcf.openWindow.params.url='https://sourceforge.net/projects/qbpwc/';
11317
		
11317
 
11318
			//初始化要將window.open()儲存到哪個全域變數裡面.
11318
			//初始化要將window.open()儲存到哪個全域變數裡面.
11319
			window.qbpwcf.openWindow.params.varName='qbpwcf_openWindow_instance';
11319
			window.qbpwcf.openWindow.params.varName='qbpwcf_openWindow_instance';
11320
			
11320
 
11321
			//初始化給予 window.open() 的第三個參數.
11321
			//初始化給予 window.open() 的第三個參數.
11322
			window.qbpwcf.openWindow.params.windowFeatures='';
11322
			window.qbpwcf.openWindow.params.windowFeatures='';
11323
		
11323
 
11324
			//初始化window.open()後,其回應的html source
11324
			//初始化window.open()後,其回應的html source
11325
			window.qbpwcf.openWindow.resSource='';
11325
			window.qbpwcf.openWindow.resSource='';
11326
			
11326
 
11327
			//初始化window.open()後,要執行什麼操作,參數Window為其opened的Window的.
11327
			//初始化window.open()後,要執行什麼操作,參數Window為其opened的Window的.
11328
			window.qbpwcf.openWindow.actionAfterOpen=function(Window){
11328
			window.qbpwcf.openWindow.actionAfterOpen=function(Window){
11329
			
11329
 
11330
				//預設的提示訊息
11330
				//預設的提示訊息
11331
				console.log('do something after window.oepn()');
11331
				console.log('do something after window.oepn()');
11332
			
11332
 
11333
				}//actionAfterOpen end
11333
				}//actionAfterOpen end
11334
				
11334
 
11335
			//預設window.open()後經過處理後結果不要下載下來
11335
			//預設window.open()後經過處理後結果不要下載下來
11336
			window.qbpwcf.openWindow.saveSourceAtTheEnd='false';
11336
			window.qbpwcf.openWindow.saveSourceAtTheEnd='false';
11337
			
11337
 
11338
			}//funciton end
11338
			}//funciton end
11339
		
11339
 
11340
		//初始化參數
11340
		//初始化參數
11341
		window.qbpwcf.openWindow.init();
11341
		window.qbpwcf.openWindow.init();
11342
		
11342
 
11343
		//window.open
11343
		//window.open
11344
		window.qbpwcf.openWindow.func=async function(){
11344
		window.qbpwcf.openWindow.func=async function(){
11345
		
11345
 
11346
			//window.open()並儲存回傳的結果
11346
			//window.open()並儲存回傳的結果
11347
			window[window.qbpwcf.openWindow.params.varName]=await window.open(window.qbpwcf.openWindow.params.url,'_blank',window.qbpwcf.openWindow.params.windowFeatures);
11347
			window[window.qbpwcf.openWindow.params.varName]=await window.open(window.qbpwcf.openWindow.params.url,'_blank',window.qbpwcf.openWindow.params.windowFeatures);
11348
				
11348
 
11349
			//如果執行失敗
11349
			//如果執行失敗
11350
			if(!(window[window.qbpwcf.openWindow.params.varName])){
11350
			if(!(window[window.qbpwcf.openWindow.params.varName])){
11351
 
11351
 
11352
				//提示錯誤訊息
11352
				//提示錯誤訊息
11353
				console.error('The window wasn\'t allowed to open. This is likely caused by built-in popup blockers.');
11353
				console.error('The window wasn\'t allowed to open. This is likely caused by built-in popup blockers.');
11354
 
11354
 
11355
				//結束執行
11355
				//結束執行
11356
				return;
11356
				return;
11357
 
11357
 
11358
				}//if end
11358
				}//if end
11359
					
11359
 
11360
			//加入load事件
11360
			//加入load事件
11361
			window[window.qbpwcf.openWindow.params.varName].addEventListener('load',function(event){
11361
			window[window.qbpwcf.openWindow.params.varName].addEventListener('load',function(event){
11362
			
11362
 
11363
				//debug
11363
				//debug
11364
				//console.log(this);
11364
				//console.log(this);
11365
			
11365
 
11366
				//呼叫開啟後要做度事情
11366
				//呼叫開啟後要做度事情
11367
				window.qbpwcf.openWindow.actionAfterOpen(this);
11367
				window.qbpwcf.openWindow.actionAfterOpen(this);
11368
			
11368
 
11369
				//取得html原始碼
11369
				//取得html原始碼
11370
				window.qbpwcf.openWindow.resSource='<html>'+window[window.qbpwcf.openWindow.params.varName].document.head.outerHTML+window[window.qbpwcf.openWindow.params.varName].document.body.outerHTML+'</html>';
11370
				window.qbpwcf.openWindow.resSource='<html>'+window[window.qbpwcf.openWindow.params.varName].document.head.outerHTML+window[window.qbpwcf.openWindow.params.varName].document.body.outerHTML+'</html>';
11371
				
11371
 
11372
				//如果要下載內容
11372
				//如果要下載內容
11373
				if(window.qbpwcf.openWindow.saveSourceAtTheEnd=='true'){
11373
				if(window.qbpwcf.openWindow.saveSourceAtTheEnd=='true'){
11374
				
11374
 
11375
					//建立檔案File
11375
					//建立檔案File
11376
					var filed2download=new File([window.qbpwcf.openWindow.resSource],'filed2download');
11376
					var filed2download=new File([window.qbpwcf.openWindow.resSource],'filed2download');
11377
				
11377
 
11378
					//建立用來讀取檔案的FileReader
11378
					//建立用來讀取檔案的FileReader
11379
					var fileReader=new FileReader();
11379
					var fileReader=new FileReader();
11380
					
11380
 
11381
					//檔案讀取完畢後
11381
					//檔案讀取完畢後
11382
					fileReader.addEventListener('load',function(event){
11382
					fileReader.addEventListener('load',function(event){
11383
					
11383
 
11384
						//取得dataUrl
11384
						//取得dataUrl
11385
						dataUrl=fileReader.result;
11385
						dataUrl=fileReader.result;
11386
					
11386
 
11387
						//建立 a
11387
						//建立 a
11388
						var a=document.createElement('a');
11388
						var a=document.createElement('a');
11389
					
11389
 
11390
						//設置連結為dataUrl
11390
						//設置連結為dataUrl
11391
						a.href=dataUrl;
11391
						a.href=dataUrl;
11392
 
11392
 
11393
						//點擊開始下載
11393
						//點擊開始下載
11394
						a.click();
11394
						a.click();
11395
 
11395
 
11396
						});
11396
						});
11397
					
11397
 
11398
					//讀取檔案為 dataUrl]
11398
					//讀取檔案為 dataUrl]
11399
					fileReader.readAsDataURL(filed2download);
11399
					fileReader.readAsDataURL(filed2download);
11400
				
11400
 
11401
					}//if end
11401
					}//if end
11402
				
11402
 
11403
				});
11403
				});
11404
			
11404
 
11405
			}//function end
11405
			}//function end
11406
		
11406
 
11407
		";
11407
		";
11408
		
11408
 
11409
		#js function
11409
		#js function
11410
		$conf["javaScript::toScript"]["jsFunciton"][]=
11410
		$conf["javaScript::toScript"]["jsFunciton"][]=
11411
		"
11411
		"
11412
		
11412
 
11413
		/*
11413
		/*
11414
		說明:
11414
		說明:
11415
		儲存當前頁面的原始碼
11415
		儲存當前頁面的原始碼
11416
		
11416
 
11417
		範例:
11417
		範例:
11418
		window.qbpwcf.saveSource();
11418
		window.qbpwcf.saveSource();
11419
		*/
11419
		*/
11420
		
11420
 
11421
		//儲存當前頁面原始碼
11421
		//儲存當前頁面原始碼
11422
		window.qbpwcf.saveSource=async function(){
11422
		window.qbpwcf.saveSource=async function(){
11423
		
11423
 
11424
			//取得原始碼
11424
			//取得原始碼
11425
			var sourceStr='<html>'+document.head.outerHTML+document.body.outerHTML+'</html>';
11425
			var sourceStr='<html>'+document.head.outerHTML+document.body.outerHTML+'</html>';
11426
			
11426
 
11427
			//建立File,檔案名稱隨機產生.
11427
			//建立File,檔案名稱隨機產生.
11428
			var file2download=new File([sourceStr],'file2download');
11428
			var file2download=new File([sourceStr],'file2download');
11429
		
11429
 
11430
			//建立用來讀取檔案的FileReader
11430
			//建立用來讀取檔案的FileReader
11431
			var fileReader=new FileReader();
11431
			var fileReader=new FileReader();
11432
			
11432
 
11433
			//檔案讀取完畢後
11433
			//檔案讀取完畢後
11434
			fileReader.addEventListener('load',function(event){
11434
			fileReader.addEventListener('load',function(event){
11435
			
11435
 
11436
				//取得dataUrl
11436
				//取得dataUrl
11437
				dataUrl=fileReader.result;
11437
				dataUrl=fileReader.result;
11438
			
11438
 
11439
				//建立 a
11439
				//建立 a
11440
				var a=document.createElement('a');
11440
				var a=document.createElement('a');
11441
			
11441
 
11442
				//設置連結為dataUrl
11442
				//設置連結為dataUrl
11443
				a.href=dataUrl;
11443
				a.href=dataUrl;
11444
 
11444
 
11445
				//點擊開始下載
11445
				//點擊開始下載
11446
				a.click();
11446
				a.click();
11447
 
11447
 
11448
				});
11448
				});
11449
			
11449
 
11450
			//讀取檔案為 dataUrl
11450
			//讀取檔案為 dataUrl
11451
			fileReader.readAsDataURL(file2download);
11451
			fileReader.readAsDataURL(file2download);
11452
		
11452
 
11453
			}//function end
11453
			}//function end
11454
		
11454
 
11455
		";
11455
		";
11456
		
11456
 
11457
		#js function
11457
		#js function
11458
		$conf["javaScript::toScript"]["jsFunciton"][]=
11458
		$conf["javaScript::toScript"]["jsFunciton"][]=
11459
		"
11459
		"
11460
		
11460
 
11461
		/*
11461
		/*
11462
		說明:
11462
		說明:
11463
		將要執行的任務交由 web socket 處理.
11463
		將要執行的任務交由 web socket 處理.
11464
		
11464
 
11465
		範例:
11465
		範例:
11466
		
11466
 
11467
		//初始化參數
11467
		//初始化參數
11468
		var params={};
11468
		var params={};
11469
		
11469
 
11470
		//設定websocket位置
11470
		//設定websocket位置
11471
		params.url='wss://'+location.hostname+':443/wss';
11471
		params.url='wss://'+location.hostname+':443/wss';
11472
		
11472
 
11473
		//要傳輸的資料
11473
		//要傳輸的資料
11474
		params.data={};
11474
		params.data={};
11475
		
11475
 
11476
		//用來識別是所需要資料的id
11476
		//用來識別是所需要資料的id
11477
		params.data.id=crypto.randomUUID();
11477
		params.data.id=crypto.randomUUID();
11478
		
11478
 
11479
		//取得對應的回應
11479
		//取得對應的回應
11480
		var response=await window.qbpwcf.ws.init(params);
11480
		var response=await window.qbpwcf.ws.init(params);
11481
		
11481
 
11482
		*/
11482
		*/
11483
		
11483
 
11484
		//該方法的物件
11484
		//該方法的物件
11485
		window.qbpwcf.ws={};
11485
		window.qbpwcf.ws={};
11486
		
11486
 
11487
		//連線到web socket,並傳輸資料,會回傳promise.亦即要在 async function 中使用,且使用 await 來取得結果.
11487
		//連線到web socket,並傳輸資料,會回傳promise.亦即要在 async function 中使用,且使用 await 來取得結果.
11488
		//params,參數物件.
11488
		//params,參數物件.
11489
		//params.url,web socket的url,加密的連線為wss://url,預設為當前頁面的 domain name/wss
11489
		//params.url,web socket的url,加密的連線為wss://url,預設為當前頁面的 domain name/wss
11490
		//params.callback,函式,參數為收到的訊息,收到訊息後要怎麼處理.
11490
		//params.callback,函式,參數為收到的訊息,收到訊息後要怎麼處理.
11491
		//params.data,要傳輸的資料物件.
11491
		//params.data,要傳輸的資料物件.
11492
		//params.data.id,用於識別wss連線是屬於誰的id資訊,預設為自動產生.
11492
		//params.data.id,用於識別wss連線是屬於誰的id資訊,預設為自動產生.
11493
		window.qbpwcf.ws.init=async function(params){
11493
		window.qbpwcf.ws.init=async function(params){
11494
		
11494
 
11495
			//回傳 Promise
11495
			//回傳 Promise
11496
			return new Promise(function(resolve, reject){
11496
			return new Promise(function(resolve, reject){
11497
			
11497
 
11498
				//若無參數
11498
				//若無參數
11499
				if(Object.keys(params).length==0){
11499
				if(Object.keys(params).length==0){
11500
				
11500
 
11501
					//初始化參數
11501
					//初始化參數
11502
					params={};
11502
					params={};
11503
					
11503
 
11504
					//設定websocket位置
11504
					//設定websocket位置
11505
					params.url='wss://'+location.hostname+':443/';
11505
					params.url='wss://'+location.hostname+':443/';
11506
					
11506
 
11507
					//要傳輸的資料
11507
					//要傳輸的資料
11508
					params.data={};
11508
					params.data={};
11509
					
11509
 
11510
					//用來識別是所需要資料的id
11510
					//用來識別是所需要資料的id
11511
					params.data.id=crypto.randomUUID();
11511
					params.data.id=crypto.randomUUID();
11512
					
11512
 
11513
					//收到資料後要做的事情
11513
					//收到資料後要做的事情
11514
					params.callback=function(msg){
11514
					params.callback=function(msg){
11515
					
11515
 
11516
						//debug
11516
						//debug
11517
						console.log('run callback');
11517
						console.log('run callback');
11518
					
11518
 
11519
						}//function end
11519
						}//function end
11520
					
11520
 
11521
					}//if end
11521
					}//if end
11522
			
11522
 
11523
				//如果沒有 url 參數
11523
				//如果沒有 url 參數
11524
				if(params.url==undefined){
11524
				if(params.url==undefined){
11525
				
11525
 
11526
					//初始化要回傳的結果
11526
					//初始化要回傳的結果
11527
					var result={};
11527
					var result={};
11528
				
11528
 
11529
					//設置錯誤訊息
11529
					//設置錯誤訊息
11530
					result.error='missing param url';
11530
					result.error='missing param url';
11531
				
11531
 
11532
					//設置執行失敗
11532
					//設置執行失敗
11533
					result.status='false';
11533
					result.status='false';
11534
				
11534
 
11535
					//回傳結果, await 可以有結果.
11535
					//回傳結果, await 可以有結果.
11536
					reject(result);
11536
					reject(result);
11537
				
11537
 
11538
					}//if end
11538
					}//if end
11539
			
11539
 
11540
				//如果無 params.data 參數
11540
				//如果無 params.data 參數
11541
				if(params.data==undefined){
11541
				if(params.data==undefined){
11542
				
11542
 
11543
					//初始化要回傳的結果
11543
					//初始化要回傳的結果
11544
					var result={};
11544
					var result={};
11545
				
11545
 
11546
					//設置錯誤訊息
11546
					//設置錯誤訊息
11547
					result.error='missing param data';
11547
					result.error='missing param data';
11548
				
11548
 
11549
					//設置執行失敗
11549
					//設置執行失敗
11550
					result.status='false';
11550
					result.status='false';
11551
				
11551
 
11552
					//回傳結果, await 可以有結果.
11552
					//回傳結果, await 可以有結果.
11553
					reject(result);
11553
					reject(result);
11554
				
11554
 
11555
					}//if end
11555
					}//if end
11556
					
11556
 
11557
				//如果沒有儲存所有wss連線的變數存在
11557
				//如果沒有儲存所有wss連線的變數存在
11558
				if(this.qbpwcf.ws.wss==undefined){
11558
				if(this.qbpwcf.ws.wss==undefined){
11559
				
11559
 
11560
					//初始化為空物件
11560
					//初始化為空物件
11561
					this.qbpwcf.ws.wss={};
11561
					this.qbpwcf.ws.wss={};
11562
					
11562
 
11563
					}//if end
11563
					}//if end
11564
				
11564
 
11565
				//設置 既有的 web socket 實體清單 參考
11565
				//設置 既有的 web socket 實體清單 參考
11566
				var wsList={
11566
				var wsList={
11567
				
11567
 
11568
					//取得本函式的參數參考
11568
					//取得本函式的參數參考
11569
					'params':params,
11569
					'params':params,
11570
				
11570
 
11571
					//取得既有的 web socket 實體清單
11571
					//取得既有的 web socket 實體清單
11572
					'list':Object.keys(window.qbpwcf.ws.wss),
11572
					'list':Object.keys(window.qbpwcf.ws.wss),
11573
					
11573
 
11574
					}//wsList end
11574
					}//wsList end
11575
			
11575
 
11576
				//針對每個實體清單
11576
				//針對每個實體清單
11577
				for(key in wsList.list){
11577
				for(key in wsList.list){
11578
				
11578
 
11579
					//如果有同樣目標的連線
11579
					//如果有同樣目標的連線
11580
					if(key==params.url){
11580
					if(key==params.url){
11581
					
11581
 
11582
						//使用既有的連線
11582
						//使用既有的連線
11583
						var conn=value;
11583
						var conn=value;
11584
						
11584
 
11585
						//如果有要傳遞資料
11585
						//如果有要傳遞資料
11586
						if(params.data!={}){
11586
						if(params.data!={}){
11587
						
11587
 
11588
							//傳遞資料
11588
							//傳遞資料
11589
							conn.send(JONS.toString(params.data));
11589
							conn.send(JONS.toString(params.data));
11590
 
11590
 
11591
							//如果更新要識別的id?
11591
							//如果更新要識別的id?
11592
							//...
11592
							//...
11593
						
11593
 
11594
							}//if end
11594
							}//if end
11595
						
11595
 
11596
						//結束for
11596
						//結束for
11597
						break;
11597
						break;
11598
					
11598
 
11599
						}//if end
11599
						}//if end
11600
				
11600
 
11601
					}//for end
11601
					}//for end
11602
					
11602
 
11603
				//如果尚無可用的ws連線
11603
				//如果尚無可用的ws連線
11604
				if(conn==undefined){
11604
				if(conn==undefined){
11605
					
11605
 
11606
					//設定webSocket的連線目標
11606
					//設定webSocket的連線目標
11607
					var conn = new WebSocket(params.url);
11607
					var conn = new WebSocket(params.url);
11608
				
11608
 
11609
					//設置上層參考
11609
					//設置上層參考
11610
					conn.mother=this.qbpwcf.ws;
11610
					conn.mother=this.qbpwcf.ws;
11611
 
11611
 
11612
					//設置本函式參數的參考
11612
					//設置本函式參數的參考
11613
					conn.params=params;
11613
					conn.params=params;
11614
 
11614
 
11615
					//儲存可以使用的連線
11615
					//儲存可以使用的連線
11616
					window.qbpwcf.ws.wss[params.url]=conn;
11616
					window.qbpwcf.ws.wss[params.url]=conn;
11617
					
11617
 
11618
					//當有收到訊息時
11618
					//當有收到訊息時
11619
					conn.onmessage = async function(e){
11619
					conn.onmessage = async function(e){
11620
					
11620
 
11621
						//debug
11621
						//debug
11622
						console.log(e);
11622
						console.log(e);
11623
						
11623
 
11624
						//解析成json
11624
						//解析成json
11625
						var revJson=JSON.parse(e.data);
11625
						var revJson=JSON.parse(e.data);
11626
					
11626
 
11627
						//如果有 id
11627
						//如果有 id
11628
						if(revJson.id!=undefined){
11628
						if(revJson.id!=undefined){
11629
					
11629
 
11630
							//如果id符合
11630
							//如果id符合
11631
							if(revJson.id==params.data.id){
11631
							if(revJson.id==params.data.id){
11632
						
11632
 
11633
								//卸除Object revJson的id屬性
11633
								//卸除Object revJson的id屬性
11634
								delete revJson.id;
11634
								delete revJson.id;
11635
						
11635
 
11636
								//resolve, await 可以有結果.
11636
								//resolve, await 可以有結果.
11637
								resolve(revJson);
11637
								resolve(revJson);
11638
						
11638
 
11639
								}//if end
11639
								}//if end
11640
					
11640
 
11641
							}//if end
11641
							}//if end
11642
						
11642
 
11643
						//如果有 callback
11643
						//如果有 callback
11644
						if(this.params.callback!=undefined){
11644
						if(this.params.callback!=undefined){
11645
						
11645
 
11646
							//callback,收到資料後要做的事情,參數為收到的訊息.
11646
							//callback,收到資料後要做的事情,參數為收到的訊息.
11647
							this.params.callback(e.data);
11647
							this.params.callback(e.data);
11648
						
11648
 
11649
							}//if end
11649
							}//if end
11650
							
11650
 
11651
						//反之
11651
						//反之
11652
						else{
11652
						else{
11653
						
11653
 
11654
							//直接resolve結果
11654
							//直接resolve結果
11655
							resolve(e.data);
11655
							resolve(e.data);
11656
						
11656
 
11657
							}//else end
11657
							}//else end
11658
						
11658
 
11659
						}//function end
11659
						}//function end
11660
					
11660
 
11661
					//當連線斷開後
11661
					//當連線斷開後
11662
					conn.onclose = async function(e){
11662
					conn.onclose = async function(e){
11663
						
11663
 
11664
						//debug
11664
						//debug
11665
						console.log('onclose');
11665
						console.log('onclose');
11666
						
11666
 
11667
						//等待1秒
11667
						//等待1秒
11668
						await window.qbpwcf.sleep.func(1);
11668
						await window.qbpwcf.sleep.func(1);
11669
						
11669
 
11670
						//重新嘗試一次.
11670
						//重新嘗試一次.
11671
						this.mother.init(this.params);
11671
						this.mother.init(this.params);
11672
						
11672
 
11673
						}//function end
11673
						}//function end
11674
					
11674
 
11675
					//當遇到錯誤時
11675
					//當遇到錯誤時
11676
					conn.onerror = async function(e){
11676
					conn.onerror = async function(e){
11677
					
11677
 
11678
						//初始化要回傳的結果
11678
						//初始化要回傳的結果
11679
						var result={};
11679
						var result={};
11680
					
11680
 
11681
						//設置錯誤訊息
11681
						//設置錯誤訊息
11682
						result.error=e;
11682
						result.error=e;
11683
					
11683
 
11684
						//設置執行失敗
11684
						//設置執行失敗
11685
						result.status='false';
11685
						result.status='false';
11686
					
11686
 
11687
						//回傳結果, await 可以有結果.
11687
						//回傳結果, await 可以有結果.
11688
						reject(result);
11688
						reject(result);
11689
					
11689
 
11690
						}//function end
11690
						}//function end
11691
					
11691
 
11692
					//建立與當連線成功後
11692
					//建立與當連線成功後
11693
					conn.onopen = async function(e){ 
11693
					conn.onopen = async function(e){
11694
				
11694
 
11695
						//如果無要傳遞資料
11695
						//如果無要傳遞資料
11696
						if(params.data==undefined){
11696
						if(params.data==undefined){
11697
						
11697
 
11698
							//結束
11698
							//結束
11699
							return;
11699
							return;
11700
						
11700
 
11701
							}//if end
11701
							}//if end
11702
				
11702
 
11703
						//如果有要傳遞資料
11703
						//如果有要傳遞資料
11704
						if(params.data!={}){
11704
						if(params.data!={}){
11705
						
11705
 
11706
							//debug
11706
							//debug
11707
							console.log(params.data);
11707
							console.log(params.data);
11708
						
11708
 
11709
							//將訊息顯現在console
11709
							//將訊息顯現在console
11710
							console.log('send:'+JSON.stringify(params.data));
11710
							console.log('send:'+JSON.stringify(params.data));
11711
						
11711
 
11712
							//傳遞資料
11712
							//傳遞資料
11713
							conn.send(JSON.stringify(params.data));
11713
							conn.send(JSON.stringify(params.data));
11714
						
11714
 
11715
							}//if end
11715
							}//if end
11716
						
11716
 
11717
						}//function end
11717
						}//function end
11718
					
11718
 
11719
					}//if end
11719
					}//if end
11720
				
11720
 
11721
				//Promise must return something
11721
				//Promise must return something
11722
				resolve(null);
11722
				resolve(null);
11723
				
11723
 
11724
				});//Promise end
11724
				});//Promise end
11725
			
11725
 
11726
			}//function end
11726
			}//function end
11727
		
11727
 
11728
		";
11728
		";
11729
		
11729
 
11730
		#$conf["noScriptTag"],字串,是否不要輸出<script></script>,預設為"false",代表要輸出;反之為"true",代表不要輸出.
11730
		#$conf["noScriptTag"],字串,是否不要輸出<script></script>,預設為"false",代表要輸出;反之為"true",代表不要輸出.
11731
		$conf["javaScript::toScript"]["noScriptTag"]=$conf["noScriptTag"];
11731
		$conf["javaScript::toScript"]["noScriptTag"]=$conf["noScriptTag"];
11732
		
11732
 
11733
		#參考資料:
11733
		#參考資料:
11734
		#http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the
11734
		#http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the
11735
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
11735
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
11736
		unset($conf["javaScript::toScript"]);
11736
		unset($conf["javaScript::toScript"]);
11737
 
11737
 
Line 11968... Line 11968...
11968
 
11968
 
11969
		#回傳結果
11969
		#回傳結果
11970
		return $result;
11970
		return $result;
11971
 
11971
 
11972
		}#function conDownload end
11972
		}#function conDownload end
11973
		
11973
 
11974
	/*
11974
	/*
11975
	#函式說明:
11975
	#函式說明:
11976
	#建立rwd的置頂menu,橫向span選單遇到寬度不足會變成div選單,其中第一個元素爲Logo.
11976
	#建立rwd的置頂menu,橫向span選單遇到寬度不足會變成div選單,其中第一個元素爲Logo.
11977
	#回傳結果:
11977
	#回傳結果:
11978
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
11978
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 11982... Line 11982...
11982
	#必填參數:
11982
	#必填參數:
11983
	#$conf["firstEleId"],字串,選單的擡頭元素id.
11983
	#$conf["firstEleId"],字串,選單的擡頭元素id.
11984
	$conf["firstEleId"]="";
11984
	$conf["firstEleId"]="";
11985
	#$conf["otherEleClass"],字串,除擡頭選單外項目的共同類別名稱.
11985
	#$conf["otherEleClass"],字串,除擡頭選單外項目的共同類別名稱.
11986
	$conf["otherEleClass"]="";
11986
	$conf["otherEleClass"]="";
11987
	#可省略參數:	
11987
	#可省略參數:
11988
	#$conf["bgColor"],字串,選單的背景顏色,預設爲"#FFFFFF".
11988
	#$conf["bgColor"],字串,選單的背景顏色,預設爲"#FFFFFF".
11989
	#$conf["bgColor"]="";
11989
	#$conf["bgColor"]="";
11990
	#參考資料:
11990
	#參考資料:
11991
	#無.
11991
	#無.
11992
	#備註:
11992
	#備註:
11993
	#bgColor尚未實作
11993
	#bgColor尚未實作
11994
	#固定在頂端或底端的功能未實作
11994
	#固定在頂端或底端的功能未實作
11995
	*/
11995
	*/
11996
	public static function rwdMenu($conf){
11996
	public static function rwdMenu($conf){
11997
		
11997
 
11998
		return css::rwdMenu($conf);
11998
		return css::rwdMenu($conf);
11999
		
11999
 
12000
		}#function rwdMenu end
12000
		}#function rwdMenu end
12001
		
12001
 
12002
	/*
12002
	/*
12003
	#函式說明:
12003
	#函式說明:
12004
	#建立廣告幻燈片,實際上為div的背景會隨着時間變化.
12004
	#建立廣告幻燈片,實際上為div的背景會隨着時間變化.
12005
	#回傳結果:
12005
	#回傳結果:
12006
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
12006
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 12012... Line 12012...
12012
	$conf["divId"]="";
12012
	$conf["divId"]="";
12013
	#$conf["divClass"],字串,廣告區域用於套用動畫效果的div class名稱.
12013
	#$conf["divClass"],字串,廣告區域用於套用動畫效果的div class名稱.
12014
	$conf["divClass"]="";
12014
	$conf["divClass"]="";
12015
	#$conf["adImg"],字串陣列,廣告圖片的網站陣列.
12015
	#$conf["adImg"],字串陣列,廣告圖片的網站陣列.
12016
	$conf["adImg"]=array();
12016
	$conf["adImg"]=array();
12017
	#可省略參數:	
12017
	#可省略參數:
12018
	#無.
12018
	#無.
12019
	#參考資料:
12019
	#參考資料:
12020
	#無.
12020
	#無.
12021
	#備註:
12021
	#備註:
12022
	#bgColor尚未實作
12022
	#bgColor尚未實作
12023
	#固定在頂端或底端的功能未實作
12023
	#固定在頂端或底端的功能未實作
12024
	*/
12024
	*/
12025
	public static function adImg($conf){
12025
	public static function adImg($conf){
12026
	
12026
 
12027
		#初始化要回傳的結果
12027
		#初始化要回傳的結果
12028
		$result=array();
12028
		$result=array();
12029
 
12029
 
12030
		#取得當前執行的函數名稱
12030
		#取得當前執行的函數名稱
12031
		$result["function"]=__FUNCTION__;
12031
		$result["function"]=__FUNCTION__;
Line 12135... Line 12135...
12135
 
12135
 
12136
			#回傳結果
12136
			#回傳結果
12137
			return $result;
12137
			return $result;
12138
 
12138
 
12139
			}#if end
12139
			}#if end
12140
		
12140
 
12141
		#初始化要回傳的語法
12141
		#初始化要回傳的語法
12142
		$result["content"]="";
12142
		$result["content"]="";
12143
	
12143
 
12144
		#ad bar
12144
		#ad bar
12145
		#函式說明:
12145
		#函式說明:
12146
		#<div>區塊,裡面可以指定css的class樣式,可以指定提示文字.
12146
		#<div>區塊,裡面可以指定css的class樣式,可以指定提示文字.
12147
		#$result["status"],字串,執行否正常,"true"代表正常,"false"代表不正常.
12147
		#$result["status"],字串,執行否正常,"true"代表正常,"false"代表不正常.
12148
		#$result["functin"],字串,當前函數的名稱.
12148
		#$result["functin"],字串,當前函數的名稱.
Line 12171... Line 12171...
12171
		$divSection=css::divSection($conf["css::divSection"]);
12171
		$divSection=css::divSection($conf["css::divSection"]);
12172
		unset($conf["css::divSection"]);
12172
		unset($conf["css::divSection"]);
12173
 
12173
 
12174
		#如果建立div區塊失敗
12174
		#如果建立div區塊失敗
12175
		if($divSection["status"]==="false"){
12175
		if($divSection["status"]==="false"){
12176
			
12176
 
12177
			#設置執行失敗
12177
			#設置執行失敗
12178
			$result["status"]="false";
12178
			$result["status"]="false";
12179
		
12179
 
12180
			#設置錯誤訊息
12180
			#設置錯誤訊息
12181
			$result["error"]=$divSection;
12181
			$result["error"]=$divSection;
12182
			
12182
 
12183
			#回傳結果
12183
			#回傳結果
12184
			return $result;
12184
			return $result;
12185
			
12185
 
12186
			}#if end
12186
			}#if end
12187
 
12187
 
12188
		#儲存內容
12188
		#儲存內容
12189
		$result["content"]=$result["content"].$divSection["content"];
12189
		$result["content"]=$result["content"].$divSection["content"];
12190
	
12190
 
12191
		#儲存廣告圖片的計數
12191
		#儲存廣告圖片的計數
12192
		$adImgCount=count($conf["adImg"]);
12192
		$adImgCount=count($conf["adImg"]);
12193
	
12193
 
12194
		#函式說明:
12194
		#函式說明:
12195
		#製作針對 css class 的動畫,請套用在div上,才會有效果
12195
		#製作針對 css class 的動畫,請套用在div上,才會有效果
12196
		#回傳結果:
12196
		#回傳結果:
12197
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
12197
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
12198
		#$result["content"],css動畫設定的語法
12198
		#$result["content"],css動畫設定的語法
Line 12213... Line 12213...
12213
		#$conf["delay"],字串,動畫要延遲幾秒開始,例如"0s".
12213
		#$conf["delay"],字串,動畫要延遲幾秒開始,例如"0s".
12214
		$conf["css::animation"]["delay"]="0s";
12214
		$conf["css::animation"]["delay"]="0s";
12215
		#$conf["speedMode"],字串,動畫執行過程的速度要用什麼模式來執行,"linear"代表等速,"ease"代表起始跟結尾是靜止的,中間是最快的.
12215
		#$conf["speedMode"],字串,動畫執行過程的速度要用什麼模式來執行,"linear"代表等速,"ease"代表起始跟結尾是靜止的,中間是最快的.
12216
		$conf["css::animation"]["speedMode"]="linear";
12216
		$conf["css::animation"]["speedMode"]="linear";
12217
		#可省略參數:
12217
		#可省略參數:
12218
		
12218
 
12219
		#每個廣告圖片的依存時間百分比.
12219
		#每個廣告圖片的依存時間百分比.
12220
		$perImgPercentage=(int)(100/$adImgCount/2);
12220
		$perImgPercentage=(int)(100/$adImgCount/2);
12221
		
12221
 
12222
		#$conf["keyFrameStartPoint"],字串陣列,各個動畫單位開始的時間百分比,"0%"與"from"代表一開始,"100%"與"to"代表時間結束.
12222
		#$conf["keyFrameStartPoint"],字串陣列,各個動畫單位開始的時間百分比,"0%"與"from"代表一開始,"100%"與"to"代表時間結束.
12223
		#$conf["css::animation"]["keyFrameStartPoint"]=array("0%","10%","30%","70%","90%","100%");
12223
		#$conf["css::animation"]["keyFrameStartPoint"]=array("0%","10%","30%","70%","90%","100%");
12224
				
12224
 
12225
		#針對每個廣告圖片
12225
		#針對每個廣告圖片
12226
		for($i=1;$i<=$adImgCount*2;$i=$i+2){
12226
		for($i=1;$i<=$adImgCount*2;$i=$i+2){
12227
		
12227
 
12228
			#如果是第一個
12228
			#如果是第一個
12229
			if($i===1){
12229
			if($i===1){
12230
			
12230
 
12231
				#起始點
12231
				#起始點
12232
				$conf["css::animation"]["keyFrameStartPoint"][]="0%";			
12232
				$conf["css::animation"]["keyFrameStartPoint"][]="0%";
12233
				$conf["css::animation"]["keyFrameStartPoint"][]=$perImgPercentage*$i."%";
12233
				$conf["css::animation"]["keyFrameStartPoint"][]=$perImgPercentage*$i."%";
12234
									
12234
 
12235
				}#if end
12235
				}#if end
12236
		
12236
 
12237
			#反之如果是最後一個
12237
			#反之如果是最後一個
12238
			else if($i===$adImgCount*2-1){
12238
			else if($i===$adImgCount*2-1){
12239
			
12239
 
12240
				#最後一點
12240
				#最後一點
12241
				$conf["css::animation"]["keyFrameStartPoint"][]=$perImgPercentage*($i)."%";
12241
				$conf["css::animation"]["keyFrameStartPoint"][]=$perImgPercentage*($i)."%";
12242
				$conf["css::animation"]["keyFrameStartPoint"][]="100%";
12242
				$conf["css::animation"]["keyFrameStartPoint"][]="100%";
12243
											
12243
 
12244
				}#if end
12244
				}#if end
12245
				
12245
 
12246
			#其他狀況
12246
			#其他狀況
12247
			else{
12247
			else{
12248
				#擺兩個點,在區間內呈現
12248
				#擺兩個點,在區間內呈現
12249
				$conf["css::animation"]["keyFrameStartPoint"][]=$perImgPercentage*($i-1)."%";
12249
				$conf["css::animation"]["keyFrameStartPoint"][]=$perImgPercentage*($i-1)."%";
12250
				
12250
 
12251
				#$i多加1
12251
				#$i多加1
12252
				$conf["css::animation"]["keyFrameStartPoint"][]=$perImgPercentage*($i+1)."%";
12252
				$conf["css::animation"]["keyFrameStartPoint"][]=$perImgPercentage*($i+1)."%";
12253
							
12253
 
12254
				}#else end
12254
				}#else end
12255
			
12255
 
12256
			}#for end
12256
			}#for end
12257
			
12257
 
12258
		#debug
12258
		#debug
12259
		#var_dump($conf["css::animation"]["keyFrameStartPoint"]);
12259
		#var_dump($conf["css::animation"]["keyFrameStartPoint"]);
12260
		
12260
 
12261
		#$conf["keyFrameCssMoveAttribute"],二維字串陣列,各個動畫影格子的與動畫相關的css屬性.
12261
		#$conf["keyFrameCssMoveAttribute"],二維字串陣列,各個動畫影格子的與動畫相關的css屬性.
12262
		#$conf["keyFrameCssMoveAttribute"][]=array();
12262
		#$conf["keyFrameCssMoveAttribute"][]=array();
12263
		#$conf["keyFrameCssMoveValue"],二維字串陣列,各個動畫影格子的與動畫相關的css屬性.
12263
		#$conf["keyFrameCssMoveValue"],二維字串陣列,各個動畫影格子的與動畫相關的css屬性.
12264
		#$conf["keyFrameCssMoveValue"][]=array();
12264
		#$conf["keyFrameCssMoveValue"][]=array();
12265
		
12265
 
12266
		#$conf["keyFrameCssAttribute"],二維字串陣列,各個動畫影格子的一般非動畫的css屬性.
12266
		#$conf["keyFrameCssAttribute"],二維字串陣列,各個動畫影格子的一般非動畫的css屬性.
12267
		
12267
 
12268
		#跑 $adImgCount*2 的次數
12268
		#跑 $adImgCount*2 的次數
12269
		for($i=0;$i<$adImgCount*2;$i++){
12269
		for($i=0;$i<$adImgCount*2;$i++){
12270
		
12270
 
12271
			$conf["css::animation"]["keyFrameCssAttribute"][]=array("background-image");
12271
			$conf["css::animation"]["keyFrameCssAttribute"][]=array("background-image");
12272
				
12272
 
12273
			}#for end
12273
			}#for end
12274
			
12274
 
12275
		#$conf["keyFrameCssValue"],二維字串陣列,各個動畫格子的css屬性數值.
12275
		#$conf["keyFrameCssValue"],二維字串陣列,各個動畫格子的css屬性數值.
12276
		
12276
 
12277
		#跑 $adImgCount 的次數
12277
		#跑 $adImgCount 的次數
12278
		for($i=0;$i<$adImgCount;$i++){
12278
		for($i=0;$i<$adImgCount;$i++){
12279
		
12279
 
12280
			#兩個點的圖片要一致
12280
			#兩個點的圖片要一致
12281
			$conf["css::animation"]["keyFrameCssValue"][]=array("url('".$conf["adImg"][$i]."')");
12281
			$conf["css::animation"]["keyFrameCssValue"][]=array("url('".$conf["adImg"][$i]."')");
12282
			$conf["css::animation"]["keyFrameCssValue"][]=array("url('".$conf["adImg"][$i]."')");
12282
			$conf["css::animation"]["keyFrameCssValue"][]=array("url('".$conf["adImg"][$i]."')");
12283
			
12283
 
12284
			}#for end
12284
			}#for end
12285
		
12285
 
12286
		#參考資料:
12286
		#參考資料:
12287
		#css動畫,http://blogger.gtwang.org/2013/12/using-css3-animation.html
12287
		#css動畫,http://blogger.gtwang.org/2013/12/using-css3-animation.html
12288
		#w3c的animation-keyframes,http://www.w3schools.com/cssref/css3_pr_animation-keyframes.asp
12288
		#w3c的animation-keyframes,http://www.w3schools.com/cssref/css3_pr_animation-keyframes.asp
12289
		$animation=css::animation($conf["css::animation"]);
12289
		$animation=css::animation($conf["css::animation"]);
12290
		unset($conf["css::animation"]);
12290
		unset($conf["css::animation"]);
12291
	
12291
 
12292
		#如果建立動畫失敗
12292
		#如果建立動畫失敗
12293
		if($animation["status"]==="false"){
12293
		if($animation["status"]==="false"){
12294
		
12294
 
12295
			#設置執行失敗
12295
			#設置執行失敗
12296
			$result["status"]="false";
12296
			$result["status"]="false";
12297
		
12297
 
12298
			#設置錯誤訊息
12298
			#設置錯誤訊息
12299
			$result["error"]=$animation;
12299
			$result["error"]=$animation;
12300
			
12300
 
12301
			#回傳結果
12301
			#回傳結果
12302
			return $result;
12302
			return $result;
12303
		
12303
 
12304
			}#if end
12304
			}#if end
12305
 
12305
 
12306
		#儲存內容
12306
		#儲存內容
12307
		$result["content"]=$result["content"].$animation["content"];
12307
		$result["content"]=$result["content"].$animation["content"];
12308
		
12308
 
12309
		#函式說明:
12309
		#函式說明:
12310
		#將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).
12310
		#將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).
12311
		#回傳結果:
12311
		#回傳結果:
12312
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
12312
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
12313
		#$result["error"],錯誤訊息陣列
12313
		#$result["error"],錯誤訊息陣列
Line 12317... Line 12317...
12317
		#$conf["script"],字串,要執行的javaScript語法.
12317
		#$conf["script"],字串,要執行的javaScript語法.
12318
		$conf["javaScript::toScript"]["script"]=
12318
		$conf["javaScript::toScript"]["script"]=
12319
		"
12319
		"
12320
		//debug
12320
		//debug
12321
		console.log('loaded');
12321
		console.log('loaded');
12322
		
12322
 
12323
		//get scroll div
12323
		//get scroll div
12324
		var scrollDiv=document.getElementById('".$conf["divId"]."');
12324
		var scrollDiv=document.getElementById('".$conf["divId"]."');
12325
		
12325
 
12326
		//set click one to 0
12326
		//set click one to 0
12327
		scrollDiv.dataset.clickOnce=0;	
12327
		scrollDiv.dataset.clickOnce=0;
12328
				
12328
 
12329
		//scrolliv click event
12329
		//scrolliv click event
12330
		scrollDiv.addEventListener('click',function(e){
12330
		scrollDiv.addEventListener('click',function(e){
12331
					
12331
 
12332
			//set scroll div id
12332
			//set scroll div id
12333
			var scrollDivId='".$conf["divId"]."';
12333
			var scrollDivId='".$conf["divId"]."';
12334
					
12334
 
12335
			//get scroll div
12335
			//get scroll div
12336
			var scrollDiv=document.getElementById(scrollDivId);
12336
			var scrollDiv=document.getElementById(scrollDivId);
12337
				
12337
 
12338
			//如果已經點擊過一次了
12338
			//如果已經點擊過一次了
12339
			if(scrollDiv.dataset.clickOnce==='1'){
12339
			if(scrollDiv.dataset.clickOnce==='1'){
12340
 
12340
 
12341
				//結束事件
12341
				//結束事件
12342
				return true;
12342
				return true;
12343
			
12343
 
12344
				}//if end	
12344
				}//if end
12345
					
12345
 
12346
			//觸發者非div
12346
			//觸發者非div
12347
			if(e.target.id!==scrollDivId){
12347
			if(e.target.id!==scrollDivId){
12348
				
12348
 
12349
				//debug
12349
				//debug
12350
				console.log(e.target.id+'!=='+scrollDivId);
12350
				console.log(e.target.id+'!=='+scrollDivId);
12351
				
12351
 
12352
				//debug
12352
				//debug
12353
				console.log(e.target);
12353
				console.log(e.target);
12354
				
12354
 
12355
				//end function
12355
				//end function
12356
				return false;
12356
				return false;
12357
				
12357
 
12358
				}//if end
12358
				}//if end
12359
			
12359
 
12360
			//debug
12360
			//debug
12361
			console.log(e.target);
12361
			console.log(e.target);
12362
			
12362
 
12363
			//get target computed style
12363
			//get target computed style
12364
			var tcs=window.getComputedStyle(e.target,null);
12364
			var tcs=window.getComputedStyle(e.target,null);
12365
			
12365
 
12366
			//debug
12366
			//debug
12367
			console.log(tcs);
12367
			console.log(tcs);
12368
					
12368
 
12369
			//get style background image url
12369
			//get style background image url
12370
			var tcsBg=tcs.backgroundImage;
12370
			var tcsBg=tcs.backgroundImage;
12371
			
12371
 
12372
			//debug
12372
			//debug
12373
			console.log(tcsBg);
12373
			console.log(tcsBg);
12374
			
12374
 
12375
			//split by '/'
12375
			//split by '/'
12376
			var splitedStr=tcsBg.split('/');
12376
			var splitedStr=tcsBg.split('/');
12377
			
12377
 
12378
			//debug 
12378
			//debug
12379
			for(i=0;i<splitedStr.length;i++){
12379
			for(i=0;i<splitedStr.length;i++){
12380
				
12380
 
12381
				//show each section str
12381
				//show each section str
12382
				console.log(splitedStr[i]);
12382
				console.log(splitedStr[i]);
12383
				
12383
 
12384
				}//for end
12384
				}//for end
12385
				
12385
 
12386
			//get clicked image file name
12386
			//get clicked image file name
12387
			var clickedImgName=splitedStr[splitedStr.length-1].split('\")')[0];	
12387
			var clickedImgName=splitedStr[splitedStr.length-1].split('\")')[0];
12388
			
12388
 
12389
			//debug
12389
			//debug
12390
			console.log(clickedImgName);
12390
			console.log(clickedImgName);
12391
				
12391
 
12392
			//split by '\"'
12392
			//split by '\"'
12393
			var splitedStr=tcsBg.split('\"');
12393
			var splitedStr=tcsBg.split('\"');
12394
			
12394
 
12395
			//get clickedImgUrl
12395
			//get clickedImgUrl
12396
			var clickedImgUrl=splitedStr[1];	
12396
			var clickedImgUrl=splitedStr[1];
12397
				
12397
 
12398
			//debug
12398
			//debug
12399
			console.log(clickedImgUrl);	
12399
			console.log(clickedImgUrl);
12400
							
12400
 
12401
			//delete applied class
12401
			//delete applied class
12402
			scrollDiv.classList={};
12402
			scrollDiv.classList={};
12403
			
12403
 
12404
			//set clicked image
12404
			//set clicked image
12405
			scrollDiv.style.backgroundImage='url('+clickedImgUrl+')';
12405
			scrollDiv.style.backgroundImage='url('+clickedImgUrl+')';
12406
			
12406
 
12407
			//設置點擊過一次了
12407
			//設置點擊過一次了
12408
			scrollDiv.dataset.clickOnce='1';
12408
			scrollDiv.dataset.clickOnce='1';
12409
 
12409
 
12410
			//scrolliv click event
12410
			//scrolliv click event
12411
			scrollDiv.addEventListener('click',function(e){
12411
			scrollDiv.addEventListener('click',function(e){
12412
						
12412
 
12413
				//set scroll div id
12413
				//set scroll div id
12414
				var scrollDivId='".$conf["divId"]."';
12414
				var scrollDivId='".$conf["divId"]."';
12415
						
12415
 
12416
				//get scroll div
12416
				//get scroll div
12417
				var scrollDiv=document.getElementById(scrollDivId);
12417
				var scrollDiv=document.getElementById(scrollDivId);
12418
					
12418
 
12419
				//如果已經點擊過一次了
12419
				//如果已經點擊過一次了
12420
				if(scrollDiv.dataset.clickOnce!=='1'){
12420
				if(scrollDiv.dataset.clickOnce!=='1'){
12421
 
12421
 
12422
					//結束執行
12422
					//結束執行
12423
					return true;
12423
					return true;
12424
					
12424
 
12425
					}//if end
12425
					}//if end
12426
					
12426
 
12427
				//debug
12427
				//debug
12428
				console.log('should change to next pic');
12428
				console.log('should change to next pic');
12429
								
12429
 
12430
				//debug
12430
				//debug
12431
				console.log(e.target);
12431
				console.log(e.target);
12432
				
12432
 
12433
				//get target computed style
12433
				//get target computed style
12434
				var tcs=window.getComputedStyle(e.target,null);
12434
				var tcs=window.getComputedStyle(e.target,null);
12435
				
12435
 
12436
				//debug
12436
				//debug
12437
				console.log(tcs);
12437
				console.log(tcs);
12438
						
12438
 
12439
				//get style background image url
12439
				//get style background image url
12440
				var tcsBg=tcs.backgroundImage;
12440
				var tcsBg=tcs.backgroundImage;
12441
				
12441
 
12442
				//debug
12442
				//debug
12443
				console.log(tcsBg);
12443
				console.log(tcsBg);
12444
				
12444
 
12445
				//split by '/'
12445
				//split by '/'
12446
				var splitedStr=tcsBg.split('/');
12446
				var splitedStr=tcsBg.split('/');
12447
				
12447
 
12448
				//debug 
12448
				//debug
12449
				for(i=0;i<splitedStr.length;i++){
12449
				for(i=0;i<splitedStr.length;i++){
12450
					
12450
 
12451
					//show each section str
12451
					//show each section str
12452
					console.log(splitedStr[i]);
12452
					console.log(splitedStr[i]);
12453
					
12453
 
12454
					}//for end
12454
					}//for end
12455
					
12455
 
12456
				//get clicked image file name
12456
				//get clicked image file name
12457
				var clickedImgName=splitedStr[splitedStr.length-1].split('\")')[0];	
12457
				var clickedImgName=splitedStr[splitedStr.length-1].split('\")')[0];
12458
				
12458
 
12459
				//debug
12459
				//debug
12460
				console.log(clickedImgName);
12460
				console.log(clickedImgName);
12461
					
12461
 
12462
				//split by '\"'
12462
				//split by '\"'
12463
				var splitedStr=tcsBg.split('\"');
12463
				var splitedStr=tcsBg.split('\"');
12464
				
12464
 
12465
				//get clickedImgUrl
12465
				//get clickedImgUrl
12466
				var clickedImgUrl=splitedStr[1];	
12466
				var clickedImgUrl=splitedStr[1];
12467
					
12467
 
12468
				//debug
12468
				//debug
12469
				console.log(clickedImgUrl);	
12469
				console.log(clickedImgUrl);
12470
				
12470
 
12471
				//set img array
12471
				//set img array
12472
				var imgArray=".json_encode($conf["adImg"]).";
12472
				var imgArray=".json_encode($conf["adImg"]).";
12473
				
12473
 
12474
				//無窮迴圈
12474
				//無窮迴圈
12475
				for(i=0;i<".$adImgCount.";i++){
12475
				for(i=0;i<".$adImgCount.";i++){
12476
				
12476
 
12477
					//如果找到點擊的圖片
12477
					//如果找到點擊的圖片
12478
					if(clickedImgUrl.includes(imgArray[i])){
12478
					if(clickedImgUrl.includes(imgArray[i])){
12479
					
12479
 
12480
						//debug
12480
						//debug
12481
						console.log(i+'<".$adImgCount."');
12481
						console.log(i+'<".$adImgCount."');
12482
					
12482
 
12483
						//如果是最後一張圖片
12483
						//如果是最後一張圖片
12484
						if(i===".$adImgCount."-1){
12484
						if(i===".$adImgCount."-1){
12485
						
12485
 
12486
							//設置為第一張圖片
12486
							//設置為第一張圖片
12487
							i=0;
12487
							i=0;
12488
						
12488
 
12489
							}
12489
							}
12490
						
12490
 
12491
						//反之+1
12491
						//反之+1
12492
						else{
12492
						else{
12493
						
12493
 
12494
							i++;
12494
							i++;
12495
						
12495
 
12496
							}//else end
12496
							}//else end
12497
					
12497
 
12498
						//debug
12498
						//debug
12499
						console.log('set img to '+imgArray[i]);
12499
						console.log('set img to '+imgArray[i]);
12500
					
12500
 
12501
						//set clicked image
12501
						//set clicked image
12502
						scrollDiv.style.backgroundImage='url('+imgArray[i]+')';
12502
						scrollDiv.style.backgroundImage='url('+imgArray[i]+')';
12503
				
12503
 
12504
						//debug
12504
						//debug
12505
						console.log('end for');
12505
						console.log('end for');
12506
				
12506
 
12507
						//end for
12507
						//end for
12508
						break;
12508
						break;
12509
				
12509
 
12510
						}//if end
12510
						}//if end
12511
				
12511
 
12512
					}//for end
12512
					}//for end
12513
					
12513
 
12514
				});//scrollDiv addEventListener end
12514
				});//scrollDiv addEventListener end
12515
			
12515
 
12516
			});//scrollDiv click event end
12516
			});//scrollDiv click event end
12517
		";
12517
		";
12518
		#可省略參數:
12518
		#可省略參數:
12519
		#$conf["onReady"],字串,是否要在網頁完全載入後再執行,"false"為不等載入完就先執行,預設為"true"要等載入完再執行.
12519
		#$conf["onReady"],字串,是否要在網頁完全載入後再執行,"false"為不等載入完就先執行,預設為"true"要等載入完再執行.
12520
		#$conf["onReady"]="true";
12520
		#$conf["onReady"]="true";
Line 12524... Line 12524...
12524
		#$conf["jsFunciton"]=array();
12524
		#$conf["jsFunciton"]=array();
12525
		#參考資料:
12525
		#參考資料:
12526
		#http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the
12526
		#http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the
12527
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
12527
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
12528
		unset($conf["javaScript::toScript"]);
12528
		unset($conf["javaScript::toScript"]);
12529
		
12529
 
12530
		#如果建立 script 語法失敗
12530
		#如果建立 script 語法失敗
12531
		if($toScript["status"]==="false"){
12531
		if($toScript["status"]==="false"){
12532
		
12532
 
12533
			#設置執行失敗
12533
			#設置執行失敗
12534
			$result["status"]="false";
12534
			$result["status"]="false";
12535
		
12535
 
12536
			#設置錯誤訊息
12536
			#設置錯誤訊息
12537
			$result["error"]=$toScript;
12537
			$result["error"]=$toScript;
12538
			
12538
 
12539
			#回傳結果
12539
			#回傳結果
12540
			return $result;
12540
			return $result;
12541
		
12541
 
12542
			}#if end
12542
			}#if end
12543
		
12543
 
12544
		#儲存內容
12544
		#儲存內容
12545
		$result["content"]=$result["content"].$toScript["content"];
12545
		$result["content"]=$result["content"].$toScript["content"];
12546
			
12546
 
12547
		#設置執行正常
12547
		#設置執行正常
12548
		$result["status"]="true";
12548
		$result["status"]="true";
12549
		
12549
 
12550
		#回傳結果
12550
		#回傳結果
12551
		return $result;	
12551
		return $result;
12552
				
12552
 
12553
		}//function adImg end
12553
		}//function adImg end
12554
		
12554
 
12555
	/*
12555
	/*
12556
	#函式說明:
12556
	#函式說明:
12557
	#區塊輪播的效果
12557
	#區塊輪播的效果
12558
	#回傳結果:
12558
	#回傳結果:
12559
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
12559
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 12563... Line 12563...
12563
	#必填參數:
12563
	#必填參數:
12564
	#$conf["place"],字串,輪播區塊要在哪個元素裡面呈現,其區塊特徵為何?(請參閱javascript的querySelector函式).
12564
	#$conf["place"],字串,輪播區塊要在哪個元素裡面呈現,其區塊特徵為何?(請參閱javascript的querySelector函式).
12565
	$conf["place"]="";
12565
	$conf["place"]="";
12566
	#$conf["slideDiv"],字串陣列,每個投影片的div區塊特徵(請參閱javascript的querySelector函式).
12566
	#$conf["slideDiv"],字串陣列,每個投影片的div區塊特徵(請參閱javascript的querySelector函式).
12567
	$conf["slideDiv"]=array("");
12567
	$conf["slideDiv"]=array("");
12568
	#可省略參數:	
12568
	#可省略參數:
12569
	#$conf["sec"],字串,過幾秒就要置換成下一張投影片,預設為"5",代表每5秒就換一張投影片.
12569
	#$conf["sec"],字串,過幾秒就要置換成下一張投影片,預設為"5",代表每5秒就換一張投影片.
12570
	#$conf["sec"]="5";
12570
	#$conf["sec"]="5";
12571
	#參考資料:
12571
	#參考資料:
12572
	#無.
12572
	#無.
12573
	#備註:
12573
	#備註:
Line 12686... Line 12686...
12686
 
12686
 
12687
			#回傳結果
12687
			#回傳結果
12688
			return $result;
12688
			return $result;
12689
 
12689
 
12690
			}#if end
12690
			}#if end
12691
		
12691
 
12692
		#初始化要回傳的語法
12692
		#初始化要回傳的語法
12693
		$result["content"]="";
12693
		$result["content"]="";
12694
		
12694
 
12695
		#函式說明:
12695
		#函式說明:
12696
		#將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).
12696
		#將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).
12697
		#回傳結果:
12697
		#回傳結果:
12698
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
12698
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
12699
		#$result["error"],錯誤訊息陣列
12699
		#$result["error"],錯誤訊息陣列
Line 12703... Line 12703...
12703
		#$conf["script"],字串,要執行的javaScript語法.
12703
		#$conf["script"],字串,要執行的javaScript語法.
12704
		$conf["javaScript::toScript"]["script"]=
12704
		$conf["javaScript::toScript"]["script"]=
12705
		"
12705
		"
12706
		//取得內部要放置投影片內容的區塊
12706
		//取得內部要放置投影片內容的區塊
12707
		var displayArea=document.querySelector('".$conf["place"]."');
12707
		var displayArea=document.querySelector('".$conf["place"]."');
12708
		
12708
 
12709
		//get left value
12709
		//get left value
12710
		var leftP=displayArea.offsetLeft+'px';
12710
		var leftP=displayArea.offsetLeft+'px';
12711
	
12711
 
12712
		//get top value
12712
		//get top value
12713
		var topP=displayArea.offsetTop+'px';
12713
		var topP=displayArea.offsetTop+'px';
12714
	
12714
 
12715
		//get width value
12715
		//get width value
12716
		var widthP=displayArea.clientWidth; 
12716
		var widthP=displayArea.clientWidth;
12717
		
12717
 
12718
		//get height value
12718
		//get height value
12719
		var heightP=displayArea.clientHeight; 
12719
		var heightP=displayArea.clientHeight;
12720
		
12720
 
12721
		//不顯示原始內容
12721
		//不顯示原始內容
12722
		displayArea.style.opacity=0;
12722
		displayArea.style.opacity=0;
12723
		displayArea.style.zIndex=-1;
12723
		displayArea.style.zIndex=-1;
12724
		
12724
 
12725
		//取得投影片的數量
12725
		//取得投影片的數量
12726
		var slideCount=".count($conf["slideDiv"])."
12726
		var slideCount=".count($conf["slideDiv"])."
12727
		
12727
 
12728
		//宣告儲存投影片陣列的變數
12728
		//宣告儲存投影片陣列的變數
12729
		var slide=[];
12729
		var slide=[];
12730
		
12730
 
12731
		";
12731
		";
12732
		
12732
 
12733
		#針對每個投影片
12733
		#針對每個投影片
12734
		foreach($conf["slideDiv"] as $index=>$slide)
12734
		foreach($conf["slideDiv"] as $index=>$slide)
12735
		{
12735
		{
12736
			#串接js內容
12736
			#串接js內容
12737
			$conf["javaScript::toScript"]["script"]=$conf["javaScript::toScript"]["script"].
12737
			$conf["javaScript::toScript"]["script"]=$conf["javaScript::toScript"]["script"].
12738
			"
12738
			"
12739
			//取得投影片的區塊元素
12739
			//取得投影片的區塊元素
12740
			var content=document.querySelector('".$slide."');
12740
			var content=document.querySelector('".$slide."');
12741
			
12741
 
12742
			//強制設定其位置為看不到的地方
12742
			//強制設定其位置為看不到的地方
12743
			content.style.position='absolute';
12743
			content.style.position='absolute';
12744
			content.style.left='-100vw';
12744
			content.style.left='-100vw';
12745
			content.style.top='-100vh';
12745
			content.style.top='-100vh';
12746
			
12746
 
12747
			//設置投影片的資訊
12747
			//設置投影片的資訊
12748
			var info={};
12748
			var info={};
12749
			
12749
 
12750
			//設置投影片的left資訊
12750
			//設置投影片的left資訊
12751
			info.left=getComputedStyle(content).left;
12751
			info.left=getComputedStyle(content).left;
12752
			
12752
 
12753
			//設置投影片的top資訊
12753
			//設置投影片的top資訊
12754
			info.top=getComputedStyle(content).top;
12754
			info.top=getComputedStyle(content).top;
12755
			
12755
 
12756
			//初始化儲存單一投影片的結構
12756
			//初始化儲存單一投影片的結構
12757
			var slideObject={};
12757
			var slideObject={};
12758
			
12758
 
12759
			//設置投影片的內容
12759
			//設置投影片的內容
12760
			slideObject.content=content;
12760
			slideObject.content=content;
12761
			
12761
 
12762
			//設置投影片的資訊
12762
			//設置投影片的資訊
12763
			slideObject.info=info;
12763
			slideObject.info=info;
12764
			
12764
 
12765
			//儲存投影片到陣列
12765
			//儲存投影片到陣列
12766
			slide.push(slideObject);
12766
			slide.push(slideObject);
12767
			
12767
 
12768
			";
12768
			";
12769
		}
12769
		}
12770
		
12770
 
12771
		#串接js的內容.
12771
		#串接js的內容.
12772
		$conf["javaScript::toScript"]["script"]=$conf["javaScript::toScript"]["script"].
12772
		$conf["javaScript::toScript"]["script"]=$conf["javaScript::toScript"]["script"].
12773
		"
12773
		"
12774
		
12774
 
12775
		//debug
12775
		//debug
12776
		//console.log(slide);
12776
		//console.log(slide);
12777
		
12777
 
12778
		//設置投影片置換的等待秒數
12778
		//設置投影片置換的等待秒數
12779
		var sec=".$conf["sec"].";
12779
		var sec=".$conf["sec"].";
12780
		
12780
 
12781
		//設置等待時間的函式
12781
		//設置等待時間的函式
12782
		var timeout=function(sec)
12782
		var timeout=function(sec)
12783
		{
12783
		{
12784
			return new Promise(resolve => 
12784
			return new Promise(resolve =>
12785
			{
12785
			{
12786
				setTimeout(() => 
12786
				setTimeout(() =>
12787
				{
12787
				{
12788
					resolve(sec);
12788
					resolve(sec);
12789
				}, sec*1000);
12789
				}, sec*1000);
12790
			});
12790
			});
12791
		}
12791
		}
12792
		
12792
 
12793
		//建立與執行隨着畫面大小改變而更新播放區域資訊的函式
12793
		//建立與執行隨着畫面大小改變而更新播放區域資訊的函式
12794
		var updateDisplayInfo=window.addEventListener('resize',function()
12794
		var updateDisplayInfo=window.addEventListener('resize',function()
12795
		{
12795
		{
12796
			//更新投影區域資訊
12796
			//更新投影區域資訊
12797
			leftP=displayArea.offsetLeft+'px';
12797
			leftP=displayArea.offsetLeft+'px';
12798
			topP=displayArea.offsetTop+'px';
12798
			topP=displayArea.offsetTop+'px';
12799
			widthP=displayArea.clientWidth+'px'; 
12799
			widthP=displayArea.clientWidth+'px';
12800
			heightP=displayArea.clientHeight+'px'; 
12800
			heightP=displayArea.clientHeight+'px';
12801
			
12801
 
12802
			//初始化要更新的投影片索引為-1
12802
			//初始化要更新的投影片索引為-1
12803
			var showedSlideIndex=-1;
12803
			var showedSlideIndex=-1;
12804
			
12804
 
12805
			//針對每個投影片
12805
			//針對每個投影片
12806
			for(var i=0;i<slideCount;i++)
12806
			for(var i=0;i<slideCount;i++)
12807
			{
12807
			{
12808
				//如果是正在顯示的投影片
12808
				//如果是正在顯示的投影片
12809
				if(slide[i].content.dataset.show==='true')
12809
				if(slide[i].content.dataset.show==='true')
12810
				{
12810
				{
12811
					//取得當前播放的投影片索引
12811
					//取得當前播放的投影片索引
12812
					showedSlideIndex=i;
12812
					showedSlideIndex=i;
12813
				}
12813
				}
12814
			}
12814
			}
12815
			
12815
 
12816
			//如果有抓取到正在播放的投影片索引
12816
			//如果有抓取到正在播放的投影片索引
12817
			if(showedSlideIndex!==-1)
12817
			if(showedSlideIndex!==-1)
12818
			{
12818
			{
12819
			
12819
 
12820
				//更新正在投影的投影片
12820
				//更新正在投影的投影片
12821
				slide[showedSlideIndex].content.style.top=topP;
12821
				slide[showedSlideIndex].content.style.top=topP;
12822
				slide[showedSlideIndex].content.style.left=leftP;
12822
				slide[showedSlideIndex].content.style.left=leftP;
12823
				slide[showedSlideIndex].content.style.width=widthP;
12823
				slide[showedSlideIndex].content.style.width=widthP;
12824
				slide[showedSlideIndex].content.style.height=heightP;
12824
				slide[showedSlideIndex].content.style.height=heightP;
12825
			}
12825
			}
12826
		});
12826
		});
12827
		
12827
 
12828
		//宣告置換投影片的函式
12828
		//宣告置換投影片的函式
12829
		var changeSlide=async function(page)
12829
		var changeSlide=async function(page)
12830
		{
12830
		{
12831
			//debug
12831
			//debug
12832
			//console.log('start chaneg slide');
12832
			//console.log('start chaneg slide');
12833
			
12833
 
12834
			//如果要顯示的投影片編號超出範圍
12834
			//如果要顯示的投影片編號超出範圍
12835
			if(page > slideCount - 1)
12835
			if(page > slideCount - 1)
12836
			{
12836
			{
12837
				//代表是要顯示第一張投影片
12837
				//代表是要顯示第一張投影片
12838
				page=0;
12838
				page=0;
12839
			}
12839
			}
12840
			
12840
 
12841
			//取得要隱藏的投影片編號
12841
			//取得要隱藏的投影片編號
12842
			var lastSlideNo=page-1;
12842
			var lastSlideNo=page-1;
12843
						
12843
 
12844
			//如果要隱藏的投影片編號是負的
12844
			//如果要隱藏的投影片編號是負的
12845
			if(lastSlideNo < 0)
12845
			if(lastSlideNo < 0)
12846
			{
12846
			{
12847
				//代表要隱藏的投影片編號最後一張
12847
				//代表要隱藏的投影片編號最後一張
12848
				lastSlideNo = slideCount - 1;
12848
				lastSlideNo = slideCount - 1;
12849
			}
12849
			}
12850
			
12850
 
12851
			//隱藏上一張投影片
12851
			//隱藏上一張投影片
12852
			slide[lastSlideNo].content.style.top=slide[lastSlideNo].info.top;
12852
			slide[lastSlideNo].content.style.top=slide[lastSlideNo].info.top;
12853
			slide[lastSlideNo].content.style.left=slide[lastSlideNo].info.left;
12853
			slide[lastSlideNo].content.style.left=slide[lastSlideNo].info.left;
12854
			slide[lastSlideNo].content.dataset.show='false';
12854
			slide[lastSlideNo].content.dataset.show='false';
12855
			
12855
 
12856
			//顯示下一張投影片
12856
			//顯示下一張投影片
12857
			slide[page].content.style.top=topP;
12857
			slide[page].content.style.top=topP;
12858
			slide[page].content.style.left=leftP;
12858
			slide[page].content.style.left=leftP;
12859
			slide[page].content.style.width=widthP;
12859
			slide[page].content.style.width=widthP;
12860
			slide[page].content.style.height=heightP;
12860
			slide[page].content.style.height=heightP;
12861
			slide[page].content.dataset.show='true';
12861
			slide[page].content.dataset.show='true';
12862
			
12862
 
12863
			//等待時間
12863
			//等待時間
12864
			await timeout.call(this,sec);
12864
			await timeout.call(this,sec);
12865
			
12865
 
12866
			//呼叫自己
12866
			//呼叫自己
12867
			changeSlide.call(this,page+1);
12867
			changeSlide.call(this,page+1);
12868
		}
12868
		}
12869
		
12869
 
12870
		//每過了 sec 秒後就置換投影片
12870
		//每過了 sec 秒後就置換投影片
12871
		changeSlide.call(this,0);
12871
		changeSlide.call(this,0);
12872
		
12872
 
12873
		";
12873
		";
12874
		
12874
 
12875
		#可省略參數:
12875
		#可省略參數:
12876
		#$conf["onReady"],字串,是否要在網頁完全載入後再執行,"false"為不等載入完就先執行,預設為"true"要等載入完再執行.
12876
		#$conf["onReady"],字串,是否要在網頁完全載入後再執行,"false"為不等載入完就先執行,預設為"true"要等載入完再執行.
12877
		#$conf["onReady"]="true";
12877
		#$conf["onReady"]="true";
12878
		#$conf["globalJs"],字串陣列,為要放入<script>標籤的js全域變數.
12878
		#$conf["globalJs"],字串陣列,為要放入<script>標籤的js全域變數.
12879
		#$conf["globalJs"]=array();
12879
		#$conf["globalJs"]=array();
Line 12883... Line 12883...
12883
		#http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the
12883
		#http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the
12884
		#備註:
12884
		#備註:
12885
		#無.
12885
		#無.
12886
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
12886
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
12887
		unset($conf["javaScript::toScript"]);
12887
		unset($conf["javaScript::toScript"]);
12888
	
12888
 
12889
		#如果建立 script 語法失敗
12889
		#如果建立 script 語法失敗
12890
		if($toScript["status"]==="false"){
12890
		if($toScript["status"]==="false"){
12891
		
12891
 
12892
			#設置執行失敗
12892
			#設置執行失敗
12893
			$result["status"]="false";
12893
			$result["status"]="false";
12894
		
12894
 
12895
			#設置錯誤訊息
12895
			#設置錯誤訊息
12896
			$result["error"]=$toScript;
12896
			$result["error"]=$toScript;
12897
			
12897
 
12898
			#回傳結果
12898
			#回傳結果
12899
			return $result;
12899
			return $result;
12900
		
12900
 
12901
			}#if end
12901
			}#if end
12902
		
12902
 
12903
		#儲存內容
12903
		#儲存內容
12904
		$result["content"]=$result["content"].$toScript["content"];
12904
		$result["content"]=$result["content"].$toScript["content"];
12905
			
12905
 
12906
		#設置執行正常
12906
		#設置執行正常
12907
		$result["status"]="true";
12907
		$result["status"]="true";
12908
		
12908
 
12909
		#回傳結果
12909
		#回傳結果
12910
		return $result;	
12910
		return $result;
12911
		
12911
 
12912
	}#function slideDiv end
12912
	}#function slideDiv end
12913
	
12913
 
12914
	/*
12914
	/*
12915
	#函式說明:
12915
	#函式說明:
12916
	#簡易版區塊輪播的效果,要輪播的內容為$conf["place"]特徵區塊的children元素.
12916
	#簡易版區塊輪播的效果,要輪播的內容為$conf["place"]特徵區塊的children元素.
12917
	#回傳結果:
12917
	#回傳結果:
12918
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
12918
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 12920... Line 12920...
12920
	#$result["function"],當前執行的函數名稱.
12920
	#$result["function"],當前執行的函數名稱.
12921
	#$result["content"],語法.
12921
	#$result["content"],語法.
12922
	#必填參數:
12922
	#必填參數:
12923
	#$conf["place"],字串,輪播區塊要在哪個元素裡面呈現,其區塊特徵為何?(請參閱javascript的querySelector函式).
12923
	#$conf["place"],字串,輪播區塊要在哪個元素裡面呈現,其區塊特徵為何?(請參閱javascript的querySelector函式).
12924
	$conf["place"]="";
12924
	$conf["place"]="";
12925
	#可省略參數:	
12925
	#可省略參數:
12926
	#$conf["sec"],字串,過幾秒就要置換成下一張投影片,預設為"5",代表每5秒就換一張投影片.
12926
	#$conf["sec"],字串,過幾秒就要置換成下一張投影片,預設為"5",代表每5秒就換一張投影片.
12927
	#$conf["sec"]="5";
12927
	#$conf["sec"]="5";
12928
	#參考資料:
12928
	#參考資料:
12929
	#無.
12929
	#無.
12930
	#備註:
12930
	#備註:
Line 13043... Line 13043...
13043
 
13043
 
13044
			#回傳結果
13044
			#回傳結果
13045
			return $result;
13045
			return $result;
13046
 
13046
 
13047
			}#if end
13047
			}#if end
13048
		
13048
 
13049
		#初始化要回傳的語法
13049
		#初始化要回傳的語法
13050
		$result["content"]="";
13050
		$result["content"]="";
13051
		
13051
 
13052
		#函式說明:
13052
		#函式說明:
13053
		#將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).
13053
		#將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).
13054
		#回傳結果:
13054
		#回傳結果:
13055
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
13055
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
13056
		#$result["error"],錯誤訊息陣列
13056
		#$result["error"],錯誤訊息陣列
Line 13060... Line 13060...
13060
		#$conf["script"],字串,要執行的javaScript語法.
13060
		#$conf["script"],字串,要執行的javaScript語法.
13061
		$conf["javaScript::toScript"]["script"]=
13061
		$conf["javaScript::toScript"]["script"]=
13062
		"
13062
		"
13063
		//取得要放置投影片內容的區塊
13063
		//取得要放置投影片內容的區塊
13064
		var displayArea=document.querySelector('".$conf["place"]."');
13064
		var displayArea=document.querySelector('".$conf["place"]."');
13065
		
13065
 
13066
		//如果無投影片的內容存在
13066
		//如果無投影片的內容存在
13067
		if(displayArea.children.length<1){
13067
		if(displayArea.children.length<1){
13068
		
13068
 
13069
			//提示錯誤
13069
			//提示錯誤
13070
			console.error('無投影片內容');
13070
			console.error('無投影片內容');
13071
		
13071
 
13072
			//結束執行
13072
			//結束執行
13073
			return;
13073
			return;
13074
		
13074
 
13075
			}//if end
13075
			}//if end
13076
		
13076
 
13077
		//設置投影片的數量
13077
		//設置投影片的數量
13078
		var slideCount=displayArea.children.length;
13078
		var slideCount=displayArea.children.length;
13079
		
13079
 
13080
		//設置投影片置換的等待秒數
13080
		//設置投影片置換的等待秒數
13081
		var sec=".$conf["sec"].";
13081
		var sec=".$conf["sec"].";
13082
		
13082
 
13083
		//設置等待時間的函式
13083
		//設置等待時間的函式
13084
		var timeout=function(sec)
13084
		var timeout=function(sec)
13085
		{
13085
		{
13086
			return new Promise(resolve => 
13086
			return new Promise(resolve =>
13087
			{
13087
			{
13088
				setTimeout(() => 
13088
				setTimeout(() =>
13089
				{
13089
				{
13090
					resolve(sec);
13090
					resolve(sec);
13091
				}, sec*1000);
13091
				}, sec*1000);
13092
			});
13092
			});
13093
		}
13093
		}
13094
		
13094
 
13095
		//宣告置換投影片的函式
13095
		//宣告置換投影片的函式
13096
		var changeSlide=async function(page)
13096
		var changeSlide=async function(page)
13097
		{
13097
		{
13098
			//隱藏所有投影片
13098
			//隱藏所有投影片
13099
			for(var i=0;i<slideCount;i++)
13099
			for(var i=0;i<slideCount;i++)
13100
			{
13100
			{
13101
				//隱藏投影片
13101
				//隱藏投影片
13102
				displayArea.children[i].style.display='none';
13102
				displayArea.children[i].style.display='none';
13103
			
13103
 
13104
			}//for end
13104
			}//for end
13105
			
13105
 
13106
			//如果page超過上限
13106
			//如果page超過上限
13107
			if(page===slideCount)
13107
			if(page===slideCount)
13108
			{
13108
			{
13109
				//設置為第1個投影片
13109
				//設置為第1個投影片
13110
				page=0;
13110
				page=0;
13111
			}
13111
			}
13112
			
13112
 
13113
			//顯示投影片
13113
			//顯示投影片
13114
			displayArea.children[page].style.display='inline-block';
13114
			displayArea.children[page].style.display='inline-block';
13115
			
13115
 
13116
			//等待時間
13116
			//等待時間
13117
			await timeout.call(this,sec);
13117
			await timeout.call(this,sec);
13118
			
13118
 
13119
			//呼叫自己
13119
			//呼叫自己
13120
			changeSlide.call(this,page+1);
13120
			changeSlide.call(this,page+1);
13121
		}
13121
		}
13122
		
13122
 
13123
		//每過了 sec 秒後就置換投影片
13123
		//每過了 sec 秒後就置換投影片
13124
		changeSlide.call(this,0);
13124
		changeSlide.call(this,0);
13125
		
13125
 
13126
		";
13126
		";
13127
		#可省略參數:
13127
		#可省略參數:
13128
		#$conf["onReady"],字串,是否要在網頁完全載入後再執行,"false"為不等載入完就先執行,預設為"true"要等載入完再執行.
13128
		#$conf["onReady"],字串,是否要在網頁完全載入後再執行,"false"為不等載入完就先執行,預設為"true"要等載入完再執行.
13129
		#$conf["onReady"]="true";
13129
		#$conf["onReady"]="true";
13130
		#$conf["globalJs"],字串陣列,為要放入<script>標籤的js全域變數.
13130
		#$conf["globalJs"],字串陣列,為要放入<script>標籤的js全域變數.
Line 13135... Line 13135...
13135
		#http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the
13135
		#http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the
13136
		#備註:
13136
		#備註:
13137
		#無.
13137
		#無.
13138
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
13138
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
13139
		unset($conf["javaScript::toScript"]);
13139
		unset($conf["javaScript::toScript"]);
13140
		
13140
 
13141
		#如果建立 script 語法失敗
13141
		#如果建立 script 語法失敗
13142
		if($toScript["status"]==="false"){
13142
		if($toScript["status"]==="false"){
13143
		
13143
 
13144
			#設置執行失敗
13144
			#設置執行失敗
13145
			$result["status"]="false";
13145
			$result["status"]="false";
13146
		
13146
 
13147
			#設置錯誤訊息
13147
			#設置錯誤訊息
13148
			$result["error"]=$toScript;
13148
			$result["error"]=$toScript;
13149
			
13149
 
13150
			#回傳結果
13150
			#回傳結果
13151
			return $result;
13151
			return $result;
13152
		
13152
 
13153
			}#if end
13153
			}#if end
13154
		
13154
 
13155
		#儲存內容
13155
		#儲存內容
13156
		$result["content"]=$result["content"].$toScript["content"];
13156
		$result["content"]=$result["content"].$toScript["content"];
13157
		
13157
 
13158
		#設置執行正常
13158
		#設置執行正常
13159
		$result["status"]="true";
13159
		$result["status"]="true";
13160
		
13160
 
13161
		#回傳結果
13161
		#回傳結果
13162
		return $result;	
13162
		return $result;
13163
	}
13163
	}
13164
	
13164
 
13165
	/*
13165
	/*
13166
	#函式說明:
13166
	#函式說明:
13167
	#建立點擊後會移到最頂端的 span icon,位於頂端時則會隱藏.
13167
	#建立點擊後會移到最頂端的 span icon,位於頂端時則會隱藏.
13168
	#回傳結果:
13168
	#回傳結果:
13169
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
13169
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 13171... Line 13171...
13171
	#$result["function"],當前執行的函數名稱.
13171
	#$result["function"],當前執行的函數名稱.
13172
	#$result["content"],語法.
13172
	#$result["content"],語法.
13173
	#必填參數:
13173
	#必填參數:
13174
	#$conf["id"],字串,廣告區域的span id.
13174
	#$conf["id"],字串,廣告區域的span id.
13175
	$conf["id"]="";
13175
	$conf["id"]="";
13176
	#可省略參數:	
13176
	#可省略參數:
13177
	#$conf["img"],字串,gotop的icon位置與名稱,預設爲base64加密svg圖檔.
13177
	#$conf["img"],字串,gotop的icon位置與名稱,預設爲base64加密svg圖檔.
13178
	#$conf["img"]="";
13178
	#$conf["img"]="";
13179
	#$conf["mimeType"],字串,圖檔的mime type,預設爲image/*.
13179
	#$conf["mimeType"],字串,圖檔的mime type,預設爲image/*.
13180
	#$conf["mimeType"]="image/*";
13180
	#$conf["mimeType"]="image/*";
13181
	#$conf["fileArgu"],字串, __FILE__ 的內容,若有設置img參數,則也要設置該參數.
13181
	#$conf["fileArgu"],字串, __FILE__ 的內容,若有設置img參數,則也要設置該參數.
Line 13189... Line 13189...
13189
	#備註:
13189
	#備註:
13190
	#bgColor尚未實作
13190
	#bgColor尚未實作
13191
	#固定在頂端或底端的功能未實作
13191
	#固定在頂端或底端的功能未實作
13192
	*/
13192
	*/
13193
	public static function goTopIcon(&$conf){
13193
	public static function goTopIcon(&$conf){
13194
		
13194
 
13195
		#初始化要回傳的結果
13195
		#初始化要回傳的結果
13196
		$result=array();
13196
		$result=array();
13197
 
13197
 
13198
		#取得當前執行的函數名稱
13198
		#取得當前執行的函數名稱
13199
		$result["function"]=__FUNCTION__;
13199
		$result["function"]=__FUNCTION__;
Line 13310... Line 13310...
13310
 
13310
 
13311
			#回傳結果
13311
			#回傳結果
13312
			return $result;
13312
			return $result;
13313
 
13313
 
13314
			}#if end
13314
			}#if end
13315
			
13315
 
13316
		#如果有設置 $conf["img"] 跟 $conf["fileArgu"]
13316
		#如果有設置 $conf["img"] 跟 $conf["fileArgu"]
13317
		if( isset($conf["img"]) && isset($conf["fileArgu"]) ){
13317
		if( isset($conf["img"]) && isset($conf["fileArgu"]) ){
13318
			
13318
 
13319
			#移到最上面的icon
13319
			#移到最上面的icon
13320
			#函式說明:
13320
			#函式說明:
13321
			#用data:mimeType;base64,imgVar的形式來提供圖片的連結,亦即圖片儲存在變數裡面,本函式包含顯示圖片的語法.
13321
			#用data:mimeType;base64,imgVar的形式來提供圖片的連結,亦即圖片儲存在變數裡面,本函式包含顯示圖片的語法.
13322
			#回傳結果:
13322
			#回傳結果:
13323
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
13323
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
13324
			#$result["error"],錯誤訊息
13324
			#$result["error"],錯誤訊息
13325
			#$result["content"],圖片的連結資訊
13325
			#$result["content"],圖片的連結資訊
13326
			#$result["function"],當前執行的函數名稱 
13326
			#$result["function"],當前執行的函數名稱
13327
			#必填參數:
13327
			#必填參數:
13328
			#$conf["imgPosition"],要轉存成2元碼的圖片檔案位置與名稱
13328
			#$conf["imgPosition"],要轉存成2元碼的圖片檔案位置與名稱
13329
			$conf["img::data"]["imgPosition"]=$conf["img"];
13329
			$conf["img::data"]["imgPosition"]=$conf["img"];
13330
			#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑.
13330
			#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑.
13331
			$conf["img::data"]["fileArgu"]=$conf["fileArgu"];
13331
			$conf["img::data"]["fileArgu"]=$conf["fileArgu"];
Line 13334... Line 13334...
13334
			#$conf["alt"]="";
13334
			#$conf["alt"]="";
13335
			#$conf["style"],字串陣列,要使用的style,key為樣式名稱,value為樣式值.
13335
			#$conf["style"],字串陣列,要使用的style,key為樣式名稱,value為樣式值.
13336
			#$conf["style"]=array();
13336
			#$conf["style"]=array();
13337
			#$conf["class"],圖片要套用的css樣式名稱.
13337
			#$conf["class"],圖片要套用的css樣式名稱.
13338
			#$conf["class"]="";
13338
			#$conf["class"]="";
13339
			
13339
 
13340
			#如果有設置 $conf["mimeType"]
13340
			#如果有設置 $conf["mimeType"]
13341
			if(isset($conf["mimeType"])){
13341
			if(isset($conf["mimeType"])){
13342
				
13342
 
13343
				#$conf["mimeType"],2元碼的內容是什麼,預設為"image/*".
13343
				#$conf["mimeType"],2元碼的內容是什麼,預設為"image/*".
13344
				$conf["img::data"]["mimeType"]=$conf["mimeType"];
13344
				$conf["img::data"]["mimeType"]=$conf["mimeType"];
13345
				
13345
 
13346
				}#if end			
13346
				}#if end
13347
			
13347
 
13348
			#$conf["compressType"],2元碼壓縮的方式,預設為"base64".
13348
			#$conf["compressType"],2元碼壓縮的方式,預設為"base64".
13349
			#$conf["compressType"]="base64";
13349
			#$conf["compressType"]="base64";
13350
			#$conf["delImg"],讀取完圖片檔案後,要移除圖片嗎?"true"代表要移除,"false"代表不要移除,預設為"false".
13350
			#$conf["delImg"],讀取完圖片檔案後,要移除圖片嗎?"true"代表要移除,"false"代表不要移除,預設為"false".
13351
			#$conf["delImg"]="false";
13351
			#$conf["delImg"]="false";
13352
			#參考資料:
13352
			#參考資料:
Line 13355... Line 13355...
13355
			$data=img::data($conf["img::data"]);
13355
			$data=img::data($conf["img::data"]);
13356
			unset($conf["img::data"]);
13356
			unset($conf["img::data"]);
13357
 
13357
 
13358
			#如果建立 span section 失敗
13358
			#如果建立 span section 失敗
13359
			if($data["status"]==="false"){
13359
			if($data["status"]==="false"){
13360
				
13360
 
13361
				#設置執行失敗
13361
				#設置執行失敗
13362
				$result["status"]="false";
13362
				$result["status"]="false";
13363
 
13363
 
13364
				#設置執行錯誤訊息
13364
				#設置執行錯誤訊息
13365
				$result["error"]=$data;
13365
				$result["error"]=$data;
13366
 
13366
 
13367
				#回傳結果
13367
				#回傳結果
13368
				return $result;
13368
				return $result;
13369
				
13369
 
13370
				}#if end
13370
				}#if end
13371
			
13371
 
13372
			}#if end	
13372
			}#if end
13373
			
13373
 
13374
		#反之設置爲
13374
		#反之設置爲
13375
		else{
13375
		else{
13376
			
13376
 
13377
			#預設的 go top svg base64 encode
13377
			#預設的 go top svg base64 encode
13378
			$data["content"]="<img src=\"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgoKPHN2ZwogICB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iCiAgIHhtbG5zOmNjPSJodHRwOi8vY3JlYXRpdmVjb21tb25zLm9yZy9ucyMiCiAgIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyIKICAgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzb2RpcG9kaT0iaHR0cDovL3NvZGlwb2RpLnNvdXJjZWZvcmd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4OC4zMzA4NDEiCiAgICAgICAgICAgaGVpZ2h0PSI4MS41NTk4NDUiCiAgICAgICAgICAgeD0iMzEzLjY5MTI1IgogICAgICAgICAgIHk9IjE2OC4yODE3NyIKICAgICAgICAgICByeT0iNDEuNjY1NDA1IgogICAgICAgICAgIHJ4PSI0NC4xNjU0MjEiIC8+CiAgICAgICAgPHRleHQKICAgICAgICAgICB4bWw6c3BhY2U9InByZXNlcnZlIgogICAgICAgICAgIHN0eWxlPSJmb250LXN0eWxlOm5vcm1hbDtmb250LXdlaWdodDpub3JtYWw7Zm9udC1zaXplOjQwcHg7bGluZS1oZWlnaHQ6MTI1JTtmb250LWZhbWlseTpzYW5zLXNlcmlmO2xldHRlci1zcGFjaW5nOjBweDt3b3JkLXNwYWNpbmc6MHB4O2ZpbGw6IzAwMDAwMDtmaWxsLW9wYWNpdHk6MTtzdHJva2U6bm9uZTtzdHJva2Utd2lkdGg6MXB4O3N0cm9rZS1saW5lY2FwOmJ1dHQ7c3Ryb2tlLWxpbmVqb2luOm1pdGVyO3N0cm9rZS1vcGFjaXR5OjEiCiAgICAgICAgICAgeD0iMzI1LjcxNDI5IgogICAgICAgICAgIHk9IjIyMi4zNjIyIgogICAgICAgICAgIGlkPSJ0ZXh0MzM0NyIKICAgICAgICAgICBzb2RpcG9kaTpsaW5lc3BhY2luZz0iMTI1JSI+PHRzcGFuCiAgICAgICAgICAgICBzb2RpcG9kaTpyb2xlPSJsaW5lIgogICAgICAgICAgICAgaWQ9InRzcGFuMzM0OSIKICAgICAgICAgICAgIHg9IjMyNS43MTQyOSIKICAgICAgICAgICAgIHk9IjIyMi4zNjIyIj5Ub3A8L3RzcGFuPjwvdGV4dD4KICAgICAgPC9nPgogICAgPC9nPgogIDwvZz4KPC9zdmc+Cg==\">";
13379
			
13379
 
13380
			}#else end
13380
			}#else end
13381
 
13381
 
13382
		#移到最上面的icon div
13382
		#移到最上面的icon div
13383
		#函式說明:
13383
		#函式說明:
13384
		#<span>區塊,裡面可以指定css的class樣式,可以指定提示文字,若要使用移動的css樣式,請改用divSection函數.
13384
		#<span>區塊,裡面可以指定css的class樣式,可以指定提示文字,若要使用移動的css樣式,請改用divSection函數.
Line 13405... Line 13405...
13405
		$spanSection=css::spanSection($conf["css::spanSection"]);
13405
		$spanSection=css::spanSection($conf["css::spanSection"]);
13406
		unset($conf["css::spanSection"]);
13406
		unset($conf["css::spanSection"]);
13407
 
13407
 
13408
		#如果建立 span section 失敗
13408
		#如果建立 span section 失敗
13409
		if($spanSection["status"]==="false"){
13409
		if($spanSection["status"]==="false"){
13410
			
13410
 
13411
			#設置執行失敗
13411
			#設置執行失敗
13412
			$result["status"]="false";
13412
			$result["status"]="false";
13413
 
13413
 
13414
			#設置執行錯誤訊息
13414
			#設置執行錯誤訊息
13415
			$result["error"]=$spanSection;
13415
			$result["error"]=$spanSection;
13416
 
13416
 
13417
			#回傳結果
13417
			#回傳結果
13418
			return $result;
13418
			return $result;
13419
			
13419
 
13420
			}#if end
13420
			}#if end
13421
 
13421
 
13422
		#儲存 top span
13422
		#儲存 top span
13423
		$result["content"]=$result["content"].$spanSection["content"];
13423
		$result["content"]=$result["content"].$spanSection["content"];
13424
		
13424
 
13425
		#函式說明:
13425
		#函式說明:
13426
		#將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).
13426
		#將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).
13427
		#回傳結果:
13427
		#回傳結果:
13428
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
13428
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
13429
		#$result["error"],錯誤訊息陣列
13429
		#$result["error"],錯誤訊息陣列
Line 13432... Line 13432...
13432
		#必填參數:
13432
		#必填參數:
13433
		#$conf["script"],字串,要執行的javaScript語法.
13433
		#$conf["script"],字串,要執行的javaScript語法.
13434
		$conf["javaScript::toScript"]["script"]="
13434
		$conf["javaScript::toScript"]["script"]="
13435
		//get topspan
13435
		//get topspan
13436
		var topSpan=document.getElementById('".$conf["id"]."');
13436
		var topSpan=document.getElementById('".$conf["id"]."');
13437
		
13437
 
13438
		//scrolliv click event
13438
		//scrolliv click event
13439
		topSpan.addEventListener('click',function(e){	
13439
		topSpan.addEventListener('click',function(e){
13440
				
13440
 
13441
			//滑到頂端
13441
			//滑到頂端
13442
			document.scrollingElement.scrollTop=0;	
13442
			document.scrollingElement.scrollTop=0;
13443
				
13443
 
13444
			});//topSpan addEventListener end
13444
			});//topSpan addEventListener end
13445
					
13445
 
13446
		//當滾軸滾動時觸發
13446
		//當滾軸滾動時觸發
13447
		window.addEventListener('scroll', function(e){
13447
		window.addEventListener('scroll', function(e){
13448
			
13448
 
13449
			//get last scroll y
13449
			//get last scroll y
13450
			var last_known_scroll_position = window.scrollY;
13450
			var last_known_scroll_position = window.scrollY;
13451
			
13451
 
13452
			//get topspan
13452
			//get topspan
13453
			var topSpan=document.getElementById('".$conf["id"]."');
13453
			var topSpan=document.getElementById('".$conf["id"]."');
13454
			
13454
 
13455
			//如果是在網頁頂端
13455
			//如果是在網頁頂端
13456
			if(last_known_scroll_position===0){
13456
			if(last_known_scroll_position===0){
13457
				
13457
 
13458
				//隱藏往頂端的圖示
13458
				//隱藏往頂端的圖示
13459
				topSpan.style.display='none';
13459
				topSpan.style.display='none';
13460
				
13460
 
13461
				}//if end
13461
				}//if end
13462
				
13462
 
13463
			//反之
13463
			//反之
13464
			else{
13464
			else{
13465
				
13465
 
13466
				//get topspan to show
13466
				//get topspan to show
13467
				topSpan.style.display='inline';
13467
				topSpan.style.display='inline';
13468
				
13468
 
13469
				}//else end
13469
				}//else end
13470
			
13470
 
13471
			});//window scroll event end
13471
			});//window scroll event end
13472
		";
13472
		";
13473
		#可省略參數:
13473
		#可省略參數:
13474
		#$conf["onReady"],字串,是否要在網頁完全載入後再執行,"false"為不等載入完就先執行,預設為"true"要等載入完再執行.
13474
		#$conf["onReady"],字串,是否要在網頁完全載入後再執行,"false"為不等載入完就先執行,預設為"true"要等載入完再執行.
13475
		#$conf["onReady"]="true";
13475
		#$conf["onReady"]="true";
Line 13479... Line 13479...
13479
		#$conf["jsFunciton"]=array();
13479
		#$conf["jsFunciton"]=array();
13480
		#參考資料:
13480
		#參考資料:
13481
		#http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the
13481
		#http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the
13482
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
13482
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
13483
		unset($conf["javaScript::toScript"]);
13483
		unset($conf["javaScript::toScript"]);
13484
		
13484
 
13485
		#如果建立js失敗
13485
		#如果建立js失敗
13486
		if($toScript["status"]==="false"){
13486
		if($toScript["status"]==="false"){
13487
			
13487
 
13488
			#設置執行失敗
13488
			#設置執行失敗
13489
			$result["status"]="false";
13489
			$result["status"]="false";
13490
 
13490
 
13491
			#設置執行錯誤訊息
13491
			#設置執行錯誤訊息
13492
			$result["error"]=$toScript;
13492
			$result["error"]=$toScript;
13493
 
13493
 
13494
			#回傳結果
13494
			#回傳結果
13495
			return $result;
13495
			return $result;
13496
			
13496
 
13497
			}#if end
13497
			}#if end
13498
			
13498
 
13499
		#儲存 top span
13499
		#儲存 top span
13500
		$result["content"]=$result["content"].$toScript["content"];
13500
		$result["content"]=$result["content"].$toScript["content"];
13501
		
13501
 
13502
		#設置執行正常
13502
		#設置執行正常
13503
		$result["status"]="true";
13503
		$result["status"]="true";
13504
		
13504
 
13505
		#回傳結果
13505
		#回傳結果
13506
		return $result;
13506
		return $result;
13507
		
13507
 
13508
		}#funcion goTopIcon end	
13508
		}#funcion goTopIcon end
13509
 
13509
 
13510
	/*
13510
	/*
13511
	#函式說明:
13511
	#函式說明:
13512
	#透過ajax遞迴取得檔案的內容,類似tail指令的效果.
13512
	#透過ajax遞迴取得檔案的內容,類似tail指令的效果.
13513
	#回傳結果:
13513
	#回傳結果:
Line 13517... Line 13517...
13517
	#$result["argu"],使用的參數.
13517
	#$result["argu"],使用的參數.
13518
	#$result["content"],語法.
13518
	#$result["content"],語法.
13519
	#必填參數:
13519
	#必填參數:
13520
	#$conf["url"],字串,提供tail ajax的網址.
13520
	#$conf["url"],字串,提供tail ajax的網址.
13521
	$conf["url"]="";
13521
	$conf["url"]="";
13522
	#可省略參數:	
13522
	#可省略參數:
13523
	#$conf["rootDivId"],字串,root div的id,預設為"tailRootDiv".
13523
	#$conf["rootDivId"],字串,root div的id,預設為"tailRootDiv".
13524
	#$conf["rootDivId"]="tailRootDiv";
13524
	#$conf["rootDivId"]="tailRootDiv";
13525
	#參考資料:
13525
	#參考資料:
13526
	#無.
13526
	#無.
13527
	#備註:
13527
	#備註:
Line 13573... Line 13573...
13573
			return $result;
13573
			return $result;
13574
 
13574
 
13575
			}#if end
13575
			}#if end
13576
 
13576
 
13577
		#初始化內容
13577
		#初始化內容
13578
		$result["content"]="";	
13578
		$result["content"]="";
13579
 
13579
 
13580
		#檢查參數
13580
		#檢查參數
13581
		#函式說明:
13581
		#函式說明:
13582
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
13582
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
13583
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
13583
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 13658... Line 13658...
13658
		#$result["function"],當前執行的函數名稱
13658
		#$result["function"],當前執行的函數名稱
13659
		#$result["content"],要執行的javaScript語法
13659
		#$result["content"],要執行的javaScript語法
13660
		#必填參數:
13660
		#必填參數:
13661
		#$conf["script"],字串,要執行的javaScript語法.
13661
		#$conf["script"],字串,要執行的javaScript語法.
13662
		$conf["javaScript::toScript"]["script"]="
13662
		$conf["javaScript::toScript"]["script"]="
13663
		
13663
 
13664
		//initial window.tail
13664
		//initial window.tail
13665
		if(window.tail===undefined){
13665
		if(window.tail===undefined){
13666
 
13666
 
13667
			//初始化 window.tail
13667
			//初始化 window.tail
13668
			window.tail={};
13668
			window.tail={};
13669
 
13669
 
13670
			//初始化繼續執行
13670
			//初始化繼續執行
13671
			window.tail.continue=true;
13671
			window.tail.continue=true;
13672
 
13672
 
13673
			}//if end
13673
			}//if end
13674
		
13674
 
13675
		//create root div
13675
		//create root div
13676
		window.tail.rootDiv = document.createElement('div');                 
13676
		window.tail.rootDiv = document.createElement('div');
13677
		window.tail.rootDiv.id = '".$conf["rootDivId"]."';
13677
		window.tail.rootDiv.id = '".$conf["rootDivId"]."';
13678
		document.body.appendChild(window.tail.rootDiv);
13678
		document.body.appendChild(window.tail.rootDiv);
13679
 
13679
 
13680
		//set tail url
13680
		//set tail url
13681
		window.tailUrl='".$conf["url"]."';
13681
		window.tailUrl='".$conf["url"]."';
13682
	
13682
 
13683
		//設置周期執行的涵式
13683
		//設置周期執行的涵式
13684
		window.tail.ajax = function(line2start){
13684
		window.tail.ajax = function(line2start){
13685
			
13685
 
13686
			xmlhttp=new XMLHttpRequest();
13686
			xmlhttp=new XMLHttpRequest();
13687
			xmlhttp.responseType='json';
13687
			xmlhttp.responseType='json';
13688
			xmlhttp.timeout=60000;
13688
			xmlhttp.timeout=60000;
13689
			xmlhttp.open('POST',window.tailUrl,true);
13689
			xmlhttp.open('POST',window.tailUrl,true);
13690
			xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
13690
			xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
Line 13692... Line 13692...
13692
			xmlhttp.onreadystatechange=function(){
13692
			xmlhttp.onreadystatechange=function(){
13693
 
13693
 
13694
				//如果狀態為4且response code為200
13694
				//如果狀態為4且response code為200
13695
				if(xmlhttp.readyState===4 && xmlhttp.status===200){
13695
				if(xmlhttp.readyState===4 && xmlhttp.status===200){
13696
 
13696
 
13697
					//get response					
13697
					//get response
13698
					res=xmlhttp.response;
13698
					res=xmlhttp.response;
13699
			
13699
 
13700
					//debug
13700
					//debug
13701
					console.log(res);
13701
					console.log(res);
13702
	
13702
 
13703
					//針對每個輸出的行
13703
					//針對每個輸出的行
13704
					for(var i=0;i<xmlhttp.response.lines;i++){
13704
					for(var i=0;i<xmlhttp.response.lines;i++){
13705
				
13705
 
13706
						//set output line
13706
						//set output line
13707
						var div=document.createElement('div');
13707
						var div=document.createElement('div');
13708
						var text=document.createTextNode(xmlhttp.response.content[i]);
13708
						var text=document.createTextNode(xmlhttp.response.content[i]);
13709
						div.appendChild(text);
13709
						div.appendChild(text);
13710
				
13710
 
13711
						//debug
13711
						//debug
13712
						console.log(div);		
13712
						console.log(div);
13713
						
13713
 
13714
						//如果內容為空
13714
						//如果內容為空
13715
						if(xmlhttp.response.content[i]==='')
13715
						if(xmlhttp.response.content[i]==='')
13716
						{
13716
						{
13717
							//建立<br>
13717
							//建立<br>
13718
							var br=document.createElement('br');
13718
							var br=document.createElement('br');
13719
							
13719
 
13720
							//遷入<br>
13720
							//遷入<br>
13721
							div.appendChild(br);
13721
							div.appendChild(br);
13722
						}
13722
						}
13723
						
13723
 
13724
						//show output line
13724
						//show output line
13725
						var rootDiv=document.getElementById(window.tail.rootDiv.id);
13725
						var rootDiv=document.getElementById(window.tail.rootDiv.id);
13726
						rootDiv.prepend(div);
13726
						rootDiv.prepend(div);
13727
 
13727
 
13728
						}//for end		
13728
						}//for end
13729
			
13729
 
13730
					//遞迴
13730
					//遞迴
13731
					window.tail.ajax.call(this,(res.lineNum)+1);
13731
					window.tail.ajax.call(this,(res.lineNum)+1);
13732
 
13732
 
13733
					}//if end
13733
					}//if end
13734
 
13734
 
13735
				}//function end
13735
				}//function end
13736
			
13736
 
13737
			//如果要繼續	
13737
			//如果要繼續
13738
			if(window.tail.continue){
13738
			if(window.tail.continue){
13739
 
13739
 
13740
				//繼續
13740
				//繼續
13741
				xmlhttp.send('line2start='+line2start);
13741
				xmlhttp.send('line2start='+line2start);
13742
 
13742
 
13743
				}//if end
13743
				}//if end
13744
				
13744
 
13745
			//反之要暫停
13745
			//反之要暫停
13746
			else{
13746
			else{
13747
			
13747
 
13748
				//設置無限等待
13748
				//設置無限等待
13749
				var intervalTail = window.setInterval(function(){
13749
				var intervalTail = window.setInterval(function(){
13750
				
13750
 
13751
					//提示已經暫停
13751
					//提示已經暫停
13752
					console.log('paused');
13752
					console.log('paused');
13753
					
13753
 
13754
					//如果要繼續了
13754
					//如果要繼續了
13755
					if(window.tail.continue){
13755
					if(window.tail.continue){
13756
					
13756
 
13757
						//清除無限等待
13757
						//清除無限等待
13758
						clearInterval(intervalTail);
13758
						clearInterval(intervalTail);
13759
											
13759
 
13760
						//繼續
13760
						//繼續
13761
						xmlhttp.send('line2start='+line2start);
13761
						xmlhttp.send('line2start='+line2start);
13762
						
13762
 
13763
						}//if end
13763
						}//if end
13764
				
13764
 
13765
					},1000);
13765
					},1000);
13766
			
13766
 
13767
				}//else end
13767
				}//else end
13768
 
13768
 
13769
			}//function end
13769
			}//function end
13770
 
13770
 
13771
		//call tail ajax
13771
		//call tail ajax
Line 13780... Line 13780...
13780
		#$conf["jsFunciton"]=array();
13780
		#$conf["jsFunciton"]=array();
13781
		#參考資料:
13781
		#參考資料:
13782
		#http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the
13782
		#http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the
13783
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
13783
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
13784
		unset($conf["javaScript::toScript"]);
13784
		unset($conf["javaScript::toScript"]);
13785
		
13785
 
13786
		#如果建立js失敗
13786
		#如果建立js失敗
13787
		if($toScript["status"]==="false"){
13787
		if($toScript["status"]==="false"){
13788
			
13788
 
13789
			#設置執行失敗
13789
			#設置執行失敗
13790
			$result["status"]="false";
13790
			$result["status"]="false";
13791
 
13791
 
13792
			#設置執行錯誤訊息
13792
			#設置執行錯誤訊息
13793
			$result["error"]=$toScript;
13793
			$result["error"]=$toScript;
13794
 
13794
 
13795
			#回傳結果
13795
			#回傳結果
13796
			return $result;
13796
			return $result;
13797
			
13797
 
13798
			}#if end
13798
			}#if end
13799
			
13799
 
13800
		#儲存 top span
13800
		#儲存 top span
13801
		$result["content"]=$result["content"].$toScript["content"];
13801
		$result["content"]=$result["content"].$toScript["content"];
13802
		
13802
 
13803
		#設置執行正常
13803
		#設置執行正常
13804
		$result["status"]="true";
13804
		$result["status"]="true";
13805
		
13805
 
13806
		#回傳結果
13806
		#回傳結果
13807
		return $result;
13807
		return $result;
13808
 
13808
 
13809
		}#function tail end
13809
		}#function tail end
13810
 
13810
 
Line 13820... Line 13820...
13820
	#必填參數:
13820
	#必填參數:
13821
	#$conf["url"],字串,提供random code的網址.
13821
	#$conf["url"],字串,提供random code的網址.
13822
	$conf["url"]="";
13822
	$conf["url"]="";
13823
	#$conf["callBackUrls"],字串陣列,用來處理表單資訊的網址們,會傳送 obj 物件的 post 內容到第一個 callback url,之後都會將 json 回應傳送給下一個 callback url. 如果進行第2個含以上的 callback urls 時有回應含有 formObj 元素的 json 則會改傳送之.每次傳送給 callback url 的表單變數均為 $conf["sendedName"].
13823
	#$conf["callBackUrls"],字串陣列,用來處理表單資訊的網址們,會傳送 obj 物件的 post 內容到第一個 callback url,之後都會將 json 回應傳送給下一個 callback url. 如果進行第2個含以上的 callback urls 時有回應含有 formObj 元素的 json 則會改傳送之.每次傳送給 callback url 的表單變數均為 $conf["sendedName"].
13824
	$conf["callBackUrls"]=array();
13824
	$conf["callBackUrls"]=array();
13825
	#可省略參數:	
13825
	#可省略參數:
13826
	#$conf["resDivId"],字串,輸入驗證碼的表單id,預設為"randomCode".
13826
	#$conf["resDivId"],字串,輸入驗證碼的表單id,預設為"randomCode".
13827
	#$conf["resDivId"]="randomCode";
13827
	#$conf["resDivId"]="randomCode";
13828
	#$conf["names"],字串陣列,需要傳送的表單變數.
13828
	#$conf["names"],字串陣列,需要傳送的表單變數.
13829
	#$conf["names"]=array();
13829
	#$conf["names"]=array();
13830
	#$conf["sendedName"],字串,傳送的post變數名稱,預設的爲"formData".
13830
	#$conf["sendedName"],字串,傳送的post變數名稱,預設的爲"formData".
Line 13841... Line 13841...
13841
	#備註:
13841
	#備註:
13842
	#提示訊息的呈現改用 text area;
13842
	#提示訊息的呈現改用 text area;
13843
	#驗證失敗原因呈現改用 text area;
13843
	#驗證失敗原因呈現改用 text area;
13844
	*/
13844
	*/
13845
	public static function randomCode(&$conf){
13845
	public static function randomCode(&$conf){
13846
	
13846
 
13847
		#初始化要回傳的結果
13847
		#初始化要回傳的結果
13848
		$result=array();
13848
		$result=array();
13849
 
13849
 
13850
		#取得當前執行的函數名稱
13850
		#取得當前執行的函數名稱
13851
		$result["function"]=__FUNCTION__;
13851
		$result["function"]=__FUNCTION__;
Line 13888... Line 13888...
13888
			return $result;
13888
			return $result;
13889
 
13889
 
13890
			}#if end
13890
			}#if end
13891
 
13891
 
13892
		#初始化內容
13892
		#初始化內容
13893
		$result["content"]="";	
13893
		$result["content"]="";
13894
 
13894
 
13895
		#檢查參數
13895
		#檢查參數
13896
		#函式說明:
13896
		#函式說明:
13897
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
13897
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
13898
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
13898
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 13962... Line 13962...
13962
 
13962
 
13963
			#回傳結果
13963
			#回傳結果
13964
			return $result;
13964
			return $result;
13965
 
13965
 
13966
			}#if end
13966
			}#if end
13967
		
13967
 
13968
		#如果未設置 $conf["names"]
13968
		#如果未設置 $conf["names"]
13969
		if(!isset($conf["names"])){
13969
		if(!isset($conf["names"])){
13970
 
13970
 
13971
			#設置爲空
13971
			#設置爲空
13972
			$conf["names"]=array();
13972
			$conf["names"]=array();
Line 13981... Line 13981...
13981
		#$result["function"],當前執行的函數名稱
13981
		#$result["function"],當前執行的函數名稱
13982
		#$result["content"],要執行的javaScript語法
13982
		#$result["content"],要執行的javaScript語法
13983
		#必填參數:
13983
		#必填參數:
13984
		#$conf["script"],字串,要執行的javaScript語法.
13984
		#$conf["script"],字串,要執行的javaScript語法.
13985
		$conf["javaScript::toScript"]["script"]="
13985
		$conf["javaScript::toScript"]["script"]="
13986
		
13986
 
13987
		//initial window.qbpwcf
13987
		//initial window.qbpwcf
13988
		if(window.qbpwcf===undefined){
13988
		if(window.qbpwcf===undefined){
13989
 
13989
 
13990
			window.qbpwcf={};
13990
			window.qbpwcf={};
13991
 
13991
 
13992
			}//if end
13992
			}//if end
13993
		
13993
 
13994
		//initial window.randomCode
13994
		//initial window.randomCode
13995
		if(window.qbpwcf.randomCode===undefined){
13995
		if(window.qbpwcf.randomCode===undefined){
13996
 
13996
 
13997
			window.qbpwcf.randomCode={};
13997
			window.qbpwcf.randomCode={};
13998
 
13998
 
13999
			}//if end
13999
			}//if end
14000
 
14000
 
14001
		//set random code generate url
14001
		//set random code generate url
14002
		window.qbpwcf.randomCode.randomCodeUrl='".$conf["url"]."';
14002
		window.qbpwcf.randomCode.randomCodeUrl='".$conf["url"]."';
14003
	
14003
 
14004
		//set 表單ID 陣列
14004
		//set 表單ID 陣列
14005
		window.qbpwcf.randomCode.formDataIDs=".json_encode($conf["names"])."
14005
		window.qbpwcf.randomCode.formDataIDs=".json_encode($conf["names"])."
14006
		
14006
 
14007
		//設置傳送表單的涵式
14007
		//設置傳送表單的涵式
14008
		window.qbpwcf.randomCodeAjax = function(formObj){
14008
		window.qbpwcf.randomCodeAjax = function(formObj){
14009
			
14009
 
14010
			xmlhttp=new XMLHttpRequest();
14010
			xmlhttp=new XMLHttpRequest();
14011
			xmlhttp.responseType='json';
14011
			xmlhttp.responseType='json';
14012
			xmlhttp.timeout=60000;
14012
			xmlhttp.timeout=60000;
14013
			xmlhttp.open('POST',window.qbpwcf.randomCode.randomCodeUrl,true);
14013
			xmlhttp.open('POST',window.qbpwcf.randomCode.randomCodeUrl,true);
14014
			xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
14014
			xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
Line 14016... Line 14016...
14016
			xmlhttp.onreadystatechange=function(){
14016
			xmlhttp.onreadystatechange=function(){
14017
 
14017
 
14018
				//如果狀態為4且response code為200
14018
				//如果狀態為4且response code為200
14019
				if(xmlhttp.readyState===4 && xmlhttp.status===200){
14019
				if(xmlhttp.readyState===4 && xmlhttp.status===200){
14020
 
14020
 
14021
					//get response					
14021
					//get response
14022
					res=xmlhttp.response;
14022
					res=xmlhttp.response;
14023
			
14023
 
14024
					//debug
14024
					//debug
14025
					console.log(res);
14025
					console.log(res);
14026
					
14026
 
14027
					//debug
14027
					//debug
14028
					console.log(res.status);
14028
					console.log(res.status);
14029
					
14029
 
14030
					//if error occur
14030
					//if error occur
14031
					if(res.status==='false'){
14031
					if(res.status==='false'){
14032
					
14032
 
14033
						//debug
14033
						//debug
14034
						console.log(res.error);
14034
						console.log(res.error);
14035
						
14035
 
14036
						//if no data
14036
						//if no data
14037
						if(res.error==='no data'){
14037
						if(res.error==='no data'){
14038
						
14038
 
14039
							//get random code base64 encoded string
14039
							//get random code base64 encoded string
14040
							var randomCodeSrc=res.content.randomCodeSrc;
14040
							var randomCodeSrc=res.content.randomCodeSrc;
14041
						
14041
 
14042
							//debug
14042
							//debug
14043
							console.log(randomCodeSrc);							
14043
							console.log(randomCodeSrc);
14044
							
14044
 
14045
							//get random code length
14045
							//get random code length
14046
							window.qbpwcf.randomCode.codeLength=res.content.randomCodeLength;
14046
							window.qbpwcf.randomCode.codeLength=res.content.randomCodeLength;
14047
							
14047
 
14048
							//debug
14048
							//debug
14049
							console.log(window.qbpwcf.randomCode.codeLength);
14049
							console.log(window.qbpwcf.randomCode.codeLength);
14050
 
14050
 
14051
							//get code input element
14051
							//get code input element
14052
							var codeInput=document.getElementById('".$conf["resDivId"]."');
14052
							var codeInput=document.getElementById('".$conf["resDivId"]."');
14053
						
14053
 
14054
							//create img element
14054
							//create img element
14055
							var img=document.createElement('img');
14055
							var img=document.createElement('img');
14056
						
14056
 
14057
							//put src code
14057
							//put src code
14058
							img.src=randomCodeSrc;
14058
							img.src=randomCodeSrc;
14059
							
14059
 
14060
							//create random code img id
14060
							//create random code img id
14061
							var imgId='".$conf["resDivId"]."'+'Img';
14061
							var imgId='".$conf["resDivId"]."'+'Img';
14062
							
14062
 
14063
							//若存在舊的驗證碼
14063
							//若存在舊的驗證碼
14064
							if(document.getElementById(imgId)!==null){
14064
							if(document.getElementById(imgId)!==null){
14065
							
14065
 
14066
								//移除舊的驗證碼
14066
								//移除舊的驗證碼
14067
								document.getElementById(imgId).remove();
14067
								document.getElementById(imgId).remove();
14068
							
14068
 
14069
								}//if end
14069
								}//if end
14070
							
14070
 
14071
							//set img id
14071
							//set img id
14072
							img.id=imgId;
14072
							img.id=imgId;
14073
	
14073
 
14074
							//設置寬度
14074
							//設置寬度
14075
							img.width='200';
14075
							img.width='200';
14076
 
14076
 
14077
							//debug
14077
							//debug
14078
							console.log(img);
14078
							console.log(img);
14079
						
14079
 
14080
							//place random code img
14080
							//place random code img
14081
							codeInput.parentElement.prepend(img);
14081
							codeInput.parentElement.prepend(img);
14082
						
14082
 
14083
							}//if end
14083
							}//if end
14084
 
14084
 
14085
						//反之有其他錯誤
14085
						//反之有其他錯誤
14086
						else{
14086
						else{
14087
					
14087
 
14088
							//debug
14088
							//debug
14089
							console.log(res.error);
14089
							console.log(res.error);
14090
 
14090
 
14091
							//alert
14091
							//alert
14092
							alert(res.error);
14092
							alert(res.error);
14093
					
14093
 
14094
							}//else end
14094
							}//else end
14095
					
14095
 
14096
						}//if end
14096
						}//if end
14097
							
14097
 
14098
					//如果驗證失敗
14098
					//如果驗證失敗
14099
					if(res.passed==='false'){
14099
					if(res.passed==='false'){
14100
 
14100
 
14101
						//debug
14101
						//debug
14102
						console.log(res.error);
14102
						console.log(res.error);
14103
 
14103
 
14104
						//alert
14104
						//alert
14105
						alert(res.error);
14105
						alert(res.error);
14106
 
14106
 
14107
						}//if end
14107
						}//if end
14108
	
14108
 
14109
					//反之通過驗證
14109
					//反之通過驗證
14110
					else if(res.passed==='true'){
14110
					else if(res.passed==='true'){
14111
 
14111
 
14112
						//debug
14112
						//debug
14113
						console.log(res.msg);
14113
						console.log(res.msg);
14114
 
14114
 
14115
						//alert
14115
						//alert
14116
						//alert(res.msg);
14116
						//alert(res.msg);
14117
						
14117
 
14118
						//set callback urls
14118
						//set callback urls
14119
						window.qbpwcf.randomCode.callBackUrls=".json_encode($conf["callBackUrls"]).";
14119
						window.qbpwcf.randomCode.callBackUrls=".json_encode($conf["callBackUrls"]).";
14120
						
14120
 
14121
						//nested call callback urls
14121
						//nested call callback urls
14122
						window.qbpwcf.randomCode.callBackFunc.call(this,formObj,window.qbpwcf.randomCode.callBackUrls);
14122
						window.qbpwcf.randomCode.callBackFunc.call(this,formObj,window.qbpwcf.randomCode.callBackUrls);
14123
 
14123
 
14124
						}//else end
14124
						}//else end
14125
						
14125
 
14126
					}//if end
14126
					}//if end
14127
 
14127
 
14128
				}//function end
14128
				}//function end
14129
				
14129
 
14130
			//加密傳送資料	
14130
			//加密傳送資料
14131
			xmlhttp.send('".$conf["sendedName"]."='+btoa(encodeURIComponent(JSON.stringify(formObj))));
14131
			xmlhttp.send('".$conf["sendedName"]."='+btoa(encodeURIComponent(JSON.stringify(formObj))));
14132
			
14132
 
14133
			}//end window.qbpwcf.randomCodeAjax
14133
			}//end window.qbpwcf.randomCodeAjax
14134
 
14134
 
14135
		//initial call random code ajax
14135
		//initial call random code ajax
14136
		window.qbpwcf.randomCodeAjax({});
14136
		window.qbpwcf.randomCodeAjax({});
14137
		
14137
 
14138
		//設置遞迴傳送表單的涵式
14138
		//設置遞迴傳送表單的涵式
14139
		window.qbpwcf.randomCode.callBackFunc = function(formObj,urls){	
14139
		window.qbpwcf.randomCode.callBackFunc = function(formObj,urls){
14140
	
14140
 
14141
			xmlhttp=new XMLHttpRequest();
14141
			xmlhttp=new XMLHttpRequest();
14142
			xmlhttp.responseType='json';
14142
			xmlhttp.responseType='json';
14143
			xmlhttp.timeout=60000;
14143
			xmlhttp.timeout=60000;
14144
			xmlhttp.open('POST',urls[0],true);
14144
			xmlhttp.open('POST',urls[0],true);
14145
			xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
14145
			xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
Line 14147... Line 14147...
14147
			xmlhttp.onreadystatechange=function(){
14147
			xmlhttp.onreadystatechange=function(){
14148
 
14148
 
14149
				//如果狀態為4且response code為200
14149
				//如果狀態為4且response code為200
14150
				if(xmlhttp.readyState===4 && xmlhttp.status===200){
14150
				if(xmlhttp.readyState===4 && xmlhttp.status===200){
14151
 
14151
 
14152
					//get response					
14152
					//get response
14153
					res=xmlhttp.response;
14153
					res=xmlhttp.response;
14154
			
14154
 
14155
					//如果沒有定義 res.status
14155
					//如果沒有定義 res.status
14156
					if(res===null){
14156
					if(res===null){
14157
 
14157
 
14158
						//debug
14158
						//debug
14159
						console.log('callback to '+urls[0]+' fails!');
14159
						console.log('callback to '+urls[0]+' fails!');
14160
					
14160
 
14161
						//show error
14161
						//show error
14162
						alert('callback to '+urls[0]+' fails!');
14162
						alert('callback to '+urls[0]+' fails!');
14163
						
14163
 
14164
						//return & end process.
14164
						//return & end process.
14165
						return false;
14165
						return false;
14166
 
14166
 
14167
 
14167
 
14168
						}//if end
14168
						}//if end
14169
 
14169
 
14170
					//debug
14170
					//debug
14171
					console.log(res);
14171
					console.log(res);
14172
					
14172
 
14173
					//如果沒有定義 res.status
14173
					//如果沒有定義 res.status
14174
					if(res.status===undefined){
14174
					if(res.status===undefined){
14175
 
14175
 
14176
						//debug
14176
						//debug
14177
						console.log('callback to '+urls[0]+' fails!');
14177
						console.log('callback to '+urls[0]+' fails!');
14178
					
14178
 
14179
						//show error
14179
						//show error
14180
						alert('callback to '+urls[0]+' fails!');
14180
						alert('callback to '+urls[0]+' fails!');
14181
						
14181
 
14182
						//return & end process.
14182
						//return & end process.
14183
						return false;
14183
						return false;
14184
 
14184
 
14185
						}//if end
14185
						}//if end
14186
 
14186
 
14187
					//debug
14187
					//debug
14188
					console.log(res.status);
14188
					console.log(res.status);
14189
					
14189
 
14190
					//如果執行不正常
14190
					//如果執行不正常
14191
					if(res.status!=='true'){
14191
					if(res.status!=='true'){
14192
					
14192
 
14193
						//debug
14193
						//debug
14194
						console.log('callback to '+urls[0]+' fails!');
14194
						console.log('callback to '+urls[0]+' fails!');
14195
					
14195
 
14196
						//show error
14196
						//show error
14197
						alert(res.error);
14197
						alert(res.error);
14198
						
14198
 
14199
						//return & end process.
14199
						//return & end process.
14200
						return false;
14200
						return false;
14201
					
14201
 
14202
						}//if end
14202
						}//if end
14203
					
14203
 
14204
					//執行正常
14204
					//執行正常
14205
 
14205
 
14206
					//如果有訊息
14206
					//如果有訊息
14207
					if(res.msg!==undefined){
14207
					if(res.msg!==undefined){
14208
 
14208
 
14209
						//顯示訊息
14209
						//顯示訊息
14210
						alert(res.msg);
14210
						alert(res.msg);
14211
 
14211
 
14212
						}//if end
14212
						}//if end
14213
	
14213
 
14214
					//新的表單變數存在
14214
					//新的表單變數存在
14215
					if(res.formObj!==undefined){
14215
					if(res.formObj!==undefined){
14216
					
14216
 
14217
						//取代要傳送的表單變數					
14217
						//取代要傳送的表單變數
14218
						res=res.formObj;
14218
						res=res.formObj;
14219
											
14219
 
14220
						}//else end	
14220
						}//else end
14221
					
14221
 
14222
					//移除第一個已經callback的url
14222
					//移除第一個已經callback的url
14223
					urls.splice(0, 1);
14223
					urls.splice(0, 1);
14224
					
14224
 
14225
					//如果還有 callback urls
14225
					//如果還有 callback urls
14226
					if(urls.length>0){
14226
					if(urls.length>0){
14227
					
14227
 
14228
						//debug
14228
						//debug
14229
						console.log('callback to:'+urls[0]);					
14229
						console.log('callback to:'+urls[0]);
14230
	
14230
 
14231
						//nested call callback urls
14231
						//nested call callback urls
14232
						window.qbpwcf.randomCode.callBackFunc.call(this,res,urls);
14232
						window.qbpwcf.randomCode.callBackFunc.call(this,res,urls);
14233
					
14233
 
14234
						}//if end
14234
						}//if end
14235
					
14235
 
14236
					//反之
14236
					//反之
14237
					else{
14237
					else{
14238
 
14238
 
14239
						//如果有 href 設定
14239
						//如果有 href 設定
14240
						if(res.href!==undefined){
14240
						if(res.href!==undefined){
14241
							
14241
 
14242
							//到指定頁面
14242
							//到指定頁面
14243
							window.location.href=res.href;
14243
							window.location.href=res.href;
14244
 
14244
 
14245
							//結束執行
14245
							//結束執行
14246
							return true;
14246
							return true;
Line 14253... Line 14253...
14253
							//如果要 refresh
14253
							//如果要 refresh
14254
							if(res.refresh==='true'){
14254
							if(res.refresh==='true'){
14255
 
14255
 
14256
								//重新整理頁面
14256
								//重新整理頁面
14257
								window.location.href=document.baseURI;
14257
								window.location.href=document.baseURI;
14258
	
14258
 
14259
								//結束執行
14259
								//結束執行
14260
								return true;
14260
								return true;
14261
 
14261
 
14262
								}//if end
14262
								}//if end
14263
	
14263
 
14264
							}//if end
14264
							}//if end
14265
 
14265
 
14266
						}//else end
14266
						}//else end
14267
						
14267
 
14268
					}//if end
14268
					}//if end
14269
 
14269
 
14270
				}//function end
14270
				}//function end
14271
				
14271
 
14272
			//加密傳送資料	
14272
			//加密傳送資料
14273
			xmlhttp.send('".$conf["sendedName"]."='+btoa(encodeURIComponent(JSON.stringify(formObj))));
14273
			xmlhttp.send('".$conf["sendedName"]."='+btoa(encodeURIComponent(JSON.stringify(formObj))));
14274
					
14274
 
14275
			}//function end
14275
			}//function end
14276
		
14276
 
14277
		//get code input element
14277
		//get code input element
14278
		var codeInput=document.getElementById('".$conf["resDivId"]."');
14278
		var codeInput=document.getElementById('".$conf["resDivId"]."');
14279
		
14279
 
14280
		//如果存在輸入驗證碼的表單
14280
		//如果存在輸入驗證碼的表單
14281
		if(codeInput!==null){
14281
		if(codeInput!==null){
14282
 
14282
 
14283
			//當輸入的驗證碼長度變化時、有按鍵放開時.
14283
			//當輸入的驗證碼長度變化時、有按鍵放開時.
14284
			codeInput.addEventListener('keyup',function(e){
14284
			codeInput.addEventListener('keyup',function(e){
14285
		
14285
 
14286
				//debug
14286
				//debug
14287
				console.log('keyup event occur');
14287
				console.log('keyup event occur');
14288
 
14288
 
14289
				//debug
14289
				//debug
14290
				console.log('放開的Key爲'+e.key);
14290
				console.log('放開的Key爲'+e.key);
Line 14299... Line 14299...
14299
 
14299
 
14300
				}//if end
14300
				}//if end
14301
 
14301
 
14302
				//如果長度不一致
14302
				//如果長度不一致
14303
				if(codeInput.value.length!==window.qbpwcf.randomCode.codeLength){
14303
				if(codeInput.value.length!==window.qbpwcf.randomCode.codeLength){
14304
			
14304
 
14305
					//結束執行
14305
					//結束執行
14306
					return false;
14306
					return false;
14307
			
14307
 
14308
					}//if end
14308
					}//if end
14309
		
14309
 
14310
				//長度一致
14310
				//長度一致
14311
			
14311
 
14312
				//初始化 form Obj
14312
				//初始化 form Obj
14313
				formObj={};
14313
				formObj={};
14314
			
14314
 
14315
				//依照每個表單
14315
				//依照每個表單
14316
				for(var i=0;i<window.qbpwcf.randomCode.formDataIDs.length;i++){
14316
				for(var i=0;i<window.qbpwcf.randomCode.formDataIDs.length;i++){
14317
			
14317
 
14318
					//構成表單變數名稱
14318
					//構成表單變數名稱
14319
					var formName=window.qbpwcf.randomCode.formDataIDs[i];	
14319
					var formName=window.qbpwcf.randomCode.formDataIDs[i];
14320
 
14320
 
14321
					//debug
14321
					//debug
14322
					console.log(formName);
14322
					console.log(formName);
14323
 
14323
 
14324
					//取得表單內容
14324
					//取得表單內容
14325
					formObj.formName=document.getElementById(window.qbpwcf.randomCode.formDataIDs[i]).value;
14325
					formObj.formName=document.getElementById(window.qbpwcf.randomCode.formDataIDs[i]).value;
14326
			
14326
 
14327
					}//for end
14327
					}//for end
14328
				
14328
 
14329
				//加入驗證碼表單內容
14329
				//加入驗證碼表單內容
14330
				formObj.".$conf["resDivId"]."=document.getElementById('".$conf["resDivId"]."').value;
14330
				formObj.".$conf["resDivId"]."=document.getElementById('".$conf["resDivId"]."').value;
14331
				
14331
 
14332
				//傳送表單
14332
				//傳送表單
14333
				window.qbpwcf.randomCodeAjax.call(this,formObj);
14333
				window.qbpwcf.randomCodeAjax.call(this,formObj);
14334
		
14334
 
14335
				});//function end
14335
				});//function end
14336
 
14336
 
14337
			}//if end
14337
			}//if end
14338
		";
14338
		";
14339
		#可省略參數:
14339
		#可省略參數:
Line 14345... Line 14345...
14345
		#$conf["jsFunciton"]=array();
14345
		#$conf["jsFunciton"]=array();
14346
		#參考資料:
14346
		#參考資料:
14347
		#http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the
14347
		#http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the
14348
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
14348
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
14349
		unset($conf["javaScript::toScript"]);
14349
		unset($conf["javaScript::toScript"]);
14350
		
14350
 
14351
		#如果建立js失敗
14351
		#如果建立js失敗
14352
		if($toScript["status"]==="false"){
14352
		if($toScript["status"]==="false"){
14353
			
14353
 
14354
			#設置執行失敗
14354
			#設置執行失敗
14355
			$result["status"]="false";
14355
			$result["status"]="false";
14356
 
14356
 
14357
			#設置執行錯誤訊息
14357
			#設置執行錯誤訊息
14358
			$result["error"]=$toScript;
14358
			$result["error"]=$toScript;
14359
 
14359
 
14360
			#回傳結果
14360
			#回傳結果
14361
			return $result;
14361
			return $result;
14362
			
14362
 
14363
			}#if end
14363
			}#if end
14364
			
14364
 
14365
		#儲存 js 語法
14365
		#儲存 js 語法
14366
		$result["content"]=$result["content"].$toScript["content"];
14366
		$result["content"]=$result["content"].$toScript["content"];
14367
		
14367
 
14368
		#設置執行正常
14368
		#設置執行正常
14369
		$result["status"]="true";
14369
		$result["status"]="true";
14370
		
14370
 
14371
		#回傳結果
14371
		#回傳結果
14372
		return $result;		
14372
		return $result;
14373
	
14373
 
14374
		}#function randomCode end
14374
		}#function randomCode end
14375
 
14375
 
14376
	/*
14376
	/*
14377
	#函式說明:
14377
	#函式說明:
14378
	#$conf["countdownSec"]n秒後轉址
14378
	#$conf["countdownSec"]n秒後轉址
Line 14438... Line 14438...
14438
			return $result;
14438
			return $result;
14439
 
14439
 
14440
			}#if end
14440
			}#if end
14441
 
14441
 
14442
		#初始化內容
14442
		#初始化內容
14443
		$result["content"]="";	
14443
		$result["content"]="";
14444
 
14444
 
14445
		#檢查參數
14445
		#檢查參數
14446
		#函式說明:
14446
		#函式說明:
14447
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
14447
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
14448
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
14448
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 14565... Line 14565...
14565
 
14565
 
14566
			#回傳結果
14566
			#回傳結果
14567
			return $result;
14567
			return $result;
14568
 
14568
 
14569
			}#if end
14569
			}#if end
14570
	
14570
 
14571
		#取得js語法
14571
		#取得js語法
14572
		$result["content"]=$toScript["content"];
14572
		$result["content"]=$toScript["content"];
14573
 
14573
 
14574
		#設置執行正常
14574
		#設置執行正常
14575
		$result["status"]="true";
14575
		$result["status"]="true";
Line 14601... Line 14601...
14601
	#無.
14601
	#無.
14602
	#備註:
14602
	#備註:
14603
	#無.
14603
	#無.
14604
	*/
14604
	*/
14605
	public static function tailAny(&$conf){
14605
	public static function tailAny(&$conf){
14606
		
14606
 
14607
		#初始化要回傳的結果
14607
		#初始化要回傳的結果
14608
		$result=array();
14608
		$result=array();
14609
 
14609
 
14610
		#取得當前執行的函數名稱
14610
		#取得當前執行的函數名稱
14611
		$result["function"]=__FUNCTION__;
14611
		$result["function"]=__FUNCTION__;
Line 14648... Line 14648...
14648
			return $result;
14648
			return $result;
14649
 
14649
 
14650
			}#if end
14650
			}#if end
14651
 
14651
 
14652
		#初始化內容
14652
		#初始化內容
14653
		$result["content"]="";	
14653
		$result["content"]="";
14654
 
14654
 
14655
		#檢查參數
14655
		#檢查參數
14656
		#函式說明:
14656
		#函式說明:
14657
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
14657
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
14658
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
14658
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 14762... Line 14762...
14762
 
14762
 
14763
			#回傳結果
14763
			#回傳結果
14764
			return $result;
14764
			return $result;
14765
 
14765
 
14766
			}#if end
14766
			}#if end
14767
	
14767
 
14768
		#取得js語法
14768
		#取得js語法
14769
		$result["content"]=$toScript["content"];
14769
		$result["content"]=$toScript["content"];
14770
 
14770
 
14771
		#設置執行正常
14771
		#設置執行正常
14772
		$result["status"]="true";
14772
		$result["status"]="true";
Line 14845... Line 14845...
14845
			return $result;
14845
			return $result;
14846
 
14846
 
14847
			}#if end
14847
			}#if end
14848
 
14848
 
14849
		#初始化內容
14849
		#初始化內容
14850
		$result["content"]="";	
14850
		$result["content"]="";
14851
 
14851
 
14852
		#檢查參數
14852
		#檢查參數
14853
		#函式說明:
14853
		#函式說明:
14854
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
14854
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
14855
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
14855
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 14959... Line 14959...
14959
 
14959
 
14960
			#回傳結果
14960
			#回傳結果
14961
			return $result;
14961
			return $result;
14962
 
14962
 
14963
			}#if end
14963
			}#if end
14964
	
14964
 
14965
		#取得js語法
14965
		#取得js語法
14966
		$result["content"]=$toScript["content"];
14966
		$result["content"]=$toScript["content"];
14967
 
14967
 
14968
		#設置執行正常
14968
		#設置執行正常
14969
		$result["status"]="true";
14969
		$result["status"]="true";
Line 15048... Line 15048...
15048
			return $result;
15048
			return $result;
15049
 
15049
 
15050
			}#if end
15050
			}#if end
15051
 
15051
 
15052
		#初始化內容
15052
		#初始化內容
15053
		$result["content"]="";	
15053
		$result["content"]="";
15054
 
15054
 
15055
		#檢查參數
15055
		#檢查參數
15056
		#函式說明:
15056
		#函式說明:
15057
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
15057
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
15058
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
15058
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 15136... Line 15136...
15136
		#$conf["script"],字串,要執行的javaScript語法.
15136
		#$conf["script"],字串,要執行的javaScript語法.
15137
		$conf["javaScript::toScript"]["script"]=
15137
		$conf["javaScript::toScript"]["script"]=
15138
		"
15138
		"
15139
		var element=".$conf["elementJS"]."
15139
		var element=".$conf["elementJS"]."
15140
		var params=".$conf["paramsJS"];
15140
		var params=".$conf["paramsJS"];
15141
		
15141
 
15142
		#如果有設置 $conf["outFunc"]
15142
		#如果有設置 $conf["outFunc"]
15143
		if(isset($conf["outFunc"]))
15143
		if(isset($conf["outFunc"]))
15144
		{
15144
		{
15145
			#串接客制化的輸出函式
15145
			#串接客制化的輸出函式
15146
			$conf["javaScript::toScript"]["script"]=$conf["javaScript::toScript"]["script"]."
15146
			$conf["javaScript::toScript"]["script"]=$conf["javaScript::toScript"]["script"]."
15147
			window.qbpwcf.tailAny.outputFunc=".$conf["outFunc"];
15147
			window.qbpwcf.tailAny.outputFunc=".$conf["outFunc"];
15148
			
15148
 
15149
		}#if end		
15149
		}#if end
15150
		
15150
 
15151
		//呼叫涵式
15151
		//呼叫涵式
15152
		$conf["javaScript::toScript"]["script"]=$conf["javaScript::toScript"]["script"]."
15152
		$conf["javaScript::toScript"]["script"]=$conf["javaScript::toScript"]["script"]."
15153
		window.qbpwcf.gatDataDynamic.func.call(this,element,".$conf["length"].",params,'".$conf["url"]."','".$conf["method"]."','".$conf["resDiv"]."');
15153
		window.qbpwcf.gatDataDynamic.func.call(this,element,".$conf["length"].",params,'".$conf["url"]."','".$conf["method"]."','".$conf["resDiv"]."');
15154
		";
15154
		";
15155
		#可省略參數:
15155
		#可省略參數:
Line 15175... Line 15175...
15175
 
15175
 
15176
			#回傳結果
15176
			#回傳結果
15177
			return $result;
15177
			return $result;
15178
 
15178
 
15179
			}#if end
15179
			}#if end
15180
	
15180
 
15181
		#取得js語法
15181
		#取得js語法
15182
		$result["content"]=$toScript["content"];
15182
		$result["content"]=$toScript["content"];
15183
 
15183
 
15184
		#設置執行正常
15184
		#設置執行正常
15185
		$result["status"]="true";
15185
		$result["status"]="true";
Line 15210... Line 15210...
15210
	#無.
15210
	#無.
15211
	#備註:
15211
	#備註:
15212
	#無.
15212
	#無.
15213
	*/
15213
	*/
15214
	public static function sequenceQuery(&$conf){
15214
	public static function sequenceQuery(&$conf){
15215
	
15215
 
15216
		#初始化要回傳的結果
15216
		#初始化要回傳的結果
15217
		$result=array();
15217
		$result=array();
15218
 
15218
 
15219
		#取得當前執行的函數名稱
15219
		#取得當前執行的函數名稱
15220
		$result["function"]=__FUNCTION__;
15220
		$result["function"]=__FUNCTION__;
Line 15257... Line 15257...
15257
			return $result;
15257
			return $result;
15258
 
15258
 
15259
			}#if end
15259
			}#if end
15260
 
15260
 
15261
		#初始化內容
15261
		#初始化內容
15262
		$result["content"]="";	
15262
		$result["content"]="";
15263
 
15263
 
15264
		#檢查參數
15264
		#檢查參數
15265
		#函式說明:
15265
		#函式說明:
15266
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
15266
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
15267
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
15267
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 15331... Line 15331...
15331
 
15331
 
15332
			#回傳結果
15332
			#回傳結果
15333
			return $result;
15333
			return $result;
15334
 
15334
 
15335
			}#if end
15335
			}#if end
15336
	
15336
 
15337
		#函式說明:
15337
		#函式說明:
15338
		#將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).
15338
		#將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).
15339
		#回傳結果:
15339
		#回傳結果:
15340
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
15340
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
15341
		#$result["error"],錯誤訊息陣列
15341
		#$result["error"],錯誤訊息陣列
Line 15374... Line 15374...
15374
 
15374
 
15375
			#回傳結果
15375
			#回傳結果
15376
			return $result;
15376
			return $result;
15377
 
15377
 
15378
			}#if end
15378
			}#if end
15379
	
15379
 
15380
		#取得js語法
15380
		#取得js語法
15381
		$result["content"]=$toScript["content"];
15381
		$result["content"]=$toScript["content"];
15382
 
15382
 
15383
		#設置執行正常
15383
		#設置執行正常
15384
		$result["status"]="true";
15384
		$result["status"]="true";
15385
 
15385
 
15386
		#回傳結果
15386
		#回傳結果
15387
		return $result;
15387
		return $result;
15388
	
15388
 
15389
		}#function sequenceQuery end
15389
		}#function sequenceQuery end
15390
 
15390
 
15391
	/*
15391
	/*
15392
	#函數說明
15392
	#函數說明
15393
	#讓js變數確實存在.
15393
	#讓js變數確實存在.
Line 15395... Line 15395...
15395
	#$result["status"],執行正常與否.
15395
	#$result["status"],執行正常與否.
15396
	#$result["content"],js語法.
15396
	#$result["content"],js語法.
15397
	#$result[argu],使用的參數.
15397
	#$result[argu],使用的參數.
15398
	#必填參數:
15398
	#必填參數:
15399
	#$conf["name"],js變數的名稱.
15399
	#$conf["name"],js變數的名稱.
15400
	$conf["name"]="";	
15400
	$conf["name"]="";
15401
	#可省略參數:
15401
	#可省略參數:
15402
	#無
15402
	#無
15403
	#參考資料:
15403
	#參考資料:
15404
	#無.
15404
	#無.
15405
	#備註:
15405
	#備註:
15406
	#無.
15406
	#無.
15407
	*/
15407
	*/
15408
	public static function makeVarExist(&$conf=array()){
15408
	public static function makeVarExist(&$conf=array()){
15409
	
15409
 
15410
		#初始化要回傳的結果
15410
		#初始化要回傳的結果
15411
		$result=array();
15411
		$result=array();
15412
 
15412
 
15413
		#取得當前執行的函數名稱
15413
		#取得當前執行的函數名稱
15414
		$result["function"]=__FUNCTION__;
15414
		$result["function"]=__FUNCTION__;
Line 15524... Line 15524...
15524
			return $result;
15524
			return $result;
15525
 
15525
 
15526
			}#if end
15526
			}#if end
15527
 
15527
 
15528
		#初始化內容
15528
		#初始化內容
15529
		$result["content"]="";	
15529
		$result["content"]="";
15530
		
15530
 
15531
		#用 "." 分割 $conf["var"]
15531
		#用 "." 分割 $conf["var"]
15532
		#函式說明:
15532
		#函式說明:
15533
		#將固定格式的字串分開,並回傳分開的結果。
15533
		#將固定格式的字串分開,並回傳分開的結果。
15534
		#回傳結果:
15534
		#回傳結果:
15535
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
15535
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 15546... Line 15546...
15546
		#可省略參數:
15546
		#可省略參數:
15547
		#$conf["allowEmptyStr"],是否允許分割出來空字串,預設為"false"不允許;"true"代表允許.
15547
		#$conf["allowEmptyStr"],是否允許分割出來空字串,預設為"false"不允許;"true"代表允許.
15548
		$conf["stringProcess::spiltString"]["allowEmptyStr"]="false";
15548
		$conf["stringProcess::spiltString"]["allowEmptyStr"]="false";
15549
		$spiltString=$spiltString=stringProcess::spiltString($conf["stringProcess::spiltString"]);
15549
		$spiltString=$spiltString=stringProcess::spiltString($conf["stringProcess::spiltString"]);
15550
		unset($conf["stringProcess::spiltString"]);
15550
		unset($conf["stringProcess::spiltString"]);
15551
	
15551
 
15552
		#如果檢查參數失敗
15552
		#如果檢查參數失敗
15553
		if($spiltString["status"]==="false"){
15553
		if($spiltString["status"]==="false"){
15554
 
15554
 
15555
			#設置執行失敗
15555
			#設置執行失敗
15556
			$result["status"]="false";
15556
			$result["status"]="false";
Line 15560... Line 15560...
15560
 
15560
 
15561
			#回傳結果
15561
			#回傳結果
15562
			return $result;
15562
			return $result;
15563
 
15563
 
15564
			}#if end
15564
			}#if end
15565
			
15565
 
15566
		#函式說明:
15566
		#函式說明:
15567
		#將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).
15567
		#將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).
15568
		#回傳結果:
15568
		#回傳結果:
15569
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
15569
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
15570
		#$result["error"],錯誤訊息陣列
15570
		#$result["error"],錯誤訊息陣列
15571
		#$result["function"],當前執行的函數名稱
15571
		#$result["function"],當前執行的函數名稱
15572
		#$result["content"],要執行的javaScript語法
15572
		#$result["content"],要執行的javaScript語法
15573
		#必填參數:	
15573
		#必填參數:
15574
		#$conf["script"],字串,要執行的javaScript語法.
15574
		#$conf["script"],字串,要執行的javaScript語法.
15575
		$conf["javaScript::toScript"]["script"]="";
15575
		$conf["javaScript::toScript"]["script"]="";
15576
		
15576
 
15577
		#初始化 js 變數
15577
		#初始化 js 變數
15578
		$jsVar="";
15578
		$jsVar="";
15579
		
15579
 
15580
		#針對每個 js 變數的階層
15580
		#針對每個 js 變數的階層
15581
		for($i=0;$i<$spiltString["dataCounts"];$i++){
15581
		for($i=0;$i<$spiltString["dataCounts"];$i++){
15582
		
15582
 
15583
			#取得片段 js 變數名稱
15583
			#取得片段 js 變數名稱
15584
			$jsVarPart=$spiltString["dataArray"][$i];
15584
			$jsVarPart=$spiltString["dataArray"][$i];
15585
		
15585
 
15586
			#如果不是第一層變數
15586
			#如果不是第一層變數
15587
			if($i!==0){
15587
			if($i!==0){
15588
				
15588
 
15589
				#串接 js 變數名稱
15589
				#串接 js 變數名稱
15590
				$jsVar=$jsVar.".".$jsVarPart;
15590
				$jsVar=$jsVar.".".$jsVarPart;
15591
			
15591
 
15592
				}#if end
15592
				}#if end
15593
				
15593
 
15594
			#反之
15594
			#反之
15595
			else{
15595
			else{
15596
			
15596
 
15597
				#串接 js 變數名稱
15597
				#串接 js 變數名稱
15598
				$jsVar=$jsVar.$jsVarPart;
15598
				$jsVar=$jsVar.$jsVarPart;
15599
			
15599
 
15600
				}#else end
15600
				}#else end
15601
		
15601
 
15602
			#串接 js 語法
15602
			#串接 js 語法
15603
			$conf["javaScript::toScript"]["script"]=$conf["javaScript::toScript"]["script"].
15603
			$conf["javaScript::toScript"]["script"]=$conf["javaScript::toScript"]["script"].
15604
			"
15604
			"
15605
				//如果該階段變數不存在
15605
				//如果該階段變數不存在
15606
				if(".$jsVar."===undefined){
15606
				if(".$jsVar."===undefined){
15607
				
15607
 
15608
					//初始化為空物件
15608
					//初始化為空物件
15609
					".$jsVar."={};
15609
					".$jsVar."={};
15610
				
15610
 
15611
					}//if end
15611
					}//if end
15612
			";
15612
			";
15613
		
15613
 
15614
			}#foreach end
15614
			}#foreach end
15615
		
15615
 
15616
		#可省略參數:
15616
		#可省略參數:
15617
		#$conf["onReady"],字串,是否要在網頁完全載入後再執行,"false"為不等載入完就先執行,預設為"true"要等載入完再執行.
15617
		#$conf["onReady"],字串,是否要在網頁完全載入後再執行,"false"為不等載入完就先執行,預設為"true"要等載入完再執行.
15618
		#$conf["onReady"]="true";
15618
		#$conf["onReady"]="true";
15619
		#$conf["globalJs"],字串陣列,為要放入<script>標籤的js全域變數.
15619
		#$conf["globalJs"],字串陣列,為要放入<script>標籤的js全域變數.
15620
		#$conf["globalJs"]=array();
15620
		#$conf["globalJs"]=array();
15621
		#$conf["jsFunciton"],字串陣列,為要放入<script>標籤的js函數.
15621
		#$conf["jsFunciton"],字串陣列,為要放入<script>標籤的js函數.
15622
		#$conf["jsFunciton"]=array();
15622
		#$conf["jsFunciton"]=array();
15623
		#參考資料:
15623
		#參考資料:
15624
		#http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the
15624
		#http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the
15625
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
15625
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
15626
		unset($conf["javaScript::toScript"]);   		
15626
		unset($conf["javaScript::toScript"]);
15627
	
15627
 
15628
		#如果檢查參數失敗
15628
		#如果檢查參數失敗
15629
		if($toScript["status"]==="false"){
15629
		if($toScript["status"]==="false"){
15630
 
15630
 
15631
			#設置執行失敗
15631
			#設置執行失敗
15632
			$result["status"]="false";
15632
			$result["status"]="false";
Line 15636... Line 15636...
15636
 
15636
 
15637
			#回傳結果
15637
			#回傳結果
15638
			return $result;
15638
			return $result;
15639
 
15639
 
15640
			}#if end
15640
			}#if end
15641
			
15641
 
15642
		#取得 js 語法
15642
		#取得 js 語法
15643
		$result["content"]=$toScript["content"];	
15643
		$result["content"]=$toScript["content"];
15644
			
15644
 
15645
		#設置執行正常
15645
		#設置執行正常
15646
		$result["status"]="true";
15646
		$result["status"]="true";
15647
		
15647
 
15648
		#回傳結果
15648
		#回傳結果
15649
		return $result;
15649
		return $result;
15650
	
15650
 
15651
		}#fucntion makeVarExist end
15651
		}#fucntion makeVarExist end
15652
 
15652
 
15653
	/*
15653
	/*
15654
	#函數說明
15654
	#函數說明
15655
	#讀取由table::div建立的資料表,依照欄位內容做不同的事情.
15655
	#讀取由table::div建立的資料表,依照欄位內容做不同的事情.
Line 15657... Line 15657...
15657
	#$result["status"],執行正常與否.
15657
	#$result["status"],執行正常與否.
15658
	#$result["content"],js語法.
15658
	#$result["content"],js語法.
15659
	#$result[argu],使用的參數.
15659
	#$result[argu],使用的參數.
15660
	#必填參數:
15660
	#必填參數:
15661
	#$conf["table"],取得table的js.
15661
	#$conf["table"],取得table的js.
15662
	$conf["table"]="";	
15662
	$conf["table"]="";
15663
	#可省略參數:
15663
	#可省略參數:
15664
	#$conf["var"],表格的資訊要儲在哪個js變數,預設為"window.qbpwcf.readTable"
15664
	#$conf["var"],表格的資訊要儲在哪個js變數,預設為"window.qbpwcf.readTable"
15665
	#$conf["var"]="window.qbpwcf.readTable";
15665
	#$conf["var"]="window.qbpwcf.readTable";
15666
	#$conf["storeInArray"],預設為儲存成陣列"true",反之儲存成單一變數"false".
15666
	#$conf["storeInArray"],預設為儲存成陣列"true",反之儲存成單一變數"false".
15667
	#$conf["storeInArray"]="true";
15667
	#$conf["storeInArray"]="true";
Line 15671... Line 15671...
15671
	#無.
15671
	#無.
15672
	#備註:
15672
	#備註:
15673
	#無.
15673
	#無.
15674
	*/
15674
	*/
15675
	public static function readTable(&$conf=array()){
15675
	public static function readTable(&$conf=array()){
15676
	
15676
 
15677
		#初始化要回傳的結果
15677
		#初始化要回傳的結果
15678
		$result=array();
15678
		$result=array();
15679
 
15679
 
15680
		#取得當前執行的函數名稱
15680
		#取得當前執行的函數名稱
15681
		$result["function"]=__FUNCTION__;
15681
		$result["function"]=__FUNCTION__;
Line 15791... Line 15791...
15791
			return $result;
15791
			return $result;
15792
 
15792
 
15793
			}#if end
15793
			}#if end
15794
 
15794
 
15795
		#初始化內容
15795
		#初始化內容
15796
		$result["content"]="";	
15796
		$result["content"]="";
15797
	
15797
 
15798
		#函數說明
15798
		#函數說明
15799
		#讓js變數確實存在.
15799
		#讓js變數確實存在.
15800
		#回傳的結果
15800
		#回傳的結果
15801
		#$result["status"],執行正常與否.
15801
		#$result["status"],執行正常與否.
15802
		#$result["content"],js語法.
15802
		#$result["content"],js語法.
15803
		#$result[argu],使用的參數.
15803
		#$result[argu],使用的參數.
15804
		#必填參數:
15804
		#必填參數:
15805
		#$conf["name"],js變數的名稱.
15805
		#$conf["name"],js變數的名稱.
15806
		$conf["javaScript::makeVarExist"]["name"]=$conf["var"];	
15806
		$conf["javaScript::makeVarExist"]["name"]=$conf["var"];
15807
		#可省略參數:
15807
		#可省略參數:
15808
		#無
15808
		#無
15809
		$makeVarExist=javaScript::makeVarExist($conf["javaScript::makeVarExist"]);
15809
		$makeVarExist=javaScript::makeVarExist($conf["javaScript::makeVarExist"]);
15810
		unset($conf["javaScript::makeVarExist"]);
15810
		unset($conf["javaScript::makeVarExist"]);
15811
 
15811
 
Line 15820... Line 15820...
15820
 
15820
 
15821
			#回傳結果
15821
			#回傳結果
15822
			return $result;
15822
			return $result;
15823
 
15823
 
15824
			}#if end
15824
			}#if end
15825
			
15825
 
15826
		#串接js語法
15826
		#串接js語法
15827
		$result["content"]=$result["content"].$makeVarExist["content"];	
15827
		$result["content"]=$result["content"].$makeVarExist["content"];
15828
			
15828
 
15829
		#函式說明:
15829
		#函式說明:
15830
		#將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).
15830
		#將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).
15831
		#回傳結果:
15831
		#回傳結果:
15832
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
15832
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
15833
		#$result["error"],錯誤訊息陣列
15833
		#$result["error"],錯誤訊息陣列
15834
		#$result["function"],當前執行的函數名稱
15834
		#$result["function"],當前執行的函數名稱
15835
		#$result["content"],要執行的javaScript語法
15835
		#$result["content"],要執行的javaScript語法
15836
		#必填參數:	
15836
		#必填參數:
15837
		#$conf["script"],字串,要執行的javaScript語法.
15837
		#$conf["script"],字串,要執行的javaScript語法.
15838
		$conf["javaScript::toScript"]["script"]=
15838
		$conf["javaScript::toScript"]["script"]=
15839
		"
15839
		"
15840
		//set debug mode
15840
		//set debug mode
15841
		window.debug=true;
15841
		window.debug=true;
15842
		
15842
 
15843
		//set params
15843
		//set params
15844
		params=".json_encode($conf).";
15844
		params=".json_encode($conf).";
15845
		
15845
 
15846
		//初始化變數存在
15846
		//初始化變數存在
15847
		noExist=true;	
15847
		noExist=true;
15848
		
15848
 
15849
		//確認變數是否存在	
15849
		//確認變數是否存在
15850
		eval(noExist=('+params.var+'===undefined));
15850
		eval(noExist=('+params.var+'===undefined));
15851
		
15851
 
15852
		//如果變數不存在
15852
		//如果變數不存在
15853
		if(noExist===false){
15853
		if(noExist===false){
15854
		
15854
 
15855
			//如果要儲存成陣列
15855
			//如果要儲存成陣列
15856
			if(params.storeInArray==='true'){
15856
			if(params.storeInArray==='true'){
15857
		
15857
 
15858
				//初始化為空陣列
15858
				//初始化為空陣列
15859
				eval(params.var+'=[]');
15859
				eval(params.var+'=[]');
15860
			
15860
 
15861
				}//if end	
15861
				}//if end
15862
				
15862
 
15863
			//反之
15863
			//反之
15864
			else{
15864
			else{
15865
			
15865
 
15866
				//初始化為空陣列
15866
				//初始化為空陣列
15867
				eval(params.var+'={}');
15867
				eval(params.var+'={}');
15868
			
15868
 
15869
				}//else end	
15869
				}//else end
15870
				
15870
 
15871
			}//if end
15871
			}//if end
15872
			
15872
 
15873
		//initial empty table object
15873
		//initial empty table object
15874
		thisTable={};		
15874
		thisTable={};
15875
	
15875
 
15876
		//get latest table
15876
		//get latest table
15877
		thisTable.target=".$conf["table"].";
15877
		thisTable.target=".$conf["table"].";
15878
	
15878
 
15879
		//如果有 thead,tbody
15879
		//如果有 thead,tbody
15880
		if(thisTable.target.children.length>1){
15880
		if(thisTable.target.children.length>1){
15881
		
15881
 
15882
			//get thead
15882
			//get thead
15883
			thisTable.thead=thisTable.target.children[0];
15883
			thisTable.thead=thisTable.target.children[0];
15884
		
15884
 
15885
			//get tbody
15885
			//get tbody
15886
			thisTable.tbody=thisTable.target.children[1];
15886
			thisTable.tbody=thisTable.target.children[1];
15887
		
15887
 
15888
			}//if end
15888
			}//if end
15889
	
15889
 
15890
		//反之只有 tbody
15890
		//反之只有 tbody
15891
		else{
15891
		else{
15892
		
15892
 
15893
			//empty thead
15893
			//empty thead
15894
			thisTable.thead={};
15894
			thisTable.thead={};
15895
		
15895
 
15896
			//get tbody
15896
			//get tbody
15897
			thisTable.tbody=thisTable.target.children[1];
15897
			thisTable.tbody=thisTable.target.children[1];
15898
		
15898
 
15899
			}//if end
15899
			}//if end
15900
		
15900
 
15901
		//列數
15901
		//列數
15902
		thisTable.rowsCount=thisTable.tbody.children.length;
15902
		thisTable.rowsCount=thisTable.tbody.children.length;
15903
			
15903
 
15904
		//欄數
15904
		//欄數
15905
		thisTable.colsCount=thisTable.tbody.children[1].children.length;
15905
		thisTable.colsCount=thisTable.tbody.children[1].children.length;
15906
		
15906
 
15907
		//如果有標題欄位
15907
		//如果有標題欄位
15908
		if(thisTable.thead!=={}){
15908
		if(thisTable.thead!=={}){
15909
		
15909
 
15910
			//debug
15910
			//debug
15911
			if(window.debug){
15911
			if(window.debug){
15912
			
15912
 
15913
				//提示有欄位標題
15913
				//提示有欄位標題
15914
				console.log('There is title.');
15914
				console.log('There is title.');
15915
			
15915
 
15916
				}//if end
15916
				}//if end
15917
		
15917
 
15918
			//取得每個欄位的標題
15918
			//取得每個欄位的標題
15919
			thisTable.title=[];
15919
			thisTable.title=[];
15920
			
15920
 
15921
			//debug
15921
			//debug
15922
			if(window.debug){
15922
			if(window.debug){
15923
			
15923
 
15924
				//提示欄位數目
15924
				//提示欄位數目
15925
				console.log('thisTable.colsCount='+thisTable.colsCount);
15925
				console.log('thisTable.colsCount='+thisTable.colsCount);
15926
			
15926
 
15927
				}//if end
15927
				}//if end
15928
			
15928
 
15929
			//針對每個
15929
			//針對每個
15930
			for(i=0;i<thisTable.colsCount;i++){
15930
			for(i=0;i<thisTable.colsCount;i++){
15931
					
15931
 
15932
				//debug
15932
				//debug
15933
				if(window.debug){
15933
				if(window.debug){
15934
				
15934
 
15935
					//提示當前是第幾個欄位(從0開始)
15935
					//提示當前是第幾個欄位(從0開始)
15936
					console.log('i='+i);
15936
					console.log('i='+i);
15937
				
15937
 
15938
					}//if end
15938
					}//if end
15939
						
15939
 
15940
				//如果欄位存在	
15940
				//如果欄位存在
15941
				if(thisTable.thead.children[0].children[i]!==undefined){
15941
				if(thisTable.thead.children[0].children[i]!==undefined){
15942
								
15942
 
15943
					//取得欄位標題
15943
					//取得欄位標題
15944
					thisTable.title.push(thisTable.thead.children[0].children[i].innerText);
15944
					thisTable.title.push(thisTable.thead.children[0].children[i].innerText);
15945
					
15945
 
15946
					//debug
15946
					//debug
15947
					if(window.debug){
15947
					if(window.debug){
15948
					
15948
 
15949
						console.log('column title - start');
15949
						console.log('column title - start');
15950
						console.log(thisTable.thead.children[0].children[i].innerText);
15950
						console.log(thisTable.thead.children[0].children[i].innerText);
15951
						console.log('column title - end');
15951
						console.log('column title - end');
15952
				
15952
 
15953
						}//if end
15953
						}//if end
15954
				
15954
 
15955
					}//if end
15955
					}//if end
15956
				
15956
 
15957
				}//for end
15957
				}//for end
15958
			
15958
 
15959
			}//if end
15959
			}//if end
15960
		
15960
 
15961
		//反之
15961
		//反之
15962
		else{
15962
		else{
15963
		
15963
 
15964
			//預設欄位標題為 A,B,C....Z
15964
			//預設欄位標題為 A,B,C....Z
15965
			console.log('尚未實作');
15965
			console.log('尚未實作');
15966
			exit;
15966
			exit;
15967
		
15967
 
15968
			}//else end
15968
			}//else end
15969
			
15969
 
15970
	
15970
 
15971
		//暫存欄位的資料
15971
		//暫存欄位的資料
15972
		rowData=[];
15972
		rowData=[];
15973
		
15973
 
15974
		//debug
15974
		//debug
15975
		if(window.debug){
15975
		if(window.debug){
15976
		
15976
 
15977
			//提示資料筆數
15977
			//提示資料筆數
15978
			console.log('thisTable.rowsCount='+thisTable.rowsCount);
15978
			console.log('thisTable.rowsCount='+thisTable.rowsCount);
15979
		
15979
 
15980
			}//if end
15980
			}//if end
15981
		
15981
 
15982
		//針對每筆資料
15982
		//針對每筆資料
15983
		for(i=1;i<thisTable.rowsCount;i++){
15983
		for(i=1;i<thisTable.rowsCount;i++){
15984
		
15984
 
15985
			//debug
15985
			//debug
15986
			if(window.debug){
15986
			if(window.debug){
15987
			
15987
 
15988
				//提示第幾筆資料
15988
				//提示第幾筆資料
15989
				console.log('i='+i);
15989
				console.log('i='+i);
15990
			
15990
 
15991
				}//if end
15991
				}//if end
15992
		
15992
 
15993
			//取得列
15993
			//取得列
15994
			tr=thisTable.tbody.children[i];
15994
			tr=thisTable.tbody.children[i];
15995
		
15995
 
15996
			//debug
15996
			//debug
15997
			if(window.debug){
15997
			if(window.debug){
15998
			
15998
 
15999
				//提示第幾筆資料
15999
				//提示第幾筆資料
16000
				console.log('tr - start');
16000
				console.log('tr - start');
16001
				console.log(tr);
16001
				console.log(tr);
16002
				console.log('tr - end');
16002
				console.log('tr - end');
16003
			
16003
 
16004
				}//if end
16004
				}//if end
16005
		
16005
 
16006
			//暫存欄位資料
16006
			//暫存欄位資料
16007
			colData={};
16007
			colData={};
16008
		
16008
 
16009
			//debug
16009
			//debug
16010
			if(window.debug){
16010
			if(window.debug){
16011
			
16011
 
16012
				//提示欄位數量
16012
				//提示欄位數量
16013
				console.log('thisTable.rowsCount='+thisTable.rowsCount);
16013
				console.log('thisTable.rowsCount='+thisTable.rowsCount);
16014
			
16014
 
16015
				}//if end
16015
				}//if end
16016
		
16016
 
16017
			//針對每個欄位
16017
			//針對每個欄位
16018
			for(j=0;j<thisTable.colsCount;j++){
16018
			for(j=0;j<thisTable.colsCount;j++){
16019
			
16019
 
16020
				//debug
16020
				//debug
16021
				if(window.debug){
16021
				if(window.debug){
16022
				
16022
 
16023
					//提示欄位編號
16023
					//提示欄位編號
16024
					console.log('j='+j);
16024
					console.log('j='+j);
16025
					
16025
 
16026
					}//if end
16026
					}//if end
16027
				
16027
 
16028
				//取得欄位內容
16028
				//取得欄位內容
16029
				td=tr.children[j].innerHTML;
16029
				td=tr.children[j].innerHTML;
16030
			
16030
 
16031
				//debug
16031
				//debug
16032
				if(window.debug){
16032
				if(window.debug){
16033
				
16033
 
16034
					//提示欄位內容
16034
					//提示欄位內容
16035
					console.log('td='+td);
16035
					console.log('td='+td);
16036
					
16036
 
16037
					}//if end
16037
					}//if end
16038
			
16038
 
16039
				//debug
16039
				//debug
16040
				if(window.debug){
16040
				if(window.debug){
16041
				
16041
 
16042
					//提示欄位原始名稱
16042
					//提示欄位原始名稱
16043
					console.log('thisTable.title['+j+']='+thisTable.title[j]);
16043
					console.log('thisTable.title['+j+']='+thisTable.title[j]);
16044
					
16044
 
16045
					}//if end
16045
					}//if end
16046
			
16046
 
16047
				//set temp title,replace ' ' to '_'.
16047
				//set temp title,replace ' ' to '_'.
16048
				tempTitle=thisTable.title[j].replace(/ /i, '_');
16048
				tempTitle=thisTable.title[j].replace(/ /i, '_');
16049
			
16049
 
16050
				//debug
16050
				//debug
16051
				if(window.debug){
16051
				if(window.debug){
16052
				
16052
 
16053
					//提示欄位新名稱
16053
					//提示欄位新名稱
16054
					console.log('tempTitle='+tempTitle);
16054
					console.log('tempTitle='+tempTitle);
16055
					
16055
 
16056
					}//if end
16056
					}//if end
16057
			
16057
 
16058
				//用欄位標題儲存欄位內容
16058
				//用欄位標題儲存欄位內容
16059
				eval('colData.'+tempTitle+'=td');
16059
				eval('colData.'+tempTitle+'=td');
16060
						
16060
 
16061
				//如果有 action 參數
16061
				//如果有 action 參數
16062
				if(params.action!==undefined){
16062
				if(params.action!==undefined){
16063
			
16063
 
16064
					//如果 action 參數對應的欄位存在數值
16064
					//如果 action 參數對應的欄位存在數值
16065
					if(params.action[j]!==undefined){
16065
					if(params.action[j]!==undefined){
16066
 
16066
 
16067
						//get action
16067
						//get action
16068
						action=params.action[j];
16068
						action=params.action[j];
16069
 
16069
 
16070
						//debug
16070
						//debug
16071
						if(window.debug){
16071
						if(window.debug){
16072
						
16072
 
16073
							//提示欄位新名稱
16073
							//提示欄位新名稱
16074
							console.log('action='+action);
16074
							console.log('action='+action);
16075
							
16075
 
16076
							}//if end
16076
							}//if end
16077
 
16077
 
16078
						//如果動作不是 'save'
16078
						//如果動作不是 'save'
16079
						if(action!=='save'){
16079
						if(action!=='save'){
16080
						
16080
 
16081
							//debug
16081
							//debug
16082
							if(window.debug){
16082
							if(window.debug){
16083
							
16083
 
16084
									console.log('not only save, need extra action.');
16084
									console.log('not only save, need extra action.');
16085
							
16085
 
16086
								}//if end
16086
								}//if end
16087
								
16087
 
16088
							//用 ',' 分割 action 字串
16088
							//用 ',' 分割 action 字串
16089
							splitedStr=action.split(',');
16089
							splitedStr=action.split(',');
16090
						
16090
 
16091
							//debug
16091
							//debug
16092
							if(window.debug){
16092
							if(window.debug){
16093
							
16093
 
16094
									console.log('call '+splitedStr[1]+' function with param('+td+')');
16094
									console.log('call '+splitedStr[1]+' function with param('+td+')');
16095
							
16095
 
16096
									//call functino with params
16096
									//call functino with params
16097
									eval(splitedStr[1]+'.call(this,td)');
16097
									eval(splitedStr[1]+'.call(this,td)');
16098
							
16098
 
16099
								}//if end
16099
								}//if end
16100
						
16100
 
16101
							}//if end
16101
							}//if end
16102
												
16102
 
16103
						}//fie nd
16103
						}//fie nd
16104
						
16104
 
16105
					}//if end
16105
					}//if end
16106
	
16106
 
16107
				}//if end
16107
				}//if end
16108
	
16108
 
16109
			//儲存該筆資料的欄位資料
16109
			//儲存該筆資料的欄位資料
16110
			rowData.push(colData);
16110
			rowData.push(colData);
16111
		
16111
 
16112
			}//for end
16112
			}//for end
16113
			
16113
 
16114
		//儲存每筆資料的欄位資料
16114
		//儲存每筆資料的欄位資料
16115
		thisTable.rowData=rowData;
16115
		thisTable.rowData=rowData;
16116
		
16116
 
16117
		//如果要儲存成陣列
16117
		//如果要儲存成陣列
16118
		if(params.storeInArray==='true'){
16118
		if(params.storeInArray==='true'){
16119
	
16119
 
16120
			//put table in array
16120
			//put table in array
16121
			eval(params.var+'.push(thisTable)');	
16121
			eval(params.var+'.push(thisTable)');
16122
		
16122
 
16123
			}//if end	
16123
			}//if end
16124
			
16124
 
16125
		//反之
16125
		//反之
16126
		else{
16126
		else{
16127
		
16127
 
16128
			//put table in var			
16128
			//put table in var
16129
			eval(params.var+'.=thisTable');	
16129
			eval(params.var+'.=thisTable');
16130
		
16130
 
16131
			}//else end	
16131
			}//else end
16132
				
16132
 
16133
		";
16133
		";
16134
		#可省略參數:
16134
		#可省略參數:
16135
		#$conf["onReady"],字串,是否要在網頁完全載入後再執行,"false"為不等載入完就先執行,預設為"true"要等載入完再執行.
16135
		#$conf["onReady"],字串,是否要在網頁完全載入後再執行,"false"為不等載入完就先執行,預設為"true"要等載入完再執行.
16136
		#$conf["onReady"]="true";
16136
		#$conf["onReady"]="true";
16137
		#$conf["globalJs"],字串陣列,為要放入<script>標籤的js全域變數.
16137
		#$conf["globalJs"],字串陣列,為要放入<script>標籤的js全域變數.
Line 16139... Line 16139...
16139
		#$conf["jsFunciton"],字串陣列,為要放入<script>標籤的js函數.
16139
		#$conf["jsFunciton"],字串陣列,為要放入<script>標籤的js函數.
16140
		#$conf["jsFunciton"]=array();
16140
		#$conf["jsFunciton"]=array();
16141
		#參考資料:
16141
		#參考資料:
16142
		#http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the
16142
		#http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the
16143
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
16143
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
16144
		unset($conf["javaScript::toScript"]);   		
16144
		unset($conf["javaScript::toScript"]);
16145
	
16145
 
16146
		#如果檢查參數失敗
16146
		#如果檢查參數失敗
16147
		if($toScript["status"]==="false"){
16147
		if($toScript["status"]==="false"){
16148
 
16148
 
16149
			#設置執行失敗
16149
			#設置執行失敗
16150
			$result["status"]="false";
16150
			$result["status"]="false";
Line 16154... Line 16154...
16154
 
16154
 
16155
			#回傳結果
16155
			#回傳結果
16156
			return $result;
16156
			return $result;
16157
 
16157
 
16158
			}#if end
16158
			}#if end
16159
			
16159
 
16160
		#取得 js 語法
16160
		#取得 js 語法
16161
		$result["content"]=$result["content"].$toScript["content"];	
16161
		$result["content"]=$result["content"].$toScript["content"];
16162
			
16162
 
16163
		#設置執行正常
16163
		#設置執行正常
16164
		$result["status"]="true";
16164
		$result["status"]="true";
16165
		
16165
 
16166
		#回傳結果
16166
		#回傳結果
16167
		return $result;
16167
		return $result;
16168
	
16168
 
16169
		}#funtion readTable end
16169
		}#funtion readTable end
16170
 
16170
 
16171
	/*
16171
	/*
16172
	#函式說明:
16172
	#函式說明:
16173
	#提供tab頁簽,點選頁簽後顯示對應的內容.套用的element結構如下:
16173
	#提供tab頁簽,點選頁簽後顯示對應的內容.套用的element結構如下:
Line 16179... Line 16179...
16179
	#	</div>
16179
	#	</div>
16180
	#	<div data-tab-name="tab2" style="display:none;">
16180
	#	<div data-tab-name="tab2" style="display:none;">
16181
	#		tab2 content...
16181
	#		tab2 content...
16182
	#	</div>
16182
	#	</div>
16183
	#	<div data-tab-name="tab3" style="display:none;">
16183
	#	<div data-tab-name="tab3" style="display:none;">
16184
	#		tab3 content...	
16184
	#		tab3 content...
16185
	#	</div>
16185
	#	</div>
16186
	#</div>
16186
	#</div>
16187
	#回傳結果:
16187
	#回傳結果:
16188
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
16188
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
16189
	#$result["error"],錯誤訊息.
16189
	#$result["error"],錯誤訊息.
16190
	#$result["function"],當前執行的函數名稱.
16190
	#$result["function"],當前執行的函數名稱.
16191
	#$result["content"],語法.
16191
	#$result["content"],語法.
16192
	#必填參數:
16192
	#必填參數:
16193
	#$conf["place"],字串,該功能區塊要在哪個元素裡面呈現,其區塊特徵為何?(請參閱javascript的querySelector函式).
16193
	#$conf["place"],字串,該功能區塊要在哪個元素裡面呈現,其區塊特徵為何?(請參閱javascript的querySelector函式).
16194
	$conf["place"]="";
16194
	$conf["place"]="";
16195
	#可省略參數:	
16195
	#可省略參數:
16196
	#$conf["height"],字串,tab選單+內容的高度,單位為px..
16196
	#$conf["height"],字串,tab選單+內容的高度,單位為px..
16197
	#$conf["height"]="291";
16197
	#$conf["height"]="291";
16198
	#參考資料:
16198
	#參考資料:
16199
	#無.
16199
	#無.
16200
	#備註:
16200
	#備註:
16201
	#無.
16201
	#無.
16202
	*/
16202
	*/
16203
	public static function tab(&$conf){
16203
	public static function tab(&$conf){
16204
	
16204
 
16205
		#初始化要回傳的結果
16205
		#初始化要回傳的結果
16206
		$result=array();
16206
		$result=array();
16207
 
16207
 
16208
		#取得當前執行的函數名稱
16208
		#取得當前執行的函數名稱
16209
		$result["function"]=__FUNCTION__;
16209
		$result["function"]=__FUNCTION__;
Line 16313... Line 16313...
16313
 
16313
 
16314
			#回傳結果
16314
			#回傳結果
16315
			return $result;
16315
			return $result;
16316
 
16316
 
16317
			}#if end
16317
			}#if end
16318
		
16318
 
16319
		#初始化要回傳的語法
16319
		#初始化要回傳的語法
16320
		$result["content"]="";
16320
		$result["content"]="";
16321
	
16321
 
16322
		#函式說明:
16322
		#函式說明:
16323
		#將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).
16323
		#將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).
16324
		#回傳結果:
16324
		#回傳結果:
16325
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
16325
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
16326
		#$result["error"],錯誤訊息陣列
16326
		#$result["error"],錯誤訊息陣列
Line 16330... Line 16330...
16330
		#$conf["script"],字串,要執行的javaScript語法.
16330
		#$conf["script"],字串,要執行的javaScript語法.
16331
		$conf["javaScript::toScript"]["script"]=
16331
		$conf["javaScript::toScript"]["script"]=
16332
		"
16332
		"
16333
		//取得要放置投影片內容的區塊
16333
		//取得要放置投影片內容的區塊
16334
		var displayArea=document.querySelector('".$conf["place"]."');
16334
		var displayArea=document.querySelector('".$conf["place"]."');
16335
		
16335
 
16336
		//儲存頁籤的數量
16336
		//儲存頁籤的數量
16337
		var tabsCount=displayArea.children.length;
16337
		var tabsCount=displayArea.children.length;
16338
		
16338
 
16339
		//初始化儲存頁籤的名稱
16339
		//初始化儲存頁籤的名稱
16340
		var tabsName=[];
16340
		var tabsName=[];
16341
		
16341
 
16342
		//針對每個頁簽
16342
		//針對每個頁簽
16343
		for(var i=0;i<tabsCount;i++){
16343
		for(var i=0;i<tabsCount;i++){
16344
			
16344
 
16345
			//隱藏頁籤
16345
			//隱藏頁籤
16346
			displayArea.children[i].style.display='none';
16346
			displayArea.children[i].style.display='none';
16347
			
16347
 
16348
			//初始化頁籤名稱
16348
			//初始化頁籤名稱
16349
			var tabName='tab'+i;
16349
			var tabName='tab'+i;
16350
			
16350
 
16351
			//如果有設置頁籤的名稱
16351
			//如果有設置頁籤的名稱
16352
			if(displayArea.children[i].dataset.tabName!==undefined){
16352
			if(displayArea.children[i].dataset.tabName!==undefined){
16353
			
16353
 
16354
				//更新頁籤名稱
16354
				//更新頁籤名稱
16355
				tabName=displayArea.children[i].dataset.tabName
16355
				tabName=displayArea.children[i].dataset.tabName
16356
			
16356
 
16357
				}//if end
16357
				}//if end
16358
			
16358
 
16359
			//儲存頁籤名稱
16359
			//儲存頁籤名稱
16360
			tabsName.push(tabName);
16360
			tabsName.push(tabName);
16361
			
16361
 
16362
			}//for end
16362
			}//for end
16363
			
16363
 
16364
		//建立存放頁籤選單的div
16364
		//建立存放頁籤選單的div
16365
		var tabsDiv=document.createElement('div');
16365
		var tabsDiv=document.createElement('div');
16366
		
16366
 
16367
		//針對每個頁簽
16367
		//針對每個頁簽
16368
		for(var i=0;i<tabsCount;i++){
16368
		for(var i=0;i<tabsCount;i++){
16369
			
16369
 
16370
			//建立頁籤的div
16370
			//建立頁籤的div
16371
			var div=document.createElement('div');
16371
			var div=document.createElement('div');
16372
			
16372
 
16373
			//設置儘量不換行
16373
			//設置儘量不換行
16374
			div.style.display='inline-block';
16374
			div.style.display='inline-block';
16375
			
16375
 
16376
			//設置間隔避免無法識別
16376
			//設置間隔避免無法識別
16377
			div.style.marginLeft='5px';
16377
			div.style.marginLeft='5px';
16378
			div.style.marginRight='5px';
16378
			div.style.marginRight='5px';
16379
			
16379
 
16380
			//設置index
16380
			//設置index
16381
			div.dataset.index=i+1;
16381
			div.dataset.index=i+1;
16382
			
16382
 
16383
			//放置頁籤的名稱
16383
			//放置頁籤的名稱
16384
			div.appendChild(document.createTextNode(tabsName[i]));
16384
			div.appendChild(document.createTextNode(tabsName[i]));
16385
			
16385
 
16386
			//放置頁籤
16386
			//放置頁籤
16387
			tabsDiv.appendChild(div);
16387
			tabsDiv.appendChild(div);
16388
			
16388
 
16389
			//新增該頁籤的點擊事件
16389
			//新增該頁籤的點擊事件
16390
			div.addEventListener('click',function(event){
16390
			div.addEventListener('click',function(event){
16391
			
16391
 
16392
				//針對每個頁簽
16392
				//針對每個頁簽
16393
				for(var j=1;j<tabsDiv.children.length+1;j++){
16393
				for(var j=1;j<tabsDiv.children.length+1;j++){
16394
					
16394
 
16395
					//隱藏頁籤標題
16395
					//隱藏頁籤標題
16396
					displayArea.children[0].children[j-1].style.borderBottom='unset';
16396
					displayArea.children[0].children[j-1].style.borderBottom='unset';
16397
					
16397
 
16398
					//隱藏頁籤與礦線
16398
					//隱藏頁籤與礦線
16399
					displayArea.children[j].style.display='none';
16399
					displayArea.children[j].style.display='none';
16400
					
16400
 
16401
					}//for end
16401
					}//for end
16402
			
16402
 
16403
				";
16403
				";
16404
				
16404
 
16405
				#如果有設置高度
16405
				#如果有設置高度
16406
				if(isset($conf["height"]))
16406
				if(isset($conf["height"]))
16407
				{
16407
				{
16408
					#串接高度的設定
16408
					#串接高度的設定
16409
					$conf["javaScript::toScript"]["script"]=$conf["javaScript::toScript"]["script"].
16409
					$conf["javaScript::toScript"]["script"]=$conf["javaScript::toScript"]["script"].
16410
					"
16410
					"
16411
						//設定tab內容區塊的高度
16411
						//設定tab內容區塊的高度
16412
						displayArea.children[this.dataset.index].children[0].style.height=".$conf["height"]."-parseInt(getComputedStyle(displayArea.children[0]).height)+'px';
16412
						displayArea.children[this.dataset.index].children[0].style.height=".$conf["height"]."-parseInt(getComputedStyle(displayArea.children[0]).height)+'px';
16413
					";
16413
					";
16414
				
16414
 
16415
				}#if end
16415
				}#if end
16416
				
16416
 
16417
				$conf["javaScript::toScript"]["script"]=$conf["javaScript::toScript"]["script"].
16417
				$conf["javaScript::toScript"]["script"]=$conf["javaScript::toScript"]["script"].
16418
				"
16418
				"
16419
			
16419
 
16420
				//顯示目標頁籤內容
16420
				//顯示目標頁籤內容
16421
				displayArea.children[this.dataset.index].style.display='inline-block';
16421
				displayArea.children[this.dataset.index].style.display='inline-block';
16422
				
16422
 
16423
				//提示當前選擇的頁籤
16423
				//提示當前選擇的頁籤
16424
				displayArea.children[0].children[this.dataset.index-1].style.borderBottom='solid blue';
16424
				displayArea.children[0].children[this.dataset.index-1].style.borderBottom='solid blue';
16425
			
16425
 
16426
				});
16426
				});
16427
			
16427
 
16428
			}//for end
16428
			}//for end
16429
			
16429
 
16430
		//放置標籤選單
16430
		//放置標籤選單
16431
		displayArea.prepend(tabsDiv);
16431
		displayArea.prepend(tabsDiv);
16432
		
16432
 
16433
		//預設顯示第一個頁簽
16433
		//預設顯示第一個頁簽
16434
		displayArea.children[0].children[0].click();
16434
		displayArea.children[0].children[0].click();
16435
		
16435
 
16436
		";
16436
		";
16437
		#可省略參數:
16437
		#可省略參數:
16438
		#$conf["onReady"],字串,是否要在網頁完全載入後再執行,"false"為不等載入完就先執行,預設為"true"要等載入完再執行.
16438
		#$conf["onReady"],字串,是否要在網頁完全載入後再執行,"false"為不等載入完就先執行,預設為"true"要等載入完再執行.
16439
		#$conf["onReady"]="true";
16439
		#$conf["onReady"]="true";
16440
		#$conf["globalJs"],字串陣列,為要放入<script>標籤的js全域變數.
16440
		#$conf["globalJs"],字串陣列,為要放入<script>標籤的js全域變數.
Line 16445... Line 16445...
16445
		#http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the
16445
		#http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the
16446
		#備註:
16446
		#備註:
16447
		#無.
16447
		#無.
16448
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
16448
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
16449
		unset($conf["javaScript::toScript"]);
16449
		unset($conf["javaScript::toScript"]);
16450
		
16450
 
16451
		#如果建立 script 語法失敗
16451
		#如果建立 script 語法失敗
16452
		if($toScript["status"]==="false"){
16452
		if($toScript["status"]==="false"){
16453
		
16453
 
16454
			#設置執行失敗
16454
			#設置執行失敗
16455
			$result["status"]="false";
16455
			$result["status"]="false";
16456
		
16456
 
16457
			#設置錯誤訊息
16457
			#設置錯誤訊息
16458
			$result["error"]=$toScript;
16458
			$result["error"]=$toScript;
16459
			
16459
 
16460
			#回傳結果
16460
			#回傳結果
16461
			return $result;
16461
			return $result;
16462
		
16462
 
16463
			}#if end
16463
			}#if end
16464
		
16464
 
16465
		#儲存內容
16465
		#儲存內容
16466
		$result["content"]=$result["content"].$toScript["content"];
16466
		$result["content"]=$result["content"].$toScript["content"];
16467
	
16467
 
16468
		#設置執行正常
16468
		#設置執行正常
16469
		$result["status"]="true";
16469
		$result["status"]="true";
16470
	
16470
 
16471
		#回傳結果
16471
		#回傳結果
16472
		return $result;
16472
		return $result;
16473
	
16473
 
16474
		}#function tab end
16474
		}#function tab end
16475
 
16475
 
16476
	/*
16476
	/*
16477
	#函式說明:
16477
	#函式說明:
16478
	#區塊輪播的效果,輪播內容支援影片播放結束後再換下一張.
16478
	#區塊輪播的效果,輪播內容支援影片播放結束後再換下一張.
Line 16484... Line 16484...
16484
	#必填參數:
16484
	#必填參數:
16485
	#$conf["place"],字串,輪播區塊要在哪個元素裡面呈現,其區塊特徵為何?(請參閱javascript的querySelector函式).
16485
	#$conf["place"],字串,輪播區塊要在哪個元素裡面呈現,其區塊特徵為何?(請參閱javascript的querySelector函式).
16486
	$conf["place"]="";
16486
	$conf["place"]="";
16487
	#$conf["slideHtml"],字串陣列,每個投影片的html語法,其生成結構必須為 html > body > div > anyTag(content to show).
16487
	#$conf["slideHtml"],字串陣列,每個投影片的html語法,其生成結構必須為 html > body > div > anyTag(content to show).
16488
	$conf["slideHtml"]=array("");
16488
	$conf["slideHtml"]=array("");
16489
	#可省略參數:	
16489
	#可省略參數:
16490
	#$conf["sec"],字串,過幾秒就要置換成下一張投影片,預設為"3",代表每3秒就換一張投影片.
16490
	#$conf["sec"],字串,過幾秒就要置換成下一張投影片,預設為"3",代表每3秒就換一張投影片.
16491
	#$conf["sec"]="3";
16491
	#$conf["sec"]="3";
16492
	#參考資料:
16492
	#參考資料:
16493
	#無.
16493
	#無.
16494
	#備註:
16494
	#備註:
16495
	#無.
16495
	#無.
16496
	*/
16496
	*/
16497
	public static function slideDivPlus(&$conf){
16497
	public static function slideDivPlus(&$conf){
16498
	
16498
 
16499
		#初始化要回傳的結果
16499
		#初始化要回傳的結果
16500
		$result=array();
16500
		$result=array();
16501
 
16501
 
16502
		#取得當前執行的函數名稱
16502
		#取得當前執行的函數名稱
16503
		$result["function"]=__FUNCTION__;
16503
		$result["function"]=__FUNCTION__;
Line 16607... Line 16607...
16607
 
16607
 
16608
			#回傳結果
16608
			#回傳結果
16609
			return $result;
16609
			return $result;
16610
 
16610
 
16611
			}#if end
16611
			}#if end
16612
	
16612
 
16613
		#初始化要回傳的語法
16613
		#初始化要回傳的語法
16614
		$result["content"]="";
16614
		$result["content"]="";
16615
	
16615
 
16616
		#函式說明:
16616
		#函式說明:
16617
		#將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).
16617
		#將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).
16618
		#回傳結果:
16618
		#回傳結果:
16619
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
16619
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
16620
		#$result["error"],錯誤訊息陣列
16620
		#$result["error"],錯誤訊息陣列
Line 16624... Line 16624...
16624
		#$conf["script"],字串,要執行的javaScript語法.
16624
		#$conf["script"],字串,要執行的javaScript語法.
16625
		$conf["javaScript::toScript"]["script"]=
16625
		$conf["javaScript::toScript"]["script"]=
16626
		"
16626
		"
16627
			//設置要使用的投影片
16627
			//設置要使用的投影片
16628
			window.qbpwcf.slide.eles=".json_encode($conf["slideHtml"]).";
16628
			window.qbpwcf.slide.eles=".json_encode($conf["slideHtml"]).";
16629
			
16629
 
16630
			//設置放置投影片的區塊特徵
16630
			//設置放置投影片的區塊特徵
16631
			window.qbpwcf.slide.displayDivByQuerySelector='".$conf["place"]."';
16631
			window.qbpwcf.slide.displayDivByQuerySelector='".$conf["place"]."';
16632
			
16632
 
16633
			//初始化投影片的滯留時間,預設為3秒,時間到就換下一個投影片.
16633
			//初始化投影片的滯留時間,預設為3秒,時間到就換下一個投影片.
16634
			window.qbpwcf.slide.showTime=".$conf["sec"].";
16634
			window.qbpwcf.slide.showTime=".$conf["sec"].";
16635
			
16635
 
16636
			//呈現投影片
16636
			//呈現投影片
16637
			window.qbpwcf.slide.func();
16637
			window.qbpwcf.slide.func();
16638
		";
16638
		";
16639
		#可省略參數:
16639
		#可省略參數:
16640
		#$conf["onReady"],字串,是否要在網頁完全載入後再執行,"false"為不等載入完就先執行,預設為"true"要等載入完再執行.
16640
		#$conf["onReady"],字串,是否要在網頁完全載入後再執行,"false"為不等載入完就先執行,預設為"true"要等載入完再執行.
Line 16650... Line 16650...
16650
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
16650
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
16651
		unset($conf["javaScript::toScript"]);
16651
		unset($conf["javaScript::toScript"]);
16652
 
16652
 
16653
		#如果建立 script 語法失敗
16653
		#如果建立 script 語法失敗
16654
		if($toScript["status"]==="false"){
16654
		if($toScript["status"]==="false"){
16655
		
16655
 
16656
			#設置執行失敗
16656
			#設置執行失敗
16657
			$result["status"]="false";
16657
			$result["status"]="false";
16658
		
16658
 
16659
			#設置錯誤訊息
16659
			#設置錯誤訊息
16660
			$result["error"]=$toScript;
16660
			$result["error"]=$toScript;
16661
			
16661
 
16662
			#回傳結果
16662
			#回傳結果
16663
			return $result;
16663
			return $result;
16664
		
16664
 
16665
			}#if end
16665
			}#if end
16666
		
16666
 
16667
		#儲存內容
16667
		#儲存內容
16668
		$result["content"]=$result["content"].$toScript["content"];
16668
		$result["content"]=$result["content"].$toScript["content"];
16669
	
16669
 
16670
		#設置執行正常
16670
		#設置執行正常
16671
		$result["status"]="true";
16671
		$result["status"]="true";
16672
	
16672
 
16673
		#回傳結果
16673
		#回傳結果
16674
		return $result;
16674
		return $result;
16675
			
16675
 
16676
		}#functino slideDivPlus end
16676
		}#functino slideDivPlus end
16677
 
16677
 
16678
	/*
16678
	/*
16679
	#函式說明:
16679
	#函式說明:
16680
	#將指定的字形套用在body上.
16680
	#將指定的字形套用在body上.
Line 16692... Line 16692...
16692
	#無.
16692
	#無.
16693
	#備註:
16693
	#備註:
16694
	#無.
16694
	#無.
16695
	*/
16695
	*/
16696
	public static function setBodyFont(&$conf){
16696
	public static function setBodyFont(&$conf){
16697
	
16697
 
16698
		#初始化要回傳的結果
16698
		#初始化要回傳的結果
16699
		$result=array();
16699
		$result=array();
16700
 
16700
 
16701
		#取得當前執行的函數名稱
16701
		#取得當前執行的函數名稱
16702
		$result["function"]=__FUNCTION__;
16702
		$result["function"]=__FUNCTION__;
Line 16723... Line 16723...
16723
 
16723
 
16724
			#回傳結果
16724
			#回傳結果
16725
			return $result;
16725
			return $result;
16726
 
16726
 
16727
			}#if end
16727
			}#if end
16728
	
16728
 
16729
		#函式說明:
16729
		#函式說明:
16730
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容.
16730
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容.
16731
		#回傳結果:
16731
		#回傳結果:
16732
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
16732
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
16733
		#$result["error"],執行不正常結束的錯訊息陣列.
16733
		#$result["error"],執行不正常結束的錯訊息陣列.
Line 16778... Line 16778...
16778
		#array_keys=>http://php.net/manual/en/function.array-keys.php
16778
		#array_keys=>http://php.net/manual/en/function.array-keys.php
16779
		#備註:
16779
		#備註:
16780
		#無.
16780
		#無.
16781
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
16781
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
16782
		unset($conf["variableCheck::checkArguments"]);
16782
		unset($conf["variableCheck::checkArguments"]);
16783
	
16783
 
16784
		#如果執行失敗
16784
		#如果執行失敗
16785
		if($checkArguments["status"]==="false"){
16785
		if($checkArguments["status"]==="false"){
16786
		
16786
 
16787
			#設置執行異常
16787
			#設置執行異常
16788
			$result["status"]="false";
16788
			$result["status"]="false";
16789
		
16789
 
16790
			#設置執行錯誤訊息
16790
			#設置執行錯誤訊息
16791
			$result["error"]=$checkArguments;
16791
			$result["error"]=$checkArguments;
16792
		
16792
 
16793
			#回傳結果
16793
			#回傳結果
16794
			return $result;
16794
			return $result;
16795
		
16795
 
16796
			}#if end
16796
			}#if end
16797
			
16797
 
16798
		#如果參數檢查不通過
16798
		#如果參數檢查不通過
16799
		if($checkArguments["passed"]==="false"){
16799
		if($checkArguments["passed"]==="false"){
16800
		
16800
 
16801
			#設置執行異常
16801
			#設置執行異常
16802
			$result["status"]="false";
16802
			$result["status"]="false";
16803
		
16803
 
16804
			#設置執行錯誤訊息
16804
			#設置執行錯誤訊息
16805
			$result["error"]=$checkArguments;
16805
			$result["error"]=$checkArguments;
16806
		
16806
 
16807
			#回傳結果
16807
			#回傳結果
16808
			return $result;
16808
			return $result;
16809
		
16809
 
16810
			}#if end
16810
			}#if end
16811
		
16811
 
16812
		#如果有設置 outsideFontUrl
16812
		#如果有設置 outsideFontUrl
16813
		if(isset($conf["outsideFontUrl"])){
16813
		if(isset($conf["outsideFontUrl"])){
16814
		
16814
 
16815
			#設置字形是從 url 取得
16815
			#設置字形是從 url 取得
16816
			$isWeb="true";
16816
			$isWeb="true";
16817
		
16817
 
16818
			#設置字形url
16818
			#設置字形url
16819
			$fontsPath=$conf["outsideFontUrl"];
16819
			$fontsPath=$conf["outsideFontUrl"];
16820
		
16820
 
16821
			}#if end
16821
			}#if end
16822
			
16822
 
16823
		#反之
16823
		#反之
16824
		else{
16824
		else{
16825
		
16825
 
16826
			#設置字形是從本地取得
16826
			#設置字形是從本地取得
16827
			$isWeb="false";
16827
			$isWeb="false";
16828
			
16828
 
16829
			#取得存在字形的根目錄
16829
			#取得存在字形的根目錄
16830
			$fontsPath=pathinfo(__FILE__)["dirname"]."/fonts/".$conf["fontPath"];
16830
			$fontsPath=pathinfo(__FILE__)["dirname"]."/fonts/".$conf["fontPath"];
16831
		
16831
 
16832
			}#else end
16832
			}#else end
16833
 
16833
 
16834
		#取得font檔案內容
16834
		#取得font檔案內容
16835
		#函式說明:
16835
		#函式說明:
16836
		#依據行號分隔抓取檔案的內容,結果會回傳一個陣列
16836
		#依據行號分隔抓取檔案的內容,結果會回傳一個陣列
Line 16866... Line 16866...
16866
		#無.
16866
		#無.
16867
		#備註:
16867
		#備註:
16868
		#無.
16868
		#無.
16869
		$getFileContent=fileAccess::getFileContent($conf["fileAccess::getFileContent"]);
16869
		$getFileContent=fileAccess::getFileContent($conf["fileAccess::getFileContent"]);
16870
		unset($conf["fileAccess::getFileContent"]);
16870
		unset($conf["fileAccess::getFileContent"]);
16871
	
16871
 
16872
		#如果執行異常
16872
		#如果執行異常
16873
		if($getFileContent["status"]==="false"){
16873
		if($getFileContent["status"]==="false"){
16874
		
16874
 
16875
			#設置執行異常
16875
			#設置執行異常
16876
			$result["status"]="false";
16876
			$result["status"]="false";
16877
		
16877
 
16878
			#設置執行錯誤訊息
16878
			#設置執行錯誤訊息
16879
			$result["error"]=$getFileContent;
16879
			$result["error"]=$getFileContent;
16880
		
16880
 
16881
			#回傳結果
16881
			#回傳結果
16882
			return $result;
16882
			return $result;
16883
		
16883
 
16884
			}#if end
16884
			}#if end
16885
		
16885
 
16886
		#set custom font path
16886
		#set custom font path
16887
		$setFontPart=
16887
		$setFontPart=
16888
		"
16888
		"
16889
			//store font file in base64 encode string
16889
			//store font file in base64 encode string
16890
			window.qbpwcf.fonts.base64='".$getFileContent["base64dataOnly"]."';
16890
			window.qbpwcf.fonts.base64='".$getFileContent["base64dataOnly"]."';
16891
			
16891
 
16892
			//store font file in bufferArray 
16892
			//store font file in bufferArray
16893
			window.qbpwcf.fonts.bufferArray=Uint8Array.fromBase64(window.qbpwcf.fonts.base64).buffer;
16893
			window.qbpwcf.fonts.bufferArray=Uint8Array.fromBase64(window.qbpwcf.fonts.base64).buffer;
16894
		
16894
 
16895
		";
16895
		";
16896
	
16896
 
16897
		#函式說明:
16897
		#函式說明:
16898
		#將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).
16898
		#將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).
16899
		#回傳結果:
16899
		#回傳結果:
16900
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
16900
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
16901
		#$result["error"],錯誤訊息陣列
16901
		#$result["error"],錯誤訊息陣列
Line 16921... Line 16921...
16921
		#http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the
16921
		#http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the
16922
		#備註:
16922
		#備註:
16923
		#無.
16923
		#無.
16924
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
16924
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
16925
		unset($conf["javaScript::toScript"]);
16925
		unset($conf["javaScript::toScript"]);
16926
	
16926
 
16927
		#儲存html(javascript)語法
16927
		#儲存html(javascript)語法
16928
		$result["content"]=$toScript["content"];
16928
		$result["content"]=$toScript["content"];
16929
		
16929
 
16930
		#設置執行正常
16930
		#設置執行正常
16931
		$result["status"]="true";
16931
		$result["status"]="true";
16932
		
16932
 
16933
		#回傳結果
16933
		#回傳結果
16934
		return $result;
16934
		return $result;
16935
	
16935
 
16936
		}#function setBodyFont end
16936
		}#function setBodyFont end
16937
 
16937
 
16938
	}#class javaScript end
16938
	}#class javaScript end
16939
 
16939
 
16940
/*
16940
/*
Line 16965... Line 16965...
16965
	document.getElementById('img').src=URL.createObjectURL(event.target.files[0]);
16965
	document.getElementById('img').src=URL.createObjectURL(event.target.files[0]);
16966
 
16966
 
16967
	//get selected file content
16967
	//get selected file content
16968
	reader=new FileReader();
16968
	reader=new FileReader();
16969
	reader.readAsBinaryString(event.target.files[0]);
16969
	reader.readAsBinaryString(event.target.files[0]);
16970
	reader.onload=function(event) 
16970
	reader.onload=function(event)
16971
	{
16971
	{
16972
		//base64 encode
16972
		//base64 encode
16973
		newVal=btoa(event.target.result);
16973
		newVal=btoa(event.target.result);
16974
	
16974
 
16975
		//obj to save
16975
		//obj to save
16976
		newValObj=
16976
		newValObj=
16977
		{
16977
		{
16978
			where:
16978
			where:
16979
			{
16979
			{
Line 16994... Line 16994...
16994
		xmlhttp.open('POST','update',false);
16994
		xmlhttp.open('POST','update',false);
16995
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
16995
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
16996
		xmlhttp.setRequestHeader('X-Requested-With','XMLHttpRequest');
16996
		xmlhttp.setRequestHeader('X-Requested-With','XMLHttpRequest');
16997
		xmlhttp.onreadystatechange=function(){}//function end
16997
		xmlhttp.onreadystatechange=function(){}//function end
16998
		xmlhttp.send('params='+params); //如果是post則要將參數加在這邊 'key1=encodeURIComponent(val1)&key2=encodeURIComponent(val2)';
16998
		xmlhttp.send('params='+params); //如果是post則要將參數加在這邊 'key1=encodeURIComponent(val1)&key2=encodeURIComponent(val2)';
16999
	};	
16999
	};
17000
});	
17000
});
17001
input.click(); //觸發事件
17001
input.click(); //觸發事件
17002
// 直接將選擇好的圖片檔案直接用來使用 - end
17002
// 直接將選擇好的圖片檔案直接用來使用 - end
17003
 
17003
 
17004
//get new value
17004
//get new value
17005
reader=new FileReader();
17005
reader=new FileReader();
Line 17032... Line 17032...
17032
window.addEventListener("resize" function(){
17032
window.addEventListener("resize" function(){
17033
	...
17033
	...
17034
	});
17034
	});
17035
 
17035
 
17036
#當滾軸移動時觸發的事件
17036
#當滾軸移動時觸發的事件
17037
window.addEventListener('scroll', function(e){	
17037
window.addEventListener('scroll', function(e){
17038
	//get last scroll y, 0 means top.
17038
	//get last scroll y, 0 means top.
17039
	var last_known_scroll_position = window.scrollY;
17039
	var last_known_scroll_position = window.scrollY;
17040
	});
17040
	});
17041
 
17041
 
17042
#建立物件函數,並透過addEventListener指定執行
17042
#建立物件函數,並透過addEventListener指定執行
Line 17197... Line 17197...
17197
	var opval=select.options[i].attributes['value'].value;
17197
	var opval=select.options[i].attributes['value'].value;
17198
	if(opval===selectVal){
17198
	if(opval===selectVal){
17199
		var opName=select.options[i].innerHTML;
17199
		var opName=select.options[i].innerHTML;
17200
		}
17200
		}
17201
	}
17201
	}
17202
	
17202
 
17203
#下拉式選單選擇了哪個options;
17203
#下拉式選單選擇了哪個options;
17204
var select=document.getElementById('selectID');
17204
var select=document.getElementById('selectID');
17205
var optionIndex=select.options.selectedIndex; //選擇的選項是第幾個
17205
var optionIndex=select.options.selectedIndex; //選擇的選項是第幾個
17206
var selectedOptions=select.options[select.options..selectedIndex]; 選擇的選項元素.
17206
var selectedOptions=select.options[select.options..selectedIndex]; 選擇的選項元素.
17207
 
17207
 
Line 17239... Line 17239...
17239
#取得html所有dom物件
17239
#取得html所有dom物件
17240
document.all
17240
document.all
17241
 
17241
 
17242
#this的應用
17242
#this的應用
17243
window.qbpwcf.lib.init=function(){
17243
window.qbpwcf.lib.init=function(){
17244
	
17244
 
17245
	//等同印出 window,以及this指的是等號左邊的最上層變數.
17245
	//等同印出 window,以及this指的是等號左邊的最上層變數.
17246
	console.log(this);
17246
	console.log(this);
17247
	
17247
 
17248
	}
17248
	}
17249
 
17249
 
17250
#判斷不是數字
17250
#判斷不是數字
17251
var oriVal=parseInt($(this).val());
17251
var oriVal=parseInt($(this).val());
17252
//如果不是數字
17252
//如果不是數字
Line 17332... Line 17332...
17332
	//如果狀態為4且response code為200
17332
	//如果狀態為4且response code為200
17333
	if(xmlhttp.readyState==4 && xmlhttp.status==200){
17333
	if(xmlhttp.readyState==4 && xmlhttp.status==200){
17334
 
17334
 
17335
		//將回應進行處理
17335
		//將回應進行處理
17336
		xmlhttp.response;
17336
		xmlhttp.response;
17337
		
17337
 
17338
		//取得回應的內容
17338
		//取得回應的內容
17339
		res=xmlhttp.response;
17339
		res=xmlhttp.response;
17340
 
17340
 
17341
		//取得回應的html並取代當前的內容,當xmlhttp.responseType='document'時 - start;
17341
		//取得回應的html並取代當前的內容,當xmlhttp.responseType='document'時 - start;
17342
 
17342
 
Line 17346... Line 17346...
17346
		//清空文件,寫入取得的完整回應
17346
		//清空文件,寫入取得的完整回應
17347
		document.write(res.all[0].outerHTML);
17347
		document.write(res.all[0].outerHTML);
17348
 
17348
 
17349
		//結束輸出
17349
		//結束輸出
17350
		document.close();
17350
		document.close();
17351
		
17351
 
17352
		//取得回應的html並取代當前的內容,當xmlhttp.responseType='document'時 - end;
17352
		//取得回應的html並取代當前的內容,當xmlhttp.responseType='document'時 - end;
17353
 
17353
 
17354
		}//if end
17354
		}//if end
17355
 
17355
 
17356
	}//function end
17356
	}//function end
17357
 
17357
 
17358
//參數跟數值內容要用encodeURIComponent才不會有編碼的錯誤產生
17358
//參數跟數值內容要用encodeURIComponent才不會有編碼的錯誤產生
17359
xmlhttp.send(); //如果是post則要將參數加在這邊 'encodeURIComponent(key1)=encodeURIComponent(val1)&encodeURIComponent(key2)=encodeURIComponent(val2)';
17359
xmlhttp.send(); //如果是post則要將參數加在這邊 'encodeURIComponent(key1)=encodeURIComponent(val1)&encodeURIComponent(key2)=encodeURIComponent(val2)';
17360
 
17360
 
17361
//如果要在迴圈裏面執行異步的ajax,由於js是傳參考的語言,因此建議將每個ajax個別儲存在陣列裏面。 - start 
17361
//如果要在迴圈裏面執行異步的ajax,由於js是傳參考的語言,因此建議將每個ajax個別儲存在陣列裏面。 - start
17362
 
17362
 
17363
//初始化儲存xmlhttp的陣列
17363
//初始化儲存xmlhttp的陣列
17364
xmlhttp=[];
17364
xmlhttp=[];
17365
 
17365
 
17366
//針對每列
17366
//針對每列
Line 17369... Line 17369...
17369
	//取得列
17369
	//取得列
17370
	tr=tbody.children[i];
17370
	tr=tbody.children[i];
17371
 
17371
 
17372
	//取得燈狀態
17372
	//取得燈狀態
17373
	lightSta=tr.children[1].children[0];
17373
	lightSta=tr.children[1].children[0];
17374
	
17374
 
17375
	//取得gw id
17375
	//取得gw id
17376
	gwId=tr.children[0].innerText;
17376
	gwId=tr.children[0].innerText;
17377
 
17377
 
17378
	url='area/device/getDeviceInfoInJSON/'+gwId;
17378
	url='area/device/getDeviceInfoInJSON/'+gwId;
17379
	xmlhttp[i]=new XMLHttpRequest();
17379
	xmlhttp[i]=new XMLHttpRequest();
Line 17382... Line 17382...
17382
	xmlhttp[i].temp.lightSta=lightSta; //用於儲存額外的資訊給ajax function - end
17382
	xmlhttp[i].temp.lightSta=lightSta; //用於儲存額外的資訊給ajax function - end
17383
	xmlhttp[i].open('POST',url,true);
17383
	xmlhttp[i].open('POST',url,true);
17384
	xmlhttp[i].setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=UTF-8');
17384
	xmlhttp[i].setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=UTF-8');
17385
	xmlhttp[i].setRequestHeader('X-Requested-With','XMLHttpRequest');
17385
	xmlhttp[i].setRequestHeader('X-Requested-With','XMLHttpRequest');
17386
	xmlhttp[i].onreadystatechange=function(e)
17386
	xmlhttp[i].onreadystatechange=function(e)
17387
	{	
17387
	{
17388
		//debug	
17388
		//debug
17389
		if(window.debug)
17389
		if(window.debug)
17390
		{
17390
		{
17391
			console.log('e - start');
17391
			console.log('e - start');
17392
			console.log(e);
17392
			console.log(e);
17393
			console.log(e.target); //xmlhttp[i] 自己
17393
			console.log(e.target); //xmlhttp[i] 自己
17394
			console.log(e.target.response); //xmlhttp[i] 的回應
17394
			console.log(e.target.response); //xmlhttp[i] 的回應
17395
			console.log('e - end');
17395
			console.log('e - end');
17396
		}
17396
		}
17397
		
17397
 
17398
		//get gw id
17398
		//get gw id
17399
		gwId=e.target.temp.gwId;
17399
		gwId=e.target.temp.gwId;
17400
 
17400
 
17401
		//response ok
17401
		//response ok
17402
		if(e.target.readyState===4 && e.target.status===200)
17402
		if(e.target.readyState===4 && e.target.status===200)
Line 17413... Line 17413...
17413
//所有內容跑完之後再執行的事件
17413
//所有內容跑完之後再執行的事件
17414
window.addEventListener('load',function(){
17414
window.addEventListener('load',function(){
17415
 
17415
 
17416
	//一段時間後再執行
17416
	//一段時間後再執行
17417
	setTimeout(function(){
17417
	setTimeout(function(){
17418
	
17418
 
17419
		//get div
17419
		//get div
17420
		var div=document.getElementById('test');
17420
		var div=document.getElementById('test');
17421
		
17421
 
17422
		//set div content
17422
		//set div content
17423
		div.innerText='Loading...';
17423
		div.innerText='Loading...';
17424
		
17424
 
17425
		xmlhttp=new XMLHttpRequest();
17425
		xmlhttp=new XMLHttpRequest();
17426
		xmlhttp.responseType='document';// do not set to document when send a not async request
17426
		xmlhttp.responseType='document';// do not set to document when send a not async request
17427
		xmlhttp.open('GET','javaScriptT/hang.php',true);
17427
		xmlhttp.open('GET','javaScriptT/hang.php',true);
17428
		xmlhttp.response;
17428
		xmlhttp.response;
17429
		xmlhttp.onreadystatechange=function(){
17429
		xmlhttp.onreadystatechange=function(){
Line 17434... Line 17434...
17434
				div.innerText='finish!';
17434
				div.innerText='finish!';
17435
 
17435
 
17436
				}//if end
17436
				}//if end
17437
 
17437
 
17438
			}//function end
17438
			}//function end
17439
			
17439
 
17440
		xmlhttp.send();
17440
		xmlhttp.send();
17441
		
17441
 
17442
		//debug
17442
		//debug
17443
		console.log(xmlhttp.response);
17443
		console.log(xmlhttp.response);
17444
	
17444
 
17445
		//3 秒後再執行
17445
		//3 秒後再執行
17446
		},3000)
17446
		},3000)
17447
	});
17447
	});
17448
 
17448
 
17449
//設定要求的屬性、目的、是否要異步
17449
//設定要求的屬性、目的、是否要異步
Line 17679... Line 17679...
17679
萬用的取得物件屬性方法
17679
萬用的取得物件屬性方法
17680
bit16toNoZeroHead=function(p)
17680
bit16toNoZeroHead=function(p)
17681
{
17681
{
17682
	//範例物件
17682
	//範例物件
17683
	table={a:A,b:B,c:C};
17683
	table={a:A,b:B,c:C};
17684
	
17684
 
17685
	//取得物件有多少key
17685
	//取得物件有多少key
17686
	keyCount=Object.keys(table).length;
17686
	keyCount=Object.keys(table).length;
17687
	
17687
 
17688
	//針對物件每個key
17688
	//針對物件每個key
17689
	for(i=0;i<keyCount;i++)
17689
	for(i=0;i<keyCount;i++)
17690
	{
17690
	{
17691
		//如果物件的key等於參數p
17691
		//如果物件的key等於參數p
17692
		if(p===Object.keys(table)[i])
17692
		if(p===Object.keys(table)[i])
Line 17835... Line 17835...
17835
//當有收到訊息時
17835
//當有收到訊息時
17836
conn.onmessage = function(e)
17836
conn.onmessage = function(e)
17837
{
17837
{
17838
	//將訊息顯現在console
17838
	//將訊息顯現在console
17839
	console.log(e.data);
17839
	console.log(e.data);
17840
	
17840
 
17841
	//傳送訊息
17841
	//傳送訊息
17842
	conn.send('mag');
17842
	conn.send('mag');
17843
}
17843
}
17844
 
17844
 
17845
//當連線斷開後, 每秒重新嘗試一次.
17845
//當連線斷開後, 每秒重新嘗試一次.
17846
conn.onclose = function(e)
17846
conn.onclose = function(e)
17847
{
17847
{
17848
	//指定1秒刷新一次
17848
	//指定1秒刷新一次
17849
	setTimeout('window.webSock.connWebSock.call(this)',1000);
17849
	setTimeout('window.webSock.connWebSock.call(this)',1000);
17850
}
17850
}
17851
 
17851
 
17852
//所有內容跑完之後再執行的事件
17852
//所有內容跑完之後再執行的事件
17853
window.addEventListener('load',function()
17853
window.addEventListener('load',function()
17854
{
17854
{
17855
	//傳送訊息
17855
	//傳送訊息
17856
	conn.send('mag');
17856
	conn.send('mag');
17857
}); 
17857
});
17858
 
17858
 
17859
eval(),將變數的數值印出.
17859
eval(),將變數的數值印出.
17860
i=0;
17860
i=0;
17861
window.eval(i)='aa';
17861
window.eval(i)='aa';
17862
window.0 //會印出 aa
17862
window.0 //會印出 aa
Line 17887... Line 17887...
17887
//https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal
17887
//https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal
17888
 
17888
 
17889
//定義物件的屬性 - end
17889
//定義物件的屬性 - end
17890
 
17890
 
17891
//將圖片上下左右置中
17891
//將圖片上下左右置中
17892
#over {position:relative; text-align:center; 
17892
#over {position:relative; text-align:center;
17893
       width:100%; height:100%; background:#CCC;}
17893
       width:100%; height:100%; background:#CCC;}
17894
 
17894
 
17895
#over img{
17895
#over img{
17896
    position: absolute;
17896
    position: absolute;
17897
    margin: auto;
17897
    margin: auto;
Line 17911... Line 17911...
17911
		this._addEventListener(a,b,c);
17911
		this._addEventListener(a,b,c);
17912
		if(!this.eventListenerList) this.eventListenerList = {};
17912
		if(!this.eventListenerList) this.eventListenerList = {};
17913
		if(!this.eventListenerList[a]) this.eventListenerList[a] = [];
17913
		if(!this.eventListenerList[a]) this.eventListenerList[a] = [];
17914
		this.eventListenerList[a].push(b);
17914
		this.eventListenerList[a].push(b);
17915
		};
17915
		};
17916
	})();	
17916
	})();
17917
	
17917
 
17918
//access binded events
17918
//access binded events
17919
var clicks = someElement.eventListenerList.click;
17919
var clicks = someElement.eventListenerList.click;
17920
if(clicks) clicks.forEach(function(f) {
17920
if(clicks) clicks.forEach(function(f) {
17921
  alert("I listen to this function: "+f.toString());
17921
  alert("I listen to this function: "+f.toString());
17922
});
17922
});
17923
	
17923
 
17924
//參考資料 https://stackoverflow.com/questions/446892/how-to-find-event-listeners-on-a-dom-node-when-debugging-or-from-the-javascript
17924
//參考資料 https://stackoverflow.com/questions/446892/how-to-find-event-listeners-on-a-dom-node-when-debugging-or-from-the-javascript
17925
 
17925
 
17926
//get user agent
17926
//get user agent
17927
navigator.userAgent;
17927
navigator.userAgent;
17928
 
17928