/** * popup name */ var CSACODM_MV_1ByPopup = 'CSACODM_MV_1'; //popupName = "CSACODM_MV_1",代碼資料視窗, 顯示欄位:[代碼,代碼意義] var WFCODNM_1ByPopup = 'WFCODNM_1'; //popupName = "WFCODNM_1", 簡易申辦代碼資料視窗, 顯示欄位:[代碼,代碼意義] var WFORGNM_1ByPopup = 'WFORGNM_1'; //popupName = "WFORGNM_1", 表單組織資料視窗, 顯示欄位:[單位代碼,單位中文名稱] var WFUNTNM_1ByPopup = 'WFUNTNM_1'; //popupName = "WFUNTNM_1", 簡易申辦案件統計及報表列印表單組織資料視窗, 顯示欄位:[單位代碼,單位中文名稱] var NFSSTOM_1ByPopup = 'NFSSTOM_1'; //popupName = "NFSSTOM_1", 國際免稅商店業者視窗, 顯示欄位:[免稅商店,廠商名稱] var DFSSTOM_1ByPopup = 'DFSSTOM_1'; //popupName = "DFSSTOM_1", 離島免稅購物商店業者視窗, 顯示欄位:[免稅商店,離島免稅購物商店代碼,廠商名稱] var DFSCODM_1ByPopup = 'DFSCODM_1'; //popupName = "DFSCODM_1", 機關運輸別業者視窗, 顯示欄位:[免稅商店,廠商名稱] var DFSCODM_2ByPopup = 'DFSCODM_2'; //popupName = "DFSCODM_2", 機關運輸別業者視窗, 顯示欄位:[免稅商店,廠商名稱] CODE_TYPE='D01' var SAAB_APPLICATION_1ByPopup = 'SAAB_APPLICATION_1'; //popupName = "SAAB_APPLICATION_1", 應用系統代碼速查視窗, 顯示欄位:[應用系統代碼,系統名稱] var SAAB_PRIVILEGE_DATA_1ByPopup = 'SAAB_PRIVILEGE_DATA_1'; //popupName = "SAAB_PRIVILEGE_DATA_1", 稽核項目速查視窗, 顯示欄位:[權限項目代碼,權限項目名稱] var SAAB_PRIVILEGE_DATA_2ByPopup = 'SAAB_PRIVILEGE_DATA_2'; //popupName = "SAAB_PRIVILEGE_DATA_2", 稽核項目速查視窗, 顯示欄位:[權限項目代碼,權限項目名稱] var SAAB_ORG_DATA_1ByPopup = 'SAAB_ORG_DATA_1'; //popupName = "SAAB_ORG_DATA_1", 部門單位查詢視窗, 顯示欄位:[部門代碼,部門名稱] var SAAB_USER_DATA_1ByPopup = 'SAAB_USER_DATA_1'; //popupName = "SAAB_USER_DATA_1", 使用者資料速查視窗, 顯示欄位:[使用者帳號,使用者名稱] var SCKNDMM_1ByPopup = 'SCKNDMM_1'; //popupName = "SCKNDMM_1", 代碼種類檔視窗, 顯示欄位:[代碼種類,代碼種類說明,新代碼類別(關港貿)] var globalSettings = null; ( function( $ ){ $.fn.popup = function( settings ){ var defaultSettings = { popupName : null, // a popname, 其值請參考 popup name qryCodeEle : null, // 將欄位值返回快取視窗查詢設定 codeEle : null, // 填入 code selector, 如果不需要填入, 不用設定 nameEle : null, // 填入 name selector, 如果不需要填入, 不用設定 dynamicCode : null, // 填入 code selector, 如果不需要填入, 不用設定, 動態產生使用 dynamicName : null, // 填入 code selector, 如果不需要填入, 不用設定, 動態產生使用 strWhereEle : null, // conditions 的 selector,SQL將以 X 欄位 in (strWhere)帶入 show : true, // 跳出的視窗, 是否要顯示查詢欄位 qryTitle : 0, // 主要查詢欄位Title qryAllFiled : true, popupTitle : 'PopupTitle',//popup title debug : false, doBeforeSetting : function(){}, //在 popup framework 讀取 settings, ex: strWhereEle, qryTitle doBefore : function(){ return true; } , //開啟視窗前要做的事, 如果 return false, 將不開啟視窗 callback : function( data ){} }; var newSettings = $.extend( defaultSettings, settings ); $( document ).on( 'dblclick', this.selector, dblclickByPopup( newSettings ) ); return this; }; } )( jQuery ); function checkSettingsByPopup( newSettings ){ if( newSettings.popupName == null ){ alert( '使用 popup 錯誤, 尚未設定 popupName, 請指定一個' ); return false; } if( !( newSettings.popupName == CSACODM_MV_1ByPopup || newSettings.popupName == WFCODNM_1ByPopup || newSettings.popupName == WFORGNM_1ByPopup || newSettings.popupName == WFUNTNM_1ByPopup || newSettings.popupName == NFSSTOM_1ByPopup || newSettings.popupName == DFSSTOM_1ByPopup || newSettings.popupName == DFSCODM_1ByPopup || newSettings.popupName == DFSCODM_2ByPopup || newSettings.popupName == SAAB_APPLICATION_1ByPopup || newSettings.popupName == SAAB_PRIVILEGE_DATA_1ByPopup || newSettings.popupName == SAAB_PRIVILEGE_DATA_2ByPopup || newSettings.popupName == SAAB_ORG_DATA_1ByPopup || newSettings.popupName == SAAB_USER_DATA_1ByPopup|| newSettings.popupName == SCKNDMM_1ByPopup )){ alert( '使用 popup 錯誤, popupName 值指定錯誤, 找不到 popupName:' + newSettings.popupName ); return false; } if( !checkSelector( newSettings ) ) return false; if( !checkTypeByPopup( newSettings ) ) return false; if( !checkMustSetting( newSettings ) ) return false; return true; } /** * 檢查 select 有宣告, 但找不到 selector * @param newSettings * @returns {Boolean} */ function checkSelector( newSettings ){ if( newSettings.codeEle != null && newSettings.codeEle.length == 0 ){ alert( '使用 popup 錯誤, 指定的 codeEle 找不到 selector' ); return false; } if( newSettings.nameEle != null && newSettings.nameEle.length == 0 ){ alert( '使用 popup 錯誤, 指定的 nameEle 找不到 selector' ); return false; } if( newSettings.strWhereEle != null && newSettings.strWhereEle.length == 0 ){ alert( '使用 popup 錯誤, 指定的 strWhereEle 找不到 selector' ); return false; } return true; } /** * 檢查宣告的型能有沒有錯誤 * * @param newSettings * @returns {Boolean} */ function checkTypeByPopup( newSettings ){ if( newSettings.show == null || typeof( newSettings.show ) != 'boolean' ){ alert( '使用 popup 錯誤, 指定的 show 值錯誤, 只能使用 true 或 false boolean 型態' ); return false; } if( newSettings.qryTitle == null || typeof( newSettings.qryTitle ) != 'number' ){ alert( '使用 popup 錯誤, 指定的 qryTitle 值錯誤, 只能使用 typeof( newSettings.qryTitle ) 型態' ); return false; } if( newSettings.debug == null || typeof( newSettings.debug ) != 'boolean' ){ alert( '使用 popup 錯誤, 指定的 debug 值錯誤, 只能使用 true 或 false boolean 型態' ); return false; } return true; } /** * 檢查當某些 popname, 需要有設定 * * @param newSettings */ function checkMustSetting( newSettings ){ if( newSettings.popupName == WFCODNM_1ByPopup ) if( newSettings.strWhereEle == null || newSettings.strWhereEle.length == 0 || $.trim( newSettings.strWhereEle.val() ) == '' ){ alert( '使用 popup 錯誤, 當 popname=' + newSettings.popupName + ', 必需指定 strWhereEle' ); return false; } return true; } function dblclickByPopup( newSettings ){ return function(){ if( !checkSettingsByPopup( newSettings ) ) return; newSettings.doBeforeSetting(); var id = $(this).attr( 'id' ); globalSettings = newSettings; globalSettings.id = id; if( globalSettings.debug ) alert( 'run dblclick, id:' + id ); var fieldTitle = getFieldTitle(); var settingIdName = getSettingIdName(); var strWhere = getStrWhere(); if( globalSettings.debug ) alert( 'in dblclickByPopup, settingIdName:' + settingIdName ); var strParam = 'fieldTitle=' + fieldTitle; if( globalSettings.qryCodeEle != null ) strParam += ( '&qryCode=' + globalSettings.qryCodeEle.val() ); if( strWhere != null ) strParam += ( '&strWhere=' + strWhere ); strParam += ( '&qryTitle=' + globalSettings.qryTitle ); strParam += ( '&show=' + globalSettings.show ); strParam += ( '&qryAllFiled=' + globalSettings.qryAllFiled ); var url = getContextPath() + '/TablePopUp_' + settingIdName + '!queryPopUp?' + strParam; if( globalSettings.debug ) alert( 'in dblclickByPopup() function, url:' + url ); if( !newSettings.doBefore() ) return ; popupTitleSetting( newSettings ); openMediumWindowByUrl( url, true, newSettings.popupTitle ); }; } function getFieldTitle(){ if( globalSettings.debug ) alert( 'in the getFieldTitle, popupName:' + globalSettings.popupName ); var fieldTitle = null; if( globalSettings.popupName == CSACODM_MV_1ByPopup ) fieldTitle = encodeURI( '代碼,代碼意義' ); else if( globalSettings.popupName == WFCODNM_1ByPopup ) fieldTitle = encodeURI( '代碼,代碼意義' ); else if( globalSettings.popupName == WFORGNM_1ByPopup ) fieldTitle = encodeURI( '單位代碼,單位中文名稱' ); else if( globalSettings.popupName == WFUNTNM_1ByPopup ) fieldTitle = encodeURI( '單位代碼,單位中文名稱' ); else if( globalSettings.popupName == NFSSTOM_1ByPopup ) fieldTitle = encodeURI( '免稅商店,廠商名稱' ); else if( globalSettings.popupName == DFSSTOM_1ByPopup ) fieldTitle = encodeURI( '離 島 別,離島免稅購物商店代碼,廠商名稱' ); else if( globalSettings.popupName == DFSCODM_1ByPopup ) fieldTitle = encodeURI( '機關或運輸業者代碼,機關或運輸業者名稱' ); else if( globalSettings.popupName == DFSCODM_2ByPopup ) fieldTitle = encodeURI( '機關或運輸業者代碼,機關或運輸業者名稱' ); else if( globalSettings.popupName == SAAB_APPLICATION_1ByPopup ) fieldTitle = encodeURI( '應用系統代碼,應用系統名稱' ); else if( globalSettings.popupName == SAAB_PRIVILEGE_DATA_1ByPopup || globalSettings.popupName == SAAB_PRIVILEGE_DATA_2ByPopup) fieldTitle = encodeURI( '權限項目代碼,權限項目名稱' ); else if( globalSettings.popupName == SAAB_ORG_DATA_1ByPopup ) fieldTitle = encodeURI( '部門代碼,部門名稱' ); else if( globalSettings.popupName == SAAB_USER_DATA_1ByPopup ) fieldTitle = encodeURI( '使用者帳號,使用者名稱' ); else if( globalSettings.popupName == SCKNDMM_1ByPopup ) fieldTitle = encodeURI( '代碼種類,代碼種類說明,新代碼類別(關港貿)' ); if( fieldTitle == null ) alert( 'Can not find any field title in getFieldTitle() function, when popupName:' + globalSettings.popupName ); return fieldTitle; } function getSettingIdName(){ if( globalSettings.debug ) alert( 'in the getSettingIdName, popupName:' + globalSettings.popupName ); var settingIdName = null; if( globalSettings.popupName == CSACODM_MV_1ByPopup ) settingIdName = 'CSACODM_MV_1'; else if( globalSettings.popupName == WFCODNM_1ByPopup ) settingIdName = 'WFCODNM_1'; else if( globalSettings.popupName == WFORGNM_1ByPopup ) settingIdName = 'WFORGNM_1'; else if( globalSettings.popupName == WFUNTNM_1ByPopup ) settingIdName = 'WFUNTNM_1'; else if( globalSettings.popupName == NFSSTOM_1ByPopup ) settingIdName = 'NFSSTOM_1'; else if( globalSettings.popupName == DFSSTOM_1ByPopup ) settingIdName = 'DFSSTOM_1'; else if( globalSettings.popupName == DFSCODM_1ByPopup ) settingIdName = 'DFSCODM_1'; else if( globalSettings.popupName == DFSCODM_2ByPopup ) settingIdName = 'DFSCODM_2'; else if( globalSettings.popupName == SAAB_APPLICATION_1ByPopup ) settingIdName = 'SAAB_APPLICATION_1'; else if( globalSettings.popupName == SAAB_PRIVILEGE_DATA_1ByPopup ) settingIdName = 'SAAB_PRIVILEGE_DATA_1'; else if( globalSettings.popupName == SAAB_PRIVILEGE_DATA_2ByPopup ) settingIdName = 'SAAB_PRIVILEGE_DATA_2'; else if( globalSettings.popupName == SAAB_ORG_DATA_1ByPopup ) settingIdName = 'SAAB_ORG_DATA_1'; else if( globalSettings.popupName == SAAB_USER_DATA_1ByPopup ) settingIdName = 'SAAB_USER_DATA_1'; else if( globalSettings.popupName == SCKNDMM_1ByPopup ) settingIdName = 'SCKNDMM_1'; if( settingIdName == null) alert( 'Can not find any getSettingIdName in getSettingIdName() function, when popupName:' + globalSettings.popupName ); return settingIdName + '_common'; } function getStrWhere(){ var sqlWhere = null; var strWhereEle = globalSettings.strWhereEle; var popupName = globalSettings.popupName; if( popupName == DFSCODM_2ByPopup ){ sqlWhere = 'D01'; } if( strWhereEle != null ){ if( strWhereEle.length == 0 ) alert( '指定的 strWhereEle selector 不存在 ' ); sqlWhere = strWhereEle.val(); } return sqlWhere; } function popupTitleSetting( newSettings ){ if( globalSettings.popupName == CSACODM_MV_1ByPopup ) newSettings.popupTitle = '代碼資料視窗'; else if( globalSettings.popupName == WFCODNM_1ByPopup ) newSettings.popupTitle = '簡易申辦代碼資料視窗'; else if( globalSettings.popupName == WFORGNM_1ByPopup ) newSettings.popupTitle = '表單組織資料視窗'; else if( globalSettings.popupName == WFUNTNM_1ByPopup ) newSettings.popupTitle = '表單組織資料視窗'; else if( globalSettings.popupName == NFSSTOM_1ByPopup ) newSettings.popupTitle = '國際免稅商店業者視窗'; else if( globalSettings.popupName == DFSSTOM_1ByPopup ) newSettings.popupTitle = '離島免稅購物商店業者視窗'; else if( globalSettings.popupName == DFSCODM_1ByPopup ) newSettings.popupTitle = '機關或運輸業視窗'; else if( globalSettings.popupName == DFSCODM_2ByPopup ) newSettings.popupTitle = '機關或運輸業視窗'; else if( globalSettings.popupName == SAAB_USER_DATA_1ByPopup ) newSettings.popupTitle = '使用者資料速查視窗'; else if( globalSettings.popupName == SAAB_APPLICATION_1ByPopup ) newSettings.popupTitle = '應用系統代碼速查視窗'; else if( globalSettings.popupName == SAAB_PRIVILEGE_DATA_1ByPopup || globalSettings.popupName == SAAB_PRIVILEGE_DATA_2ByPopup) newSettings.popupTitle = '稽核項目速查視窗'; else if( globalSettings.popupName == SAAB_ORG_DATA_1ByPopup ) newSettings.popupTitle = '部門單位查詢視窗'; else if( globalSettings.popupName == SCKNDMM_1ByPopup ) newSettings.popupTitle = '代碼種類檔視窗'; } function popUpCallBack( data ){ if( globalSettings.debug ){ alert( 'in the popUpCallBack, popupName:' + globalSettings.popupName ); if( globalSettings.codeEle != null && globalSettings.codeEle.length != 0 ) alert( 'codeEle:' + globalSettings.codeEle.outerHtml() ); else alert( 'codeEle:' + globalSettings.codeEle ); if( globalSettings.nameEle != null && globalSettings.nameEle.length != 0 ) alert( 'nameEle:' + globalSettings.nameEle.outerHtml() ); else alert( 'nameEle:' + globalSettings.nameEle ); if( globalSettings.storeEle != null && globalSettings.storeEle.length != 0 ) alert( 'storeEle:' + globalSettings.storeEle.outerHtml() ); else alert( 'storeEle:' + globalSettings.storeEle ); alert( 'callback data:' + JSON.stringify( data ) ); } var codeByPopup = null; var storeByPopup = null; var nameByPopup = null; if( globalSettings.popupName == CSACODM_MV_1ByPopup ){ codeByPopup = data.CODE; nameByPopup = data.CODE_CHINESE; } else if( globalSettings.popupName == WFCODNM_1ByPopup ){ codeByPopup = data.CODE; nameByPopup = data.CODE_DESC; } else if( globalSettings.popupName == WFORGNM_1ByPopup ){ codeByPopup = data.DEPT_CODE; nameByPopup = data.DEPT_NAME; } else if( globalSettings.popupName == WFUNTNM_1ByPopup ){ codeByPopup = data.DEPT_CODE; nameByPopup = data.DEPT_NAME; } else if( globalSettings.popupName == NFSSTOM_1ByPopup ){ codeByPopup = data.STORE_CODE; nameByPopup = data.CNAME; } else if( globalSettings.popupName == DFSSTOM_1ByPopup ){ codeByPopup = data.ISLANDS_CODE; storeByPopup = data.STORE_CODE; nameByPopup = data.CNAME; } else if( globalSettings.popupName == DFSCODM_1ByPopup ){ codeByPopup = data.CODE; nameByPopup = data.CODE_DESC; } else if( globalSettings.popupName == DFSCODM_2ByPopup ){ codeByPopup = data.CODE; nameByPopup = data.CODE_DESC; } else if( globalSettings.popupName == SAAB_APPLICATION_1ByPopup ){ codeByPopup = data.APP_ID; nameByPopup = data.C_NAME; } else if( globalSettings.popupName == SAAB_PRIVILEGE_DATA_1ByPopup || globalSettings.popupName == SAAB_PRIVILEGE_DATA_2ByPopup){ codeByPopup = data.PRIVILEGE_ID; nameByPopup = data.C_NAME; } else if( globalSettings.popupName == SAAB_ORG_DATA_1ByPopup ){ codeByPopup = data.ORG_ID; nameByPopup = data.C_NAME; } else if( globalSettings.popupName == SAAB_USER_DATA_1ByPopup ){ codeByPopup = data.USER_ID; nameByPopup = data.USER_NAME; } else if( globalSettings.popupName == SCKNDMM_1ByPopup ){ codeByPopup = data.CODE_KIND; nameByPopup = data.CODE_KIND_NEW; } else alert( 'Can not find any popupName in popUpCallBack() function, when popupName:' + globalSettings.popupName ); if( globalSettings.codeEle != null && globalSettings.codeEle.length != 0 ) globalSettings.codeEle.val( codeByPopup ); if( globalSettings.storeEle != null && globalSettings.storeEle.length != 0 ) globalSettings.storeEle.val( storeByPopup ); if( globalSettings.nameEle != null && globalSettings.nameEle.length != 0 ) globalSettings.nameEle.val( nameByPopup ); if( globalSettings.dynamicCode != null ) $( '#' + getPrefix( globalSettings.id, '_' ) + '_' + globalSettings.dynamicCode ).val( codeByPopup ); if( globalSettings.dynamicName != null ) $( '#' + getPrefix( globalSettings.id, '_' ) + '_' + globalSettings.dynamicName ).val( nameByPopup ); globalSettings.callback( data ); closeWindowByPopup( globalSettings.id ); } function getValueByMainCustCd( custCd ){ if( typeof( custCd ) != 'string' ) alert( 'call getValueByMainCustCd() function, 指定的 custCd 不為 string type' ); if( custCd == null || $.trim( custCd ).length == 0 ) return custCd; if( custCd.toUpperCase() == 'A' ) return '1'; else if( custCd.toUpperCase() == 'B' ) return '2'; else if( custCd.toUpperCase() == 'C' ) return '3'; else if( custCd.toUpperCase() == 'D' ) return '4'; else return ''; } function closeWindowByPopup( id ){ $( '#bClose' ).trigger( 'click' ); } /** * 開啟訊息小視窗( by msg ) * * @param msg 要顯示的訊息 * @param allowedXClosed 是否允許右上角關閉視窗(允許不用此參數) */ function openSmallWindowByMsg( msg, allowedXClosed, popupTitle ){ openWindowByMsg( 's', msg, allowedXClosed, popupTitle ); } /** * 開啟訊息中視窗( by msg ) * * @param msg 要顯示的訊息 * @param allowedXClosed 是否允許右上角關閉視窗(允許不用此參數) */ function openMediumWindowByMsg( msg, allowedXClosed, popupTitle ){ openWindowByMsg( 'm', msg, allowedXClosed, popupTitle ); } /** * 開啟訊息大視窗( by msg ) * * @param msg 要顯示的訊息 * @param allowedXClosed 是否允許右上角關閉視窗(允許不用此參數) */ function openLargeWindowByMsg( msg, allowedXClosed, popupTitle ){ openWindowByMsg( 'l', msg, allowedXClosed, popupTitle ); } /** * 開啟小視窗( by msg ) * * @param url * @param allowedXClosed 是否允許右上角關閉視窗(允許不用此參數) */ function openSmallWindowByUrl( url, allowedXClosed, popupTitle ){ openWindowByUrl( 's', url, allowedXClosed, popupTitle ); } /** * 開啟中視窗( by msg ) * * @param url * @param allowedXClosed 是否允許右上角關閉視窗(允許不用此參數) */ function openMediumWindowByUrl( url, allowedXClosed, popupTitle ){ openWindowByUrl( 'm', url, allowedXClosed, popupTitle ); } /** * 開啟大視窗( by msg ) * * @param url * @param allowedXClosed 是否允許右上角關閉視窗(允許不用此參數) */ function openLargeWindowByUrl( url, allowedXClosed, popupTitle ){ openWindowByUrl( 'l', url, allowedXClosed, popupTitle ); } //======================= 以下為 private ======================= /** * @param imageType * @param msg * @param allowedXClosed 是否允許右上角關閉視窗, undefined 時為 true */ function openWindowByMsg( imageType, msg, allowedXClosed, popupTitle ){ if( allowedXClosed == undefined ) allowedXClosed = true; $( 'body' ).append( getPopupDivByMsg( imageType, msg, allowedXClosed, popupTitle ) ); $( '#commonPopup' ).bPopup({ modalClose : false, onClose : function(){ $( '#commonPopup' ).remove(); }, iframeScroll: 'auto' }); } /** * * @param imageType * @param url * @param allowedXClosed 是否允許右上角關閉視窗, undefined 時為 true */ function openWindowByUrl( imageType, url, allowedXClosed, popupTitle ){ if( allowedXClosed == undefined ) allowedXClosed = true; $( 'body' ).append( getPopupDivByUrl( imageType, allowedXClosed, popupTitle ) ); $( '#commonPopup' ).bPopup( { modalClose : false, content : 'iframe', contentContainer : '#popupContent', loadUrl : url, onClose : function(){ $( '#commonPopup' ).remove(); }, iframeScroll : 'auto' }); var imageInfo = getImageInfo( imageType ); var style = 'position:absolute; top:25px; left:15px; width:' + ( imageInfo.getWidth() - 30 ) + 'px; height:' + ( imageInfo.getHeight() - 42 ) + 'px; border:none;'; $( 'iframe', $( '#commonPopup' ) ).attr( 'style', style ); } /** * * @param imageType * @param msg * @param allowedXClosed true: 含 "X", false: 不含 "X" * @returns */ function getPopupDivByMsg( imageType, msg, allowedXClosed, popupTitle ){ var $div = getPopupDiv( imageType, allowedXClosed, popupTitle ); $div.append( '

' + msg + '

' ); return $div; } /** * * @param imageType * @param allowedXClosed true: 含 "X", false: 不含 "X" * @returns */ function getPopupDivByUrl( imageType, allowedXClosed, popupTitle ){ var $div = getPopupDiv( imageType, allowedXClosed, popupTitle ); $div.append( '
' ); return $div; } /** * 依照 imageType( "s", "m", "l" ) 來取得到 $div, 當 allowedXClosed 為 true 時, 含 close "X", false 時, close "X" 會 hide() * * @param imageType s: 小圖, m: 中圖, l: 大圖 * @param allowedXClosed true: 含 "X", false: 不含 "X" * @returns */ function getPopupDiv( imageType, allowedXClosed, popupTitle ){ var $closeEle = $( getCloseHtml() ); var $titleEle = $( getTitleHtml( popupTitle ) ); var $div = getDiv( imageType ); $div.append( $closeEle ).append( $titleEle ); if( allowedXClosed ) $closeEle.show(); return $div; } /** * 依照 imageType( "s", "m", "l" ) 來取得到 $div * * @param imageType s: 小圖, m: 中圖, l: 大圖 * @returns */ function getDiv( imageType ){ var imageInfo = getImageInfo( imageType ); return $( '' ); } /** * 取得 右上角 X 的 html * @returns {String} */ function getCloseHtml(){ return ''; } /** * 取得 popup title * @returns {String} */ function getTitleHtml( popupTitle ){ return '
' + popupTitle + '
'; } function getImageInfo( imageType ){ var imageInfo = new ImageInfo(); if( imageType == 's' ){ imageInfo.setName( 'bgSmall.png' ); imageInfo.setWidth(242); imageInfo.setHeight(141); } else if( imageType == 'm' ){ imageInfo.setName( 'bgMedium.png' ); imageInfo.setWidth(560); imageInfo.setHeight(380); } else if( imageType == 'l' ){ imageInfo.setName( 'bgLarge.png' ); imageInfo.setWidth(800); imageInfo.setHeight(466); } else{ alert( 'The value of imageType is error, imageType:' + imageType ); return imageInfo; } return imageInfo; } function ImageInfo( name, width, height ){ this.name = name; this.width = width; this.height = height; this.setName = function( name ){ this.name = name; }; this.setWidth = function( width ){ this.width = width; }; this.setHeight = function( height ){ this.height = height; }; this.getName = function(){ return this.name; }; this.getWidth = function(){ return this.width; }; this.getHeight = function(){ return this.height; }; }