|
|
@ -1,5 +1,5 @@ |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Singleton class to handle the global unread counter. |
|
|
|
* Singleton class to handle the custom icons for special services. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
Ext.define('Rambox.util.IconLoader', { |
|
|
|
Ext.define('Rambox.util.IconLoader', { |
|
|
|
|
|
|
|
|
|
|
@ -12,20 +12,25 @@ Ext.define('Rambox.util.IconLoader', { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Sets the icon for a specific service. |
|
|
|
* Sets the icon for a specific service. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param {*} id Id of the service |
|
|
|
* @param {*} service Id of the service |
|
|
|
|
|
|
|
* @param {*} webview Webview component of the service |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
this.loadServiceIconUrl = function (service, webview) { |
|
|
|
this.loadServiceIconUrl = function (service, webview) { |
|
|
|
switch (service.type) { |
|
|
|
switch (service.type) { |
|
|
|
case 'slack': |
|
|
|
case 'slack': |
|
|
|
webview.executeJavaScript("(()=>{let a=document.querySelector('.team_icon');if(!a){const d=document.querySelector('#team_menu');d&&(d.click(),a=document.querySelector('.team_icon'))}if(!a)return!1;const{style:{backgroundImage:b}}=a,c=document.createEvent('MouseEvents');return c.initEvent('mousedown',!0,!0),document.querySelector('.client_channels_list_container').dispatchEvent(c),b.slice(5,-2)})();", |
|
|
|
webview.executeJavaScript( |
|
|
|
|
|
|
|
"(()=>{let a=document.querySelector('.team_icon');if(!a){const d=document.querySelector('#team_menu');d&&(d.click(),a=document.querySelector('.team_icon'))}if(!a)return!1;const{style:{backgroundImage:b}}=a,c=document.createEvent('MouseEvents');return c.initEvent('mousedown',!0,!0),document.querySelector('.client_channels_list_container').dispatchEvent(c),b.slice(5,-2)})();", |
|
|
|
false, |
|
|
|
false, |
|
|
|
function (backgroundImage) { |
|
|
|
function (backgroundImage) { |
|
|
|
if (backgroundImage) { |
|
|
|
if (backgroundImage) { |
|
|
|
|
|
|
|
service.setTitle('<img src="'+service.icon+'" width="" style="background-color: white;border-radius: 50%;position: absolute;margin-left: -12px;margin-top: 17px;width: 12px;">'+service.title); |
|
|
|
service.fireEvent('iconchange', service, backgroundImage, service.icon); |
|
|
|
service.fireEvent('iconchange', service, backgroundImage, service.icon); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
); |
|
|
|
); |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|