Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
More JS modules async loading to avoid loading scripts when they are …
Browse files Browse the repository at this point in the history
…not necessary
  • Loading branch information
cdujeu committed May 1, 2015
1 parent aef8014 commit f85c55f
Show file tree
Hide file tree
Showing 30 changed files with 875 additions and 496 deletions.
4 changes: 2 additions & 2 deletions core/src/plugins/access.ajxp_user/manifest.xml
Expand Up @@ -4,8 +4,8 @@
<resources>
<i18n namespace="user_dash" path="plugins/access.ajxp_user/i18n" />
<css file="plugins/editor.ajxp_role/rolesEditor.css" />
<js className="UserProfileEditor" file="plugins/access.ajxp_user/class.UserProfileEditor.js" autoload="true"/>
<js className="WebDAVprefsEditor" file="plugins/access.ajxp_user/class.WebDAVprefsEditor.js" autoload="true"/>
<js className="UserProfileEditor" file="plugins/access.ajxp_user/class.UserProfileEditor.js"/>
<js className="WebDAVprefsEditor" file="plugins/access.ajxp_user/class.WebDAVprefsEditor.js"/>
<css file="plugins/access.ajxp_user/dashboard.css"/>
</resources>
<node_provider ajxpClass="EmptyNodeProvider" ajxpOptions="{}"/>
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/action.cart/class.CartManager.js
Expand Up @@ -284,6 +284,6 @@ Class.create("CartManager", FetchedResultPane, {

if(window.ajxpMinisite){
document.observe("ajaxplorer:actions_loaded", function(){
pydio.getController().actions.unset("send-selection-to-cart");
pydio.getController().actions.delete("send-selection-to-cart");
});
}
2 changes: 1 addition & 1 deletion core/src/plugins/action.cart/manifest.xml
Expand Up @@ -8,7 +8,7 @@

<client_settings>
<resources>
<js className="CartManager" file="plugins/action.cart/class.CartManager.js" autoload="true"/>
<js className="CartManager" file="plugins/action.cart/class.CartManager.js"/>
<js className="LocalCartNodeProvider" file="plugins/action.cart/class.LocalCartNodeProvider.js" autoload="true"/>
<i18n namespace="action.cart" path="plugins/action.cart/i18n"/>
</resources>
Expand Down
32 changes: 18 additions & 14 deletions core/src/plugins/action.share/class.ShareCenter.js
Expand Up @@ -1206,20 +1206,22 @@ Class.create("ShareCenter", {
if(dialogButtonsOrRow.down('.share_qrcode') && dialogButtonsOrRow.down('.share_qrcode').visible() && dialogButtonsOrRow.down('.share_qrcode > img')){
message += "\n\n "+ MessageHash["share_center.108"] + "\n\n" + dialogButtonsOrRow.down('.share_qrcode').innerHTML;
}
var mailer = new AjxpMailer();
var usersList = null;
if(this.shareFolderMode == 'workspace' && oForm) {
usersList = oForm.down(".editable_users_list");
}
modal.showSimpleModal(
mailerShower,
mailer.buildMailPane(MessageHash["share_center.44"].replace("%s", ajaxplorer.appTitle), message, usersList, MessageHash["share_center.45"], link),
function(){
mailer.postEmail();
return true;
},function(){
return true;
});
ResourcesManager.detectModuleToLoadAndApply('AjxpMailer', function(){
var mailer = new AjxpMailer();
modal.showSimpleModal(
mailerShower,
mailer.buildMailPane(MessageHash["share_center.44"].replace("%s", ajaxplorer.appTitle), message, usersList, MessageHash["share_center.45"], link),
function(){
mailer.postEmail();
return true;
},function(){
return true;
});
});
}.bind(this));
}else{
var subject = encodeURIComponent(MessageHash["share_center.44"].replace("%s", ajaxplorer.appTitle));
Expand Down Expand Up @@ -1269,11 +1271,13 @@ Class.create("ShareCenter", {
}else{
url = this._currentRepositoryLink;
}
var qrcode = new QRCode(randId, {
width: 128,
height: 128
ResourcesManager.detectModuleToLoadAndApply('QRCode', function(){
var qrcode = new QRCode(randId, {
width: 128,
height: 128
});
qrcode.makeCode(url);
});
qrcode.makeCode(url);
}
if(qrcodediv.visible()) qrcodediv.hide();
else qrcodediv.show();
Expand Down
56 changes: 40 additions & 16 deletions core/src/plugins/action.share/manifest.xml
Expand Up @@ -31,8 +31,8 @@
<client_settings>
<resources>
<i18n namespace="share_center" path="plugins/action.share/res/i18n"/>
<js file="plugins/action.share/qrcode.js" className="QRCode" autoload="true"/>
<js file="plugins/action.share/class.ShareCenter.js" className="ShareCenter" autoload="true"/>
<js file="plugins/action.share/qrcode.js" className="QRCode" autoload="false"/>
<js file="plugins/action.share/class.ShareCenter.js" className="ShareCenter" autoload="false"/>
</resources>
</client_settings>
<registry_contributions>
Expand All @@ -45,8 +45,12 @@
<rightsContext noUser="true" userLogged="only" read="true" write="false" adminOnly=""/>
<processing>
<clientCallback prepareModal="true"><![CDATA[
if(!pydio.getController().shareCenter) pydio.getController().shareCenter = new ShareCenter();
pydio.getController().shareCenter.performShareAction();
ResourcesManager.detectModuleToLoadAndApply('ShareCenter', function(){
if(!pydio.getController().shareCenter) {
pydio.getController().shareCenter = new ShareCenter();
}
pydio.getController().shareCenter.performShareAction();
});
]]></clientCallback>
<clientForm id="share_form"><![CDATA[
<div id="share_form" box_width="420" action="share">
Expand Down Expand Up @@ -271,8 +275,12 @@
</gui>
<processing>
<clientCallback prepareModal="true"><![CDATA[
if(!pydio.getController().shareCenter) pydio.getController().shareCenter = new ShareCenter();
pydio.getController().shareCenter.performShareAction();
ResourcesManager.detectModuleToLoadAndApply('ShareCenter', function(){
if(!pydio.getController().shareCenter) {
pydio.getController().shareCenter = new ShareCenter();
}
pydio.getController().shareCenter.performShareAction();
});
]]></clientCallback>
</processing>
</action>
Expand All @@ -283,8 +291,12 @@
</gui>
<processing>
<clientCallback prepareModal="true"><![CDATA[
if(!pydio.getController().shareCenter) pydio.getController().shareCenter = new ShareCenter();
pydio.getController().shareCenter.performShare('minisite-public');
ResourcesManager.detectModuleToLoadAndApply('ShareCenter', function(){
if(!pydio.getController().shareCenter) {
pydio.getController().shareCenter = new ShareCenter();
}
pydio.getController().shareCenter.performShare('minisite-public');
});
]]></clientCallback>
</processing>
</action>
Expand All @@ -295,8 +307,12 @@
</gui>
<processing>
<clientCallback prepareModal="true"><![CDATA[
if(!pydio.getController().shareCenter) pydio.getController().shareCenter = new ShareCenter();
pydio.getController().shareCenter.performShare('minisite-public');
ResourcesManager.detectModuleToLoadAndApply('ShareCenter', function(){
if(!pydio.getController().shareCenter) {
pydio.getController().shareCenter = new ShareCenter();
}
pydio.getController().shareCenter.performShare('minisite-public');
});
]]></clientCallback>
</processing>
</action>
Expand All @@ -307,8 +323,12 @@
</gui>
<processing>
<clientCallback prepareModal="true"><![CDATA[
if(!pydio.getController().shareCenter) pydio.getController().shareCenter = new ShareCenter();
pydio.getController().shareCenter.performShare('minisite-public');
ResourcesManager.detectModuleToLoadAndApply('ShareCenter', function(){
if(!pydio.getController().shareCenter) {
pydio.getController().shareCenter = new ShareCenter();
}
pydio.getController().shareCenter.performShare('minisite-public');
});
]]></clientCallback>
</processing>
</action>
Expand Down Expand Up @@ -369,10 +389,14 @@
</gui>
<processing>
<clientCallback prepareModal="true"><![CDATA[
if(!pydio.getController().shareCenter) pydio.getController().shareCenter = new ShareCenter();
if(window.actionManager){
pydio.getController().shareCenter.performShareAction(window.actionManager.getDataModel());
}
ResourcesManager.detectModuleToLoadAndApply('ShareCenter', function(){
if(!pydio.getController().shareCenter) {
pydio.getController().shareCenter = new ShareCenter();
}
if(window.actionManager){
pydio.getController().shareCenter.performShareAction(window.actionManager.getDataModel());
}
});
]]></clientCallback>
</processing>
</action>
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/authfront.keystore/manifest.xml
Expand Up @@ -5,7 +5,7 @@
<client_settings>
<resources>
<i18n namespace="authfront.keystore" path="plugins/authfront.keystore/i18n"/>
<js className="ApikeysPane" file="plugins/authfront.keystore/class.ApikeysPane.js" autoload="true"/>
<js className="ApikeysPane" file="plugins/authfront.keystore/class.ApikeysPane.js"/>
<i18n namespace="keystore" path="plugins/authfront.keystore/i18n"/>
<css file="plugins/authfront.keystore/apikeypane.css" autoload="true"/>
</resources>
Expand Down
3 changes: 0 additions & 3 deletions core/src/plugins/core.mailer/manifest.xml
Expand Up @@ -22,9 +22,6 @@
<action name="send_mail">
<rightsContext adminOnly="false" noUser="false" read="false" userLogged="only" write="false"/>
<processing>
<clientListener name="contextChange"><![CDATA[
if(!window.AjxpMailer && ajaxplorer.user) ResourcesManager.prototype.loadJSResource('plugins/core.mailer/class.AjxpMailer.js', 'AjxpMailer');
]]></clientListener>
<serverCallback methodName="sendMailAction" restParams="/" developerComment="Trigger an email to a user or external email, sent by currently logged user">
<input_param name="from" type="string" description="From email"/>
<input_param name="emails" type="string" description="A list of emails or user names"/>
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.notifications/manifest.xml
Expand Up @@ -11,6 +11,7 @@
<i18n namespace="notification_center" path="plugins/core.notifications/res/i18n"/>
<css file="plugins/core.notifications/res/css/notification_center.css" autoload="true"/>
<img_library alias="notification_center" path="plugins/core.notifications/res/img"/>
<js className="NotificationLoader" file="plugins/core.notifications/class.NotificationLoader.js"/>
</resources>
</client_settings>
<server_settings>
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/editor.eml/manifest.xml
Expand Up @@ -3,7 +3,7 @@
<class_definition filename="plugins/editor.eml/class.EmlParser.php" classname="EmlParser"/>
<client_settings>
<resources>
<js file="plugins/editor.eml/class.EmlViewer.js" className="EmlViewer" autoload="true"/>
<js file="plugins/editor.eml/class.EmlViewer.js" className="EmlViewer"/>
<css file="plugins/editor.eml/emlViewer.css"/>
<img_library alias="eml_images" path="plugins/editor.eml/img"/>
<i18n namespace="editor.eml" path="plugins/editor.eml/i18n" />
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/editor.etherpad/manifest.xml
Expand Up @@ -5,7 +5,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd">
<client_settings>
<resources>
<js file="plugins/editor.etherpad/class.EtherpadLauncher.js" className="EtherpadLauncher" autoload="true"/>
<js file="plugins/editor.etherpad/class.EtherpadLauncher.js" className="EtherpadLauncher"/>
<i18n path="plugins/editor.etherpad/i18n" namespace="etherpad"/>
<img_library alias="etherpad" path="plugins/editor.etherpad"/>
</resources>
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/editor.webodf/manifest.xml
Expand Up @@ -5,7 +5,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd">
<client_settings>
<resources>
<js file="plugins/editor.webodf/class.WebodfEditor.js" className="WebodfEditor" autoload="true"/>
<js file="plugins/editor.webodf/class.WebodfEditor.js" className="WebodfEditor"/>
<i18n path="plugins/editor.webodf/i18n" namespace="webodf"/>
</resources>
</client_settings>
Expand Down

0 comments on commit f85c55f

Please sign in to comment.