diff --git a/build/mergejs.php b/build/mergejs.php deleted file mode 100644 index e747337ef6..0000000000 --- a/build/mergejs.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * @author Roeland Jago Douma - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ - - -/* - * Stupid simple code to merge all the default vendor javascript into 1 - */ -$data = json_decode(file_get_contents(__DIR__.'/../core/js/core.json'), true); -$vendors = $data['vendor']; - -$vendorjs = fopen(__DIR__.'/../core/vendor/core.js', 'w'); -foreach($vendors as $vendor) { - $content = file_get_contents(__DIR__.'/../core/vendor/'.$vendor); - // Remove the sourceMappingURL references from the merged file - $content = preg_replace('@//# sourceMappingURL=.*$@', '', $content); - fwrite($vendorjs, $content); - fwrite($vendorjs, PHP_EOL); -} -fclose($vendorjs); diff --git a/build/mergejschecker.sh b/build/mergejschecker.sh deleted file mode 100755 index aee2629956..0000000000 --- a/build/mergejschecker.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash - -#Regenerate the vendors core.js -echo -echo "Regenerating core/vendor/core.js" - -d=`dirname $(readlink -f $0)` - -php $d/mergejs.php - -files=`git diff --name-only` - -for file in $files -do - if [[ $file == core/vendor/core.js ]] - then - echo "The merged vendor file is not up to date" - echo "Please run: php build/mergejs.php" - echo "And commit the result" - break - fi -done - -echo "Vendor js merged as expected. Carry on" -exit 0 diff --git a/core/js/core.json b/core/js/core.json index bb8696754b..7967dc2a91 100644 --- a/core/js/core.json +++ b/core/js/core.json @@ -1,7 +1,4 @@ { - "vendor": [ - "css-vars-ponyfill/dist/css-vars-ponyfill.min.js" - ], "libraries": [ "jquery-showpassword.js", "jquery.avatar.js", diff --git a/core/vendor/core.js b/core/vendor/core.js deleted file mode 100644 index 6935031f3a..0000000000 --- a/core/vendor/core.js +++ /dev/null @@ -1,10 +0,0 @@ -/*! - * css-vars-ponyfill - * v1.7.2 - * https://github.com/jhildenbiddle/css-vars-ponyfill - * (c) 2018 John Hildenbiddle - * MIT license - */ -!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.cssVars=n()}(this,function(){"use strict";function e(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={mimeType:n.mimeType||null,onBeforeSend:n.onBeforeSend||Function.prototype,onSuccess:n.onSuccess||Function.prototype,onError:n.onError||Function.prototype,onComplete:n.onComplete||Function.prototype},t=Array.isArray(e)?e:[e],o=Array.apply(null,Array(t.length)).map(function(e){return null});function s(e,n){r.onError(e,t[n],n)}function a(e,n){var s=r.onSuccess(e,t[n],n);e=!1===s?"":s||e,o[n]=e,-1===o.indexOf(null)&&r.onComplete(o)}t.forEach(function(e,n){var t=document.createElement("a");t.setAttribute("href",e),t.href=t.href;var o=t.host!==location.host,i=t.protocol===location.protocol;if(o&&"undefined"!=typeof XDomainRequest)if(i){var u=new XDomainRequest;u.open("GET",e),u.timeout=0,u.onprogress=Function.prototype,u.ontimeout=Function.prototype,u.onload=function(){a(u.responseText,n)},u.onerror=function(e){s(u,n)},setTimeout(function(){u.send()},0)}else console.log("Internet Explorer 9 Cross-Origin (CORS) requests must use the same protocol"),s(null,n);else{var c=new XMLHttpRequest;c.open("GET",e),r.mimeType&&c.overrideMimeType&&c.overrideMimeType(r.mimeType),r.onBeforeSend(c,e,n),c.onreadystatechange=function(){4===c.readyState&&(200===c.status?a(c.responseText,n):s(c,n))},c.send()}})}function n(n){var t={cssComments:/\/\*[\s\S]+?\*\//g,cssImports:/(?:@import\s*)(?:url\(\s*)?(?:['"])([^'"]*)(?:['"])(?:\s*\))?(?:[^;]*;)/g},o={include:n.include||'style,link[rel="stylesheet"]',exclude:n.exclude||null,filter:n.filter||null,onBeforeSend:n.onBeforeSend||Function.prototype,onSuccess:n.onSuccess||Function.prototype,onError:n.onError||Function.prototype,onComplete:n.onComplete||Function.prototype},s=Array.apply(null,document.querySelectorAll(o.include)).filter(function(e){return n=e,r=o.exclude,!(n.matches||n.matchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector||n.msMatchesSelector||n.oMatchesSelector).call(n,r);var n,r}),a=Array.apply(null,Array(s.length)).map(function(e){return null});function i(){if(-1===a.indexOf(null)){var e=a.join("");o.onComplete(e,a,s)}}function u(n,r,t,s){var u=o.onSuccess(n,t,s);(function n(r,t,s,a){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];var u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[];var l=c(r,s,u);l.rules.length?e(l.absoluteUrls,{onBeforeSend:function(e,n,r){o.onBeforeSend(e,t,n)},onSuccess:function(e,n,r){var s=o.onSuccess(e,t,n),a=c(e=!1===s?"":s||e,n,u);return a.rules.forEach(function(n,r){e=e.replace(n,a.absoluteRules[r])}),e},onError:function(e,o,c){i.push({xhr:e,url:o}),u.push(l.rules[c]),n(r,t,s,a,i,u)},onComplete:function(e){e.forEach(function(e,n){r=r.replace(l.rules[n],e)}),n(r,t,s,a,i,u)}}):a(r,i)})(n=!1===u?"":u||n,t,s,function(e,n){null===a[r]&&(n.forEach(function(e){return o.onError(e.xhr,t,e.url)}),!o.filter||o.filter.test(e)?a[r]=e:a[r]="",i())})}function c(e,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],s={};return s.rules=(e.replace(t.cssComments,"").match(t.cssImports)||[]).filter(function(e){return-1===o.indexOf(e)}),s.urls=s.rules.map(function(e){return e.replace(t.cssImports,"$1")}),s.absoluteUrls=s.urls.map(function(e){return r(e,n)}),s.absoluteRules=s.rules.map(function(e,t){var o=s.urls[t],a=r(s.absoluteUrls[t],n);return e.replace(o,a)}),s}s.length?s.forEach(function(n,t){var s=n.getAttribute("href"),c=n.getAttribute("rel"),l="LINK"===n.nodeName&&s&&c&&"stylesheet"===c.toLowerCase(),f="STYLE"===n.nodeName;l?e(s,{mimeType:"text/css",onBeforeSend:function(e,r,t){o.onBeforeSend(e,n,r)},onSuccess:function(e,o,a){var i=r(s,location.href);u(e,t,n,i)},onError:function(e,r,s){a[t]="",o.onError(e,n,r),i()}}):f?u(n.textContent,t,n,location.href):(a[t]="",i())}):o.onComplete("",[])}function r(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:location.href,r=document.implementation.createHTMLDocument(""),t=r.createElement("base"),o=r.createElement("a");return r.head.appendChild(t),r.body.appendChild(o),t.href=n,o.href=e,o.href}function t(){for(var e=function(e){return e instanceof Object&&e.constructor===Object},n=arguments.length,r=Array(n),o=0;o=0&&c>0){for(t=[],s=r.length;l>=0&&!i;)l==u?(t.push(l),u=r.indexOf(e,l+1)):1==t.length?i=[t.pop(),c]:((o=t.pop())=0?u:c;t.length&&(i=[s,a])}return i}function u(e){function n(e){throw new Error("CSS parse error: "+e)}function r(n){var r=n.exec(e);if(r)return e=e.slice(r[0].length),r}function t(){r(/^\s*/)}function o(){return r(/^{\s*/)}function s(){return r(/^}/)}function a(){if(t(),"/"===e[0]&&"*"===e[1]){for(var r=2;e[r]&&("*"!==e[r]||"/"!==e[r+1]);)r++;if(!e[r])return n("end of comment is missing");var o=e.slice(2,r);return e=e.slice(r+2),{type:"comment",comment:o}}}function i(){for(var e=[],n=void 0;n=a();)e.push(n);return e}function u(){for(t();"}"===e[0];)n("extra closing bracket");var o=r(/^(("(?:\\"|[^"])*"|'(?:\\'|[^'])*'|[^{])+)/);if(o)return o[0].trim().replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,function(e){return e.replace(/,/g,"‌")}).split(/\s*(?![^(]*\)),\s*/).map(function(e){return e.replace(/\u200C/g,",")})}function c(){r(/^([;\s]*)+/);var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=r(/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(t){if(t=t[0].trim(),!r(/^:\s*/))return n("property missing ':'");var o=r(/^((?:\/\*.*?\*\/|'(?:\\'|.)*?'|"(?:\\"|.)*?"|\((\s*'(?:\\'|.)*?'|"(?:\\"|.)*?"|[^)]*?)\s*\)|[^};])+)/),s={type:"declaration",property:t.replace(e,""),value:o?o[0].replace(e,"").trim():""};return r(/^[;\s]*/),s}}function l(){if(!o())return n("missing '{'");for(var e=void 0,r=i();e=c();)r.push(e),r=r.concat(i());return s()?r:n("missing '}'")}function f(){t();for(var e=[],n=void 0;n=r(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)e.push(n[1]),r(/^,\s*/);if(e.length)return{type:"keyframe",values:e,declarations:l()}}function p(){if(t(),"@"===e[0])return function(){var e=r(/^@([-\w]+)?keyframes\s*/);if(e){var t=e[1];if(!(e=r(/^([-\w]+)\s*/)))return n("@keyframes missing name");var a=e[1];if(!o())return n("@keyframes missing '{'");for(var u=void 0,c=i();u=f();)c.push(u),c=c.concat(i());return s()?{type:"keyframes",name:a,vendor:t,keyframes:c}:n("@keyframes missing '}'")}}()||function(){var e=r(/^@supports *([^{]+)/);if(e)return{type:"supports",supports:e[1].trim(),rules:d()}}()||function(){if(r(/^@host\s*/))return{type:"host",rules:d()}}()||function(){var e=r(/^@media *([^{]+)/);if(e)return{type:"media",media:e[1].trim(),rules:d()}}()||function(){var e=r(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(e)return{type:"custom-media",name:e[1].trim(),media:e[2].trim()}}()||function(){if(r(/^@page */))return{type:"page",selectors:u()||[],declarations:l()}}()||function(){var e=r(/^@([-\w]+)?document *([^{]+)/);if(e)return{type:"document",document:e[2].trim(),vendor:e[1]?e[1].trim():null,rules:d()}}()||function(){if(r(/^@font-face\s*/))return{type:"font-face",declarations:l()}}()||function(){var e=r(/^@(import|charset|namespace)\s*([^;]+);/);if(e)return{type:e[1],name:e[2].trim()}}()}function d(r){if(!r&&!o())return n("missing '{'");for(var t,a=void 0,c=i();e.length&&(r||"}"!==e[0])&&(a=p()||(void 0,(t=u()||[]).length||n("selector missing"),{type:"rule",selectors:t,declarations:l()}));)c.push(a),c=c.concat(i());return r||s()?c:n("missing '}'")}return{type:"stylesheet",stylesheet:{rules:d(!0),errors:[]}}}s.range=i;var c={},l="--",f="var";function p(e){var n,r,s={},a=t({fixNestedCalc:!0,onlyVars:!0,persist:!1,preserve:!1,variables:{},onWarning:function(){}},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),i=a.persist?c:a.variables,p=u(e);if(a.onlyVars&&(p.stylesheet.rules=function e(n){return n.filter(function(n){if(n.declarations){var r=n.declarations.filter(function(e){var n=e.property&&0===e.property.indexOf(l),r=e.value&&e.value.indexOf(f+"(")>-1;return n||r});return"font-face"!==n.type&&(n.declarations=r),Boolean(r.length)}return n.keyframes?Boolean(n.keyframes.filter(function(e){return Boolean(e.declarations.filter(function(e){var n=e.property&&0===e.property.indexOf(l),r=e.value&&e.value.indexOf(f+"(")>-1;return n||r}).length)}).length):!n.rules||(n.rules=e(n.rules).filter(function(e){return e.declarations&&e.declarations.length}),Boolean(n.rules.length))})}(p.stylesheet.rules)),p.stylesheet.rules.forEach(function(e){var n=[];if("rule"===e.type&&1===e.selectors.length&&":root"===e.selectors[0]&&(e.declarations.forEach(function(e,r){var t=e.property,o=e.value;t&&0===t.indexOf(l)&&(s[t]=o,n.push(r))}),!a.preserve))for(var r=n.length-1;r>=0;r--)e.declarations.splice(n[r],1)}),Object.keys(a.variables).forEach(function(e){var n="--"+e.replace(/^-+/,""),r=a.variables[e];e!==n&&(a.variables[n]=r,delete a.variables[e]),a.persist&&(c[n]=r)}),Object.keys(i).length){var m={declarations:[],selectors:[":root"],type:"rule"};Object.keys(i).forEach(function(e){s[e]=i[e],m.declarations.push({type:"declaration",property:e,value:i[e]}),a.persist&&(c[e]=i[e])}),a.preserve&&p.stylesheet.rules.push(m)}return function e(n,r){n.rules.forEach(function(t){t.rules?e(t,r):t.keyframes?t.keyframes.forEach(function(e){"keyframe"===e.type&&r(e.declarations,t)}):t.declarations&&r(t.declarations,n)})}(p.stylesheet,function(e,n){for(var r=void 0,t=void 0,o=void 0,i=0;i1&&void 0!==arguments[1]?arguments[1]:"",r=arguments[2],t={charset:function(e){return"@charset "+e.name+";"},comment:function(e){return 0===e.comment.indexOf("__CSSVARSPONYFILL")?"/*"+e.comment+"*/":""},"custom-media":function(e){return"@custom-media "+e.name+" "+e.media+";"},declaration:function(e){return e.property+":"+e.value+";"},document:function(e){return"@"+(e.vendor||"")+"document "+e.document+"{"+o(e.rules)+"}"},"font-face":function(e){return"@font-face{"+o(e.declarations)+"}"},host:function(e){return"@host{"+o(e.rules)+"}"},import:function(e){return"@import "+e.name+";"},keyframe:function(e){return e.values.join(",")+"{"+o(e.declarations)+"}"},keyframes:function(e){return"@"+(e.vendor||"")+"keyframes "+e.name+"{"+o(e.keyframes)+"}"},media:function(e){return"@media "+e.media+"{"+o(e.rules)+"}"},namespace:function(e){return"@namespace "+e.name+";"},page:function(e){return"@page "+(e.selectors.length?e.selectors.join(", "):"")+"{"+o(e.declarations)+"}"},rule:function(e){var n=e.declarations;if(n.length)return e.selectors.join(",")+"{"+o(n)+"}"},supports:function(e){return"@supports "+e.supports+"{"+o(e.rules)+"}"}};function o(e){for(var o="",s=0;s1&&void 0!==arguments[1]?arguments[1]:location.href,r=document.implementation.createHTMLDocument(""),t=r.createElement("base"),o=r.createElement("a");return r.head.appendChild(t),r.body.appendChild(o),t.href=n,o.href=e,o.href}return function e(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=t(v,r);function s(e,n,r,t){o.silent||console.error(e+"\n",n),o.onError(e,n,r,t)}function a(e){o.silent||console.warn(e),o.onWarning(e)}if("loading"!==document.readyState){var i=window.CSS&&window.CSS.supports&&window.CSS.supports("(--a: 0)");if(i&&o.onlyLegacy)i&&o.updateDOM&&Object.keys(o.variables).forEach(function(e){var n="--"+e.replace(/^-+/,""),r=o.variables[e];document.documentElement.style.setProperty(n,r)});else{var u=m;n({include:o.include,exclude:"#"+u+(o.exclude?","+o.exclude:""),filter:o.onlyVars?y.cssVars:null,onBeforeSend:o.onBeforeSend,onSuccess:function(e,n,r){var t=o.onSuccess(e,n,r);return e=!1===t?"":t||e,o.updateURLs&&(e.replace(y.cssComments,"").match(y.cssUrls)||[]).forEach(function(n){var t=n.replace(y.cssUrls,"$1"),o=h(t,r);e=e.replace(n,n.replace(t,o))}),e},onError:function(e,n,r){var t=e.responseURL||h(r,location.href),o=e.statusText?"("+e.statusText+")":"Unspecified Error"+(0===e.status?" (possibly CORS related)":"");s("CSS XHR Error: "+t+" "+e.status+" "+o,n,e,t)},onComplete:function(e,n,r){var t=/\/\*__CSSVARSPONYFILL-(\d+)__\*\//g,i=null;e=n.map(function(e,n){return y.cssVars.test(e)?e:"/*__CSSVARSPONYFILL-"+n+"__*/"}).join("");try{e=p(e,{fixNestedCalc:o.fixNestedCalc,onlyVars:o.onlyVars,persist:o.updateDOM,preserve:o.preserve,variables:o.variables,onWarning:a});for(var c=t.exec(e);null!==c;){var l=c[0],f=c[1];e=e.replace(l,n[f]),c=t.exec(e)}if(o.updateDOM&&r&&r.length){var d=r[r.length-1];(i=document.querySelector("#"+u)||document.createElement("style")).setAttribute("id",u),i.textContent!==e&&(i.textContent=e),d.nextSibling!==i&&d.parentNode.insertBefore(i,d.nextSibling)}}catch(e){var m=!1;n.forEach(function(e,n){try{e=p(e,o)}catch(e){var t=r[n-0];m=!0,s(e.message,t)}}),m||s(e.message||e)}o.onComplete(e,i)}})}}else document.addEventListener("DOMContentLoaded",function n(t){e(r),document.removeEventListener("DOMContentLoaded",n)})}}); - - diff --git a/lib/private/legacy/template.php b/lib/private/legacy/template.php index 0c66cca134..bbf9172dbd 100644 --- a/lib/private/legacy/template.php +++ b/lib/private/legacy/template.php @@ -124,26 +124,6 @@ class OC_Template extends \OC\Template\Base { OC_Util::addScript('files/client'); OC_Util::addScript('contactsmenu'); OC_Util::addScript('contactsmenu_templates'); - - if (\OC::$server->getConfig()->getSystemValue('debug')) { - // Add the stuff we need always - // following logic will import all vendor libraries that are - // specified in core/js/core.json - $fileContent = file_get_contents(OC::$SERVERROOT . '/core/js/core.json'); - if($fileContent !== false) { - $coreDependencies = json_decode($fileContent, true); - foreach(array_reverse($coreDependencies['vendor']) as $vendorLibrary) { - //remove trailing ".js" as addVendorScript will append it - OC_Util::addVendorScript( - substr($vendorLibrary, 0, -3),null,true); - } - } else { - throw new \Exception('Cannot read core/js/core.json'); - } - } else { - // Import all (combined) default vendor libraries - OC_Util::addVendorScript('core', null, true); - } OC_Util::addScript('core', 'dist/main', true); if (\OC::$server->getRequest()->isUserAgent([\OC\AppFramework\Http\Request::USER_AGENT_IE])) {