From cfcf2f8c57ffbdb7fe24a5ea5111ae6ccfecfc66 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Mon, 12 Nov 2018 13:43:10 +0100 Subject: [PATCH] Packaging fixes --- gulpfile.js | 8 +++++++- js/app.min.js | 2 +- templates/main.php | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 3767904..d4892ba 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,9 +1,15 @@ let gulp = require("gulp"); +let concat = require('gulp-concat'); let rename = require("gulp-rename"); let uglify = require('gulp-uglify-es').default; gulp.task("uglify", function () { - return gulp.src("js/devel/*.js") + return gulp.src("js/devel/app.js") + .pipe(concat('js/devel/settings.js')) + .pipe(concat('js/devel/contactlist.js')) + .pipe(concat('js/devel/conversation.js')) + .pipe(concat('js/devel/helpers.js')) + .pipe(concat('js/devel/notifications.js')) .pipe(rename("app.min.js")) .pipe(uglify(/* options */)) .pipe(gulp.dest("js/")); diff --git a/js/app.min.js b/js/app.min.js index 4adaf96..f8cd446 100644 --- a/js/app.min.js +++ b/js/app.min.js @@ -1 +1 @@ -var SmsSettings=new Vue({el:"#app-settings",data:{messageLimit:100,enableNotifications:!0,contactOrderBy:"lastmsg",reverseContactOrder:!0,country:""},created:function(){var t=this;$.getJSON(Sms.generateURL("/front-api/v1/settings"),function(e,n){!0===e.status&&(t.messageLimit=parseInt(e.message_limit),t.enableNotifications=0!==parseInt(e.notification_state)?1:0,t.contactOrderBy=e.contact_order,t.reverseContactOrder=toBool(e.contact_order_reverse),t.country=e.country)})},methods:{sendMessageLimit:function(){if(null!==this.messageLimit){$.post(Sms.generateURL("/set/msglimit"),{limit:this.messageLimit})}},sendNotificationFlag:function(){$.post(Sms.generateURL("/set/notification_state"),{notification:parseInt(this.enableNotifications)})},sendContactOrder:function(){$.post(Sms.generateURL("/set/contact_order"),{attribute:this.contactOrderBy,reverse:this.reverseContactOrder})},sendCountry:function(){$.post(Sms.generateURL("/set/country"),{country:this.country})},wipeAllMessages:function(){$.post(Sms.generateURL("/front-api/v1/delete/all"),{},function(){ContactList.reset(),Conversation.clear()})},isContactListEmpty:function(){return 0===ContactList.contacts.length}}}); \ No newline at end of file +var Sms={selectedConversation:null,unreadCountCurrentConv:0,unreadCountNotifStep:12,lastContactListMsgDate:0,originalTitle:document.title,photoVersion:1,_winRegexp:/(.*)\/ocsms.*/,generateURL:function(e){var t=this._winRegexp.exec(window.location.href);return 2!==t.length&&console.log("A very bad error happened when parsing window location"),t[1]+"/ocsms"+e},selectConversation:function(e){"undefined"!==e&&null!=e&&(null!=this.selectedConversation&&this.selectedConversation.parent().removeClass("selected"),this.selectedConversation=e,this.selectedConversation.parent().addClass("selected"),this.selectedConversation.css("font-weight","normal"),this.selectedConversation.html(this.selectedConversation.attr("mailbox-label")))}},ContactRenderer={generateColor:function(e){if(void 0===e)return"";if("function"==typeof e.toHsl){var t=e.toHsl();return"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)"}var n=md5(e).substring(0,4),o=parseInt("ffff",16);return"hsl("+parseInt(n,16)/o*256+", 90%, 65%)"},generateFirstCharacter:function(e){return"string"!=typeof e?"?":"+"===e.charAt(0)?"#":e.charAt(0)}};$.urlParam=function(e){var t=new RegExp("[?&]"+e+"=([^&#]*)").exec(window.location.href);return null==t?null:t[1]||0},Vue.filter("firstCharacter",ContactRenderer.generateFirstCharacter);const Dialog=Vue.extend({template:"#modal-template"});Vue.directive("confirm",{bind(e,t,n){const o=t.value[1],r=t.value[0];e.handleClick=(e=>{const t={doYes:function(){o(),t.show=!1},show:!0,bodyMessage:r};let n=new Dialog({data:t}).$mount();document.getElementById("app").appendChild(n.$el)}),e.addEventListener("click",e.handleClick)},unbind(e){e.removeEventListener("click",e.handleClick)}}),jQuery,OC,window.onfocus=function(){Sms.unreadCountCurrentConv=0,document.title=Sms.originalTitle}; \ No newline at end of file diff --git a/templates/main.php b/templates/main.php index 17b8042..847401a 100644 --- a/templates/main.php +++ b/templates/main.php @@ -12,7 +12,7 @@ use \OCA\OcSms\Lib\CountryCodes; //\OCP\Util::addScript('ocsms', 'devel/conversation'); //\OCP\Util::addScript('ocsms', 'devel/helpers'); //\OCP\Util::addScript('ocsms', 'devel/notifications'); -//\OCP\Util::addStyle('ocsms', 'style'); +\OCP\Util::addStyle('ocsms', 'style'); ?>