Make identity selection work with classic skin.
This commit is contained in:
@@ -3,22 +3,51 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
var $truName = $('.topright .username');
|
|
||||||
if ($truName.length > 0) {
|
|
||||||
$sw = $('#plugin-ident_switch-account');
|
$sw = $('#plugin-ident_switch-account');
|
||||||
if ($sw.length > 0) {
|
isOk = false;
|
||||||
$sw.prependTo('.topright');
|
|
||||||
$truName.hide();
|
switch (rcmail.env['skin']) {
|
||||||
$('#plugin-ident_switch-account').show();
|
case 'larry':
|
||||||
}
|
isOk = plugin_switchIdent_addCbLarry($sw);
|
||||||
|
break;
|
||||||
|
case 'classic':
|
||||||
|
isOk = plugin_switchIdent_addCbClassic($sw);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isOk) {
|
||||||
|
$sw.show();
|
||||||
$("INPUT[name='_ident_switch.form.enabled']").change();
|
$("INPUT[name='_ident_switch.form.enabled']").change();
|
||||||
$("SELECT[name='_ident_switch.form.secure']").change();
|
$("SELECT[name='_ident_switch.form.secure']").change();
|
||||||
|
|
||||||
plugin_switchIdent_processPreconfig();
|
plugin_switchIdent_processPreconfig();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function plugin_switchIdent_addCbLarry($sw) {
|
||||||
|
var $truName = $('.topright .username');
|
||||||
|
if ($truName.length > 0) {
|
||||||
|
if ($sw.length > 0) {
|
||||||
|
$sw.prependTo('.topright');
|
||||||
|
$truName.hide();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function plugin_switchIdent_addCbClassic($sw) {
|
||||||
|
var $taskBar = $('#taskbar');
|
||||||
|
if ($taskBar.length > 0) {
|
||||||
|
$taskBar.prepend($sw);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function plugin_switchIdent_processPreconfig() {
|
function plugin_switchIdent_processPreconfig() {
|
||||||
var disFld = $("INPUT[name='_ident_switch.form.readonly']");
|
var disFld = $("INPUT[name='_ident_switch.form.readonly']");
|
||||||
disFld.parentsUntil("TABLE", "TR").hide();
|
disFld.parentsUntil("TABLE", "TR").hide();
|
||||||
|
|||||||
8
ident_switch.min.js
vendored
8
ident_switch.min.js
vendored
@@ -1,5 +1,9 @@
|
|||||||
$(function(){var $truName=$('.topright .username');if($truName.length>0){$sw=$('#plugin-ident_switch-account');if($sw.length>0){$sw.prependTo('.topright');$truName.hide();$('#plugin-ident_switch-account').show();}}
|
$(function(){$sw=$('#plugin-ident_switch-account');isOk=false;switch(rcmail.env['skin']){case'larry':isOk=plugin_switchIdent_addCbLarry($sw);break;case'classic':isOk=plugin_switchIdent_addCbClassic($sw);break;}
|
||||||
$("INPUT[name='_ident_switch.form.enabled']").change();$("SELECT[name='_ident_switch.form.secure']").change();plugin_switchIdent_processPreconfig();});function plugin_switchIdent_processPreconfig(){var disFld=$("INPUT[name='_ident_switch.form.readonly']");disFld.parentsUntil("TABLE","TR").hide();var disVal=disFld.val();if(disVal>0){$("INPUT[name='_ident_switch.form.host']").prop("disabled",true);$("SELECT[name='_ident_switch.form.secure']").prop("disabled",true);$("INPUT[name='_ident_switch.form.port']").prop("disabled",true);}
|
if(isOk){$sw.show();$("INPUT[name='_ident_switch.form.enabled']").change();$("SELECT[name='_ident_switch.form.secure']").change();plugin_switchIdent_processPreconfig();}});function plugin_switchIdent_addCbLarry($sw){var $truName=$('.topright .username');if($truName.length>0){if($sw.length>0){$sw.prependTo('.topright');$truName.hide();return true;}}
|
||||||
|
return false;}
|
||||||
|
function plugin_switchIdent_addCbClassic($sw){var $taskBar=$('#taskbar');if($taskBar.length>0){$taskBar.prepend($sw);return true;}
|
||||||
|
return false;}
|
||||||
|
function plugin_switchIdent_processPreconfig(){var disFld=$("INPUT[name='_ident_switch.form.readonly']");disFld.parentsUntil("TABLE","TR").hide();var disVal=disFld.val();if(disVal>0){$("INPUT[name='_ident_switch.form.host']").prop("disabled",true);$("SELECT[name='_ident_switch.form.secure']").prop("disabled",true);$("INPUT[name='_ident_switch.form.port']").prop("disabled",true);}
|
||||||
if(2==disVal){$("INPUT[name='_ident_switch.form.username']").prop("disabled",true);}}
|
if(2==disVal){$("INPUT[name='_ident_switch.form.username']").prop("disabled",true);}}
|
||||||
function plugin_switchIdent_enabled_onChange(e){var $enFld=$("INPUT[name='_ident_switch.form.enabled']");$("INPUT[name!='_ident_switch.form.enabled'], SELECT",$enFld.parents("FIELDSET")).prop("disabled",!$enFld.is(":checked"));plugin_switchIdent_processPreconfig();}
|
function plugin_switchIdent_enabled_onChange(e){var $enFld=$("INPUT[name='_ident_switch.form.enabled']");$("INPUT[name!='_ident_switch.form.enabled'], SELECT",$enFld.parents("FIELDSET")).prop("disabled",!$enFld.is(":checked"));plugin_switchIdent_processPreconfig();}
|
||||||
function plugin_switchIdent_secure_onChange(e){var $secSel=$("SELECT[name='_ident_switch.form.secure']");var $portFld=$("INPUT[name='_ident_switch.form.port']");if('SSL'===$secSel.val().toUpperCase())
|
function plugin_switchIdent_secure_onChange(e){var $secSel=$("SELECT[name='_ident_switch.form.secure']");var $portFld=$("INPUT[name='_ident_switch.form.port']");if('SSL'===$secSel.val().toUpperCase())
|
||||||
|
|||||||
Reference in New Issue
Block a user