Rev 226 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php/*QBPWCF, Quick Build PHP website Component base on Fedora Linux.Copyright (C) 2014~2026 MIN ZHI, CHENThis file is part of QBPWCF.QBPWCF is free software: you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation, either version 3 of the License, or(at your option) any later version.QBPWCF is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with QBPWCF. If not, see <http://www.gnu.org/licenses/>.*/#使用命名空間qbpwcfnamespace qbpwcf;#assets dir$assetsDir="assets of javaScript::qbpwcfJavaScript_20240910";#產生 qbpwcfJavaScript#函式說明:#建立qbpwcf專屬的js函式庫#回傳結果#$result["funciton"],當前函式的名稱.#$result["status"],執行的狀態,"true"代表正常,"false"代表不正常.#$result["error"],錯誤訊息#$result["content"],語法.#必填參數:#無.#可省略參數:#$conf["noScriptTag"],字串,是否不要輸出<script></script>,預設為"false",代表要輸出;反之為"true",代表不要輸出.$conf["noScriptTag"]="false";#參考資料:#無.#備註:#無.$qbpwcfJavaScript=javaScript::qbpwcfJavaScript($conf);unset($conf);#如果產生失敗if($qbpwcfJavaScript["status"]==="false"){#show detail infovar_dump($qbpwcfJavaScript);#結束執行,並回傳shell 1.exit(1);}#if end#印出 jsecho $qbpwcfJavaScript["content"];#執行目標程式#函式說明:#將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).#回傳結果:#$result["status"],執行是否正常,"true"為正常,"false"為不正常.#$result["error"],錯誤訊息陣列#$result["function"],當前執行的函數名稱#$result["content"],要執行的javaScript語法#必填參數:#$conf["script"],字串,要執行的javaScript語法.$conf["script"]="//建立按鈕var button=document.createElement('button');//設置按鈕上的文字button.innerText='click to choose file to upload';//綁定按鈕的事件button.addEventListener('click',async function(){//選擇要上傳的檔案await window.qbpwcf.clientFile.init();});//放置按鈕document.body.appendChild(button);";#可省略參數:#$conf["onReady"],字串,是否要在網頁完全載入後再執行,"false"為不等載入完就先執行,預設為"true"要等載入完再執行.#$conf["onReady"]="true";#$conf["globalJs"],字串陣列,為要放入<script>標籤的js全域變數.#$conf["globalJs"]=array();#$conf["jsFunciton"],字串陣列,為要放入<script>標籤的js函數.#$conf["jsFunciton"]=array();#$conf["noScriptTag"],字串,是否不要輸出<script></script>,預設為"false",代表要輸出;反之為"true",代表不要輸出.#$conf["noScriptTag"]="false";#參考資料:#http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the#備註:#無.$toScript=javaScript::toScript($conf);unset($conf);#如果執行失敗if($toScript["status"]==="false"){#show detail infovar_dump($toScript);#結束執行,並回傳shell 1.exit(1);}#if end#印出js語法echo $toScript["content"];