📄 acp_perms.js
字号:
}/*-------------------------------------------------------------------------*/// Save main bit/*-------------------------------------------------------------------------*/function bbedit_acpperms_save_mainbit() {}acpperms.prototype.save_mainbit = function( result ){ //---------------------------------- // If it's the first screen loaded // after clicking the tab, the this.perm_child // won't have any info.. so grab it from the HTML //---------------------------------- this.perm_child = document.getElementById('perms-perm-child-id').value; /*--------------------------------------------*/ // Main function to do on request // Must be defined first!! Chill /*--------------------------------------------*/ _this = this; this.do_request_function = function() { //---------------------------------- // Ignore unless we're ready to go //---------------------------------- if ( ! _this.xmlobj.readystate_ready_and_ok() ) { _this.show_loading( 'Saving...' ); return; } _this.hide_loading(); //---------------------------------- // INIT //---------------------------------- var html = _this.xmlobj.xmlhandler.responseText; _this.div_content.innerHTML = html; //---------------------------------- // INIT tabs //---------------------------------- _this.init_tabs(); } this.xmlobj = new ajax_request(); this.xmlobj.onreadystatechange( this.do_request_function ); //---------------------------------- // LOAD XML //---------------------------------- this.xmlobj.process( ipb_var_base_url + '&' + this.form_code + '&code=acpperms-xml-save-mainbit&member_id=' + this.member_id + '&perm_child=' + this.perm_child + '&perm_main=' + this.perm_main + '&result=' + result );}/*-------------------------------------------------------------------------*/// Save main tab/*-------------------------------------------------------------------------*/function bbedit_acpperms_save_tab() {}acpperms.prototype.save_tab = function( perm_main, member_id, result ){ //---------------------------------- // INIT //---------------------------------- this.member_id = member_id; //---------------------------------- // Sync... //---------------------------------- this.perm_main = perm_main; tab = this.perm_main; /*--------------------------------------------*/ // Main function to do on request // Must be defined first!! Chill /*--------------------------------------------*/ _this = this; this.do_request_function = function() { //---------------------------------- // Ignore unless we're ready to go //---------------------------------- if ( ! _this.xmlobj.readystate_ready_and_ok() ) { _this.show_loading( '正在保存...' ); return; } _this.hide_loading(); //---------------------------------- // INIT //---------------------------------- var html = _this.xmlobj.xmlhandler.responseText; _this.div_content.innerHTML = html; //---------------------------------- // INIT tabs //---------------------------------- _this.init_tabs(); } this.xmlobj = new ajax_request(); this.xmlobj.onreadystatechange( this.do_request_function ); //---------------------------------- // LOAD XML //---------------------------------- this.xmlobj.process( ipb_var_base_url + '&' + this.form_code + '&code=acpperms-xml-save-tabs&member_id=' + this.member_id + '&perm_main=' + this.perm_main + '&result=' + result );}/*-------------------------------------------------------------------------*/// Loads and inits display/*-------------------------------------------------------------------------*/function bbedit_acpperms_init() {}acpperms.prototype.init = function( tab, member_id, perm_child ){ //---------------------------------- // BEFORE WE GO, CHECK FOR SAVE // We need to do this now before // we reset this.* vars //---------------------------------- if ( this.member_id && this.perm_main ) { this.save_bits( 0 ); } //---------------------------------- // INIT //---------------------------------- this.member_id = member_id; perm_child = typeof(perm_child) == "undefined" ? "" : perm_child; //---------------------------------- // Sync... //---------------------------------- this.perm_main = tab; this.perm_child = perm_child; //---------------------------------- // Close menu? //---------------------------------- try { menu_action_close(); } catch(e) { } /*--------------------------------------------*/ // Main function to do on request // Must be defined first!! Chill /*--------------------------------------------*/ _this = this; this.do_request_function = function() { //---------------------------------- // Ignore unless we're ready to go //---------------------------------- if ( ! _this.xmlobj.readystate_ready_and_ok() ) { _this.show_loading( '正在加载...' ); return; } _this.hide_loading(); //---------------------------------- // INIT //---------------------------------- var html = _this.xmlobj.xmlhandler.responseText; //---------------------------------- // Stop IE showing select boxes over // floating div [ 1 ] //---------------------------------- if ( is_ie ) { html = "<iframe id='perm-shim' src='javascript:;' class='iframshim' scrolling='no' frameborder='0' style='position:absolute; top:0px; left:0px; display:none;'></iframe>" + html; } _this.div_content.innerHTML = html; //---------------------------------- // Stop IE showing select boxes over // floating div [ 2 ] //---------------------------------- if ( is_ie ) { perm_shim = document.getElementById('perm-shim'); perm_shim.style.width = _this.div_content.offsetWidth; perm_shim.style.height = _this.div_content.offsetHeight; perm_shim.style.zIndex = _this.div_content.style.zIndex - 1; perm_shim.style.top = _this.div_content.style.top; perm_shim.style.left = _this.div_content.style.left; perm_shim.style.display = "block"; } //---------------------------------- // INIT tabs //---------------------------------- _this.init_tabs(); } this.xmlobj = new ajax_request(); this.xmlobj.onreadystatechange( this.do_request_function ); //---------------------------------- // LOAD XML //---------------------------------- if ( ! tab ) { this.xmlobj.process( ipb_var_base_url + '&' + this.form_code + '&code=acpperms-xml-display&member_id=' + this.member_id + '&perm_child=' + perm_child ); } else { this.xmlobj.process( ipb_var_base_url + '&' + this.form_code + '&code=acpperms-xml-display&member_id=' + this.member_id + '&perm_child=' + perm_child + '&tab=' + tab ); } this.div_wrapper.style.position = 'absolute'; this.div_wrapper.style.display = 'block'; this.div_wrapper.style.zIndex = 99; //---------------------------------- // Not loaded? INIT //---------------------------------- if ( ! this.initialized ) { this.initialized = 1; //---------------------------------- // Figure width and height //---------------------------------- var my_width = 0; var my_height = 0; if ( typeof( window.innerWidth ) == 'number' ) { //---------------------------------- // Non IE //---------------------------------- my_width = window.innerWidth; my_height = window.innerHeight; } else if ( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //---------------------------------- // IE 6+ //---------------------------------- my_width = document.documentElement.clientWidth; my_height = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //---------------------------------- // Old IE //---------------------------------- my_width = document.body.clientWidth; my_height = document.body.clientHeight; } //---------------------------------- // Get div height && width //---------------------------------- var divheight = parseInt( this.div_wrapper.style.Height ); var divwidth = parseInt( this.div_wrapper.style.Width ); divheight = divheight ? divheight : 400; divwidth = divwidth ? divwidth : 400; //---------------------------------- // Got it stored in a cookie? //---------------------------------- var divxy = my_getcookie( 'ipb-perms-div' ); var co_ords; if ( divxy && divxy != null ) { co_ords = divxy.split( ',' ); //---------------------------------- // Got co-ords? //---------------------------------- if ( co_ords.length ) { var final_width = co_ords[0]; var final_height = co_ords[1]; if ( co_ords[0] > my_width ) { //---------------------------------- // Keep it on screen //---------------------------------- final_width = my_width - divwidth; } if ( co_ords[1] > my_height ) { //---------------------------------- // Keep it on screen //---------------------------------- final_height = my_height - divheight; } this.div_wrapper.style.left = final_width + 'px'; this.div_wrapper.style.top = final_height + 'px'; } } else { //---------------------------------- // Reposition DIV roughly centered //---------------------------------- this.div_wrapper.style.left = my_width / 2 - (divwidth / 2) + 'px'; this.div_wrapper.style.top = my_height / 2 - (divheight / 2 ) + 'px'; } Drag.cookiename = 'ipb-perms-div'; Drag.init( this.div_drag, this.div_wrapper ); }}/*-------------------------------------------------------------------------*/// Show message/*-------------------------------------------------------------------------*/acpperms.prototype.show_loading = function( status_msg ){ if ( ! this.loading_fired ) { this.loading_fired = 1; this.div_status_msg.innerHTML = '<div style="width:auto" class="input-warn-content"><strong>' + status_msg + '</strong></strong>'; } return;}/*--------------------------------------------*/// Hide message/*--------------------------------------------*/acpperms.prototype.hide_loading = function(){ this.div_status_msg.innerHTML = '<div style="width:auto" class="input-ok-content">就绪</span>'; this.loading_fired = 0; return;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -