diff --git a/core/js/dist/template_prepend.js b/core/js/dist/template_prepend.js new file mode 100644 index 0000000000000..54e7eb41e5156 --- /dev/null +++ b/core/js/dist/template_prepend.js @@ -0,0 +1,62 @@ +!function(e){var t={};function n(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(i,a,function(t){return e[t]}.bind(null,a));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=10)}([,,,,,,,,,,function(e,t,n){"use strict";n.r(t);n(11),n(12),n(13),n(14),n(15),n(16),n(17),n(18),n(19),n(20),n(21),n(22),n(23),n(24),n(25),n(26),n(27),n(28),n(29)},function(e,t){var n;(n=jQuery).widget("oc.ocdialog",{options:{width:"auto",height:"auto",closeButton:!0,closeOnEscape:!0,modal:!1},_create:function(){var e=this;this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,height:this.element[0].style.height},this.originalTitle=this.element.attr("title"),this.options.title=this.options.title||this.originalTitle,this.$dialog=n('
').attr({tabIndex:-1,role:"dialog"}).insertBefore(this.element),this.$dialog.append(this.element.detach()),this.element.removeAttr("title").addClass("oc-dialog-content").appendTo(this.$dialog),this.$dialog.css({display:"inline-block",position:"fixed"}),this.enterCallback=null,n(document).on("keydown keyup",function(t){if(t.target===e.$dialog.get(0)||0!==e.$dialog.find(n(t.target)).length){if(27===t.keyCode&&"keydown"===t.type&&e.options.closeOnEscape)return t.stopImmediatePropagation(),e.close(),!1;if(13===t.keyCode){if(t.stopImmediatePropagation(),null!==e.enterCallback)return e.enterCallback(),t.preventDefault(),!1;if("keyup"===t.type)return t.preventDefault(),!1;if(e.$buttonrow&&0===e.$buttonrow.find(n(t.target)).length){var i=e.$buttonrow.find("button.primary");i&&!i.prop("disabled")&&i.trigger("click")}else e.$buttonrow&&n(t.target).trigger("click");return!1}}}),this._setOptions(this.options),this._createOverlay()},_init:function(){this.$dialog.focus(),this._trigger("open")},_setOption:function(e,t){var i=this;switch(e){case"title":if(this.$title)this.$title.text(t);else{var a=n('

'+t+"

");this.$title=a.prependTo(this.$dialog)}this._setSizes();break;case"buttons":if(this.$buttonrow)this.$buttonrow.empty();else{var o=n('
');this.$buttonrow=o.appendTo(this.$dialog)}1===t.length?this.$buttonrow.addClass("onebutton"):2===t.length?this.$buttonrow.addClass("twobuttons"):3===t.length&&this.$buttonrow.addClass("threebuttons"),n.each(t,function(e,t){var a=n("\n\t *
I'm sliding up
\n\t */\n\tvar registerAppsSlideToggle = function () {\n\t\tvar buttons = $('[data-apps-slide-toggle]');\n\n\t\tif (buttons.length === 0) {\n\t\t\t$('#app-navigation').addClass('without-app-settings');\n\t\t}\n\n\t\t$(document).click(function (event) {\n\n\t\t\tif (dynamicSlideToggleEnabled) {\n\t\t\t\tbuttons = $('[data-apps-slide-toggle]');\n\t\t\t}\n\n\t\t\tbuttons.each(function (index, button) {\n\n\t\t\t\tvar areaSelector = $(button).data('apps-slide-toggle');\n\t\t\t\tvar area = $(areaSelector);\n\n\t\t\t\tfunction hideArea() {\n\t\t\t\t\tarea.slideUp(OC.menuSpeed*4, function() {\n\t\t\t\t\t\tarea.trigger(new $.Event('hide'));\n\t\t\t\t\t});\n\t\t\t\t\tarea.removeClass('opened');\n\t\t\t\t\t$(button).removeClass('opened');\n\t\t\t\t}\n\t\t\t\tfunction showArea() {\n\t\t\t\t\tarea.slideDown(OC.menuSpeed*4, function() {\n\t\t\t\t\t\tarea.trigger(new $.Event('show'));\n\t\t\t\t\t});\n\t\t\t\t\tarea.addClass('opened');\n\t\t\t\t\t$(button).addClass('opened');\n\t\t\t\t\tvar input = $(areaSelector + ' [autofocus]');\n\t\t\t\t\tif (input.length === 1) {\n\t\t\t\t\t\tinput.focus();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// do nothing if the area is animated\n\t\t\t\tif (!area.is(':animated')) {\n\n\t\t\t\t\t// button toggles the area\n\t\t\t\t\tif ($(button).is($(event.target).closest('[data-apps-slide-toggle]'))) {\n\t\t\t\t\t\tif (area.is(':visible')) {\n\t\t\t\t\t\t\thideArea();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tshowArea();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t// all other areas that have not been clicked but are open\n\t\t\t\t\t// should be slid up\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvar closest = $(event.target).closest(areaSelector);\n\t\t\t\t\t\tif (area.is(':visible') && closest[0] !== area[0]) {\n\t\t\t\t\t\t\thideArea();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\t});\n\t};\n\n\n\t$(document).ready(function () {\n\t\tregisterAppsSlideToggle();\n\t});\n\n}(document, jQuery, OC));\n","/**\n * @author Roeland Jago Douma \n *\n * @copyright Copyright (c) 2015, ownCloud, Inc.\n * @license AGPL-3.0\n *\n * This code is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License, version 3,\n * as published by the Free Software Foundation.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License, version 3,\n * along with this program. If not, see \n *\n */\n\n/**\n * Namespace to hold functions related to convert mimetype to icons\n *\n * @namespace\n */\nOC.MimeType = {\n\n\t/**\n\t * Cache that maps mimeTypes to icon urls\n\t */\n\t_mimeTypeIcons: {},\n\n\t/**\n\t * Return the file icon we want to use for the given mimeType.\n\t * The file needs to be present in the supplied file list\n\t *\n\t * @param {string} mimeType The mimeType we want an icon for\n\t * @param {array} files The available icons in this theme\n\t * @return {string} The icon to use or null if there is no match\n\t */\n\t_getFile: function(mimeType, files) {\n\t\tvar icon = mimeType.replace(new RegExp('/', 'g'), '-');\n\n\t\t// Generate path\n\t\tif (mimeType === 'dir' && $.inArray('folder', files) !== -1) {\n\t\t\treturn 'folder';\n\t\t} else if (mimeType === 'dir-encrypted' && $.inArray('folder-encrypted', files) !== -1) {\n\t\t\treturn 'folder-encrypted';\n\t\t} else if (mimeType === 'dir-shared' && $.inArray('folder-shared', files) !== -1) {\n\t\t\treturn 'folder-shared';\n\t\t} else if (mimeType === 'dir-public' && $.inArray('folder-public', files) !== -1) {\n\t\t\treturn 'folder-public';\n\t\t} else if (mimeType === 'dir-external' && $.inArray('folder-external', files) !== -1) {\n\t\t\treturn 'folder-external';\n\t\t} else if ($.inArray(icon, files) !== -1) {\n\t\t\treturn icon;\n\t\t} else if ($.inArray(icon.split('-')[0], files) !== -1) {\n\t\t\treturn icon.split('-')[0];\n\t\t} else if ($.inArray('file', files) !== -1) {\n\t\t\treturn 'file';\n\t\t}\n\n\t\treturn null;\n\t},\n\n\t/**\n\t * Return the url to icon of the given mimeType\n\t *\n\t * @param {string} mimeType The mimeType to get the icon for\n\t * @return {string} Url to the icon for mimeType\n\t */\n\tgetIconUrl: function(mimeType) {\n\t\tif (_.isUndefined(mimeType)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\twhile (mimeType in OC.MimeTypeList.aliases) {\n\t\t\tmimeType = OC.MimeTypeList.aliases[mimeType];\n\t\t}\n\t\tif (mimeType in OC.MimeType._mimeTypeIcons) {\n\t\t\treturn OC.MimeType._mimeTypeIcons[mimeType];\n\t\t}\n\n\t\t// First try to get the correct icon from the current theme\n\t\tvar gotIcon = null;\n\t\tvar path = '';\n\t\tif (OC.theme.folder !== '' && $.isArray(OC.MimeTypeList.themes[OC.theme.folder])) {\n\t\t\tpath = OC.getRootPath() + '/themes/' + OC.theme.folder + '/core/img/filetypes/';\n\t\t\tvar icon = OC.MimeType._getFile(mimeType, OC.MimeTypeList.themes[OC.theme.folder]);\n\n\t\t\tif (icon !== null) {\n\t\t\t\tgotIcon = true;\n\t\t\t\tpath += icon;\n\t\t\t}\n\t\t}\n\t\tif(OCA.Theming && gotIcon === null) {\n\t\t\tpath = OC.generateUrl('/apps/theming/img/core/filetypes/');\n\t\t\tpath += OC.MimeType._getFile(mimeType, OC.MimeTypeList.files);\n\t\t\tgotIcon = true;\n\t\t}\n\n\t\t// If we do not yet have an icon fall back to the default\n\t\tif (gotIcon === null) {\n\t\t\tpath = OC.getRootPath() + '/core/img/filetypes/';\n\t\t\tpath += OC.MimeType._getFile(mimeType, OC.MimeTypeList.files);\n\t\t}\n\n\t\tpath += '.svg';\n\n\t\tif(OCA.Theming) {\n\t\t\tpath += \"?v=\" + OCA.Theming.cacheBuster;\n\t\t}\n\n\t\t// Cache the result\n\t\tOC.MimeType._mimeTypeIcons[mimeType] = path;\n\t\treturn path;\n\t}\n\n};\n","/**\n* This file is automatically generated\n* DO NOT EDIT MANUALLY!\n*\n* You can update the list of MimeType Aliases in config/mimetypealiases.json\n* The list of files is fetched from core/img/filetypes\n* To regenerate this file run ./occ maintenance:mimetype:update-js\n*/\nOC.MimeTypeList={\n\taliases: {\n \"application/coreldraw\": \"image\",\n \"application/epub+zip\": \"text\",\n \"application/font-sfnt\": \"image\",\n \"application/font-woff\": \"image\",\n \"application/gpx+xml\": \"location\",\n \"application/illustrator\": \"image\",\n \"application/javascript\": \"text/code\",\n \"application/json\": \"text/code\",\n \"application/msaccess\": \"file\",\n \"application/msexcel\": \"x-office/spreadsheet\",\n \"application/msonenote\": \"x-office/document\",\n \"application/mspowerpoint\": \"x-office/presentation\",\n \"application/msword\": \"x-office/document\",\n \"application/octet-stream\": \"file\",\n \"application/postscript\": \"image\",\n \"application/rss+xml\": \"application/xml\",\n \"application/vnd.android.package-archive\": \"package/x-generic\",\n \"application/vnd.lotus-wordpro\": \"x-office/document\",\n \"application/vnd.garmin.tcx+xml\": \"location\",\n \"application/vnd.google-earth.kml+xml\": \"location\",\n \"application/vnd.google-earth.kmz\": \"location\",\n \"application/vnd.ms-excel\": \"x-office/spreadsheet\",\n \"application/vnd.ms-excel.addin.macroEnabled.12\": \"x-office/spreadsheet\",\n \"application/vnd.ms-excel.sheet.binary.macroEnabled.12\": \"x-office/spreadsheet\",\n \"application/vnd.ms-excel.sheet.macroEnabled.12\": \"x-office/spreadsheet\",\n \"application/vnd.ms-excel.template.macroEnabled.12\": \"x-office/spreadsheet\",\n \"application/vnd.ms-fontobject\": \"image\",\n \"application/vnd.ms-powerpoint\": \"x-office/presentation\",\n \"application/vnd.ms-powerpoint.addin.macroEnabled.12\": \"x-office/presentation\",\n \"application/vnd.ms-powerpoint.presentation.macroEnabled.12\": \"x-office/presentation\",\n \"application/vnd.ms-powerpoint.slideshow.macroEnabled.12\": \"x-office/presentation\",\n \"application/vnd.ms-powerpoint.template.macroEnabled.12\": \"x-office/presentation\",\n \"application/vnd.ms-visio.drawing.macroEnabled.12\": \"application/vnd.visio\",\n \"application/vnd.ms-visio.drawing\": \"application/vnd.visio\",\n \"application/vnd.ms-visio.stencil.macroEnabled.12\": \"application/vnd.visio\",\n \"application/vnd.ms-visio.stencil\": \"application/vnd.visio\",\n \"application/vnd.ms-visio.template.macroEnabled.12\": \"application/vnd.visio\",\n \"application/vnd.ms-visio.template\": \"application/vnd.visio\",\n \"application/vnd.ms-word.document.macroEnabled.12\": \"x-office/document\",\n \"application/vnd.ms-word.template.macroEnabled.12\": \"x-office/document\",\n \"application/vnd.oasis.opendocument.presentation\": \"x-office/presentation\",\n \"application/vnd.oasis.opendocument.presentation-template\": \"x-office/presentation\",\n \"application/vnd.oasis.opendocument.spreadsheet\": \"x-office/spreadsheet\",\n \"application/vnd.oasis.opendocument.spreadsheet-template\": \"x-office/spreadsheet\",\n \"application/vnd.oasis.opendocument.text\": \"x-office/document\",\n \"application/vnd.oasis.opendocument.text-master\": \"x-office/document\",\n \"application/vnd.oasis.opendocument.text-template\": \"x-office/document\",\n \"application/vnd.oasis.opendocument.text-web\": \"x-office/document\",\n \"application/vnd.openxmlformats-officedocument.presentationml.presentation\": \"x-office/presentation\",\n \"application/vnd.openxmlformats-officedocument.presentationml.slideshow\": \"x-office/presentation\",\n \"application/vnd.openxmlformats-officedocument.presentationml.template\": \"x-office/presentation\",\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\": \"x-office/spreadsheet\",\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.template\": \"x-office/spreadsheet\",\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\": \"x-office/document\",\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.template\": \"x-office/document\",\n \"application/vnd.visio\": \"x-office/document\",\n \"application/vnd.wordperfect\": \"x-office/document\",\n \"application/x-7z-compressed\": \"package/x-generic\",\n \"application/x-bzip2\": \"package/x-generic\",\n \"application/x-cbr\": \"text\",\n \"application/x-compressed\": \"package/x-generic\",\n \"application/x-dcraw\": \"image\",\n \"application/x-deb\": \"package/x-generic\",\n \"application/x-fictionbook+xml\": \"text\",\n \"application/x-font\": \"image\",\n \"application/x-gimp\": \"image\",\n \"application/x-gzip\": \"package/x-generic\",\n \"application/x-iwork-keynote-sffkey\": \"x-office/presentation\",\n \"application/x-iwork-numbers-sffnumbers\": \"x-office/spreadsheet\",\n \"application/x-iwork-pages-sffpages\": \"x-office/document\",\n \"application/x-mobipocket-ebook\": \"text\",\n \"application/x-perl\": \"text/code\",\n \"application/x-photoshop\": \"image\",\n \"application/x-php\": \"text/code\",\n \"application/x-rar-compressed\": \"package/x-generic\",\n \"application/x-tar\": \"package/x-generic\",\n \"application/x-tex\": \"text\",\n \"application/xml\": \"text/html\",\n \"application/yaml\": \"text/code\",\n \"application/zip\": \"package/x-generic\",\n \"database\": \"file\",\n \"httpd/unix-directory\": \"dir\",\n \"text/css\": \"text/code\",\n \"text/csv\": \"x-office/spreadsheet\",\n \"text/html\": \"text/code\",\n \"text/x-c\": \"text/code\",\n \"text/x-c++src\": \"text/code\",\n \"text/x-h\": \"text/code\",\n \"text/x-java-source\": \"text/code\",\n \"text/x-ldif\": \"text/code\",\n \"text/x-python\": \"text/code\",\n \"text/x-shellscript\": \"text/code\",\n \"web\": \"text/code\",\n \"application/internet-shortcut\": \"link\"\n},\n\tfiles: [\n \"application\",\n \"application-pdf\",\n \"audio\",\n \"file\",\n \"folder\",\n \"folder-drag-accept\",\n \"folder-encrypted\",\n \"folder-external\",\n \"folder-public\",\n \"folder-shared\",\n \"folder-starred\",\n \"image\",\n \"link\",\n \"location\",\n \"package-x-generic\",\n \"text\",\n \"text-calendar\",\n \"text-code\",\n \"text-vcard\",\n \"video\",\n \"x-office-document\",\n \"x-office-presentation\",\n \"x-office-spreadsheet\"\n],\n\tthemes: []\n};\n","/*\n * Copyright (c) 2015\n *\n * This file is licensed under the Affero General Public License version 3\n * or later.\n *\n * See the COPYING-README file.\n *\n */\n\n/* global Backbone */\nif(!_.isUndefined(Backbone)) {\n\tOC.Backbone = Backbone.noConflict();\n}\n","/*\n * Copyright (c) 2015\n *\n * This file is licensed under the Affero General Public License version 3\n * or later.\n *\n * See the COPYING-README file.\n *\n */\n\n/* global Select2 */\n\n/**\n * Select2 extension for toggling values in a multi-select dropdown\n */\n(function(Select2) {\n\n\tvar Select2FindHighlightableChoices = Select2.class.multi.prototype.findHighlightableChoices;\n\tSelect2.class.multi.prototype.findHighlightableChoices = function () {\n\t\tif (this.opts.toggleSelect) {\n\t\t\treturn this.results.find('.select2-result-selectable:not(.select2-disabled)');\n\t\t}\n\t\treturn Select2FindHighlightableChoices.apply(this, arguments);\n\t};\n\n\tvar Select2TriggerSelect = Select2.class.multi.prototype.triggerSelect;\n\tSelect2.class.multi.prototype.triggerSelect = function (data) {\n\t\tif (this.opts.toggleSelect && this.val().indexOf(this.id(data)) !== -1) {\n\t\t\tvar self = this;\n\t\t\tvar val = this.id(data);\n\n\t\t\tvar selectionEls = this.container.find('.select2-search-choice').filter(function() {\n\t\t\t\treturn (self.id($(this).data('select2-data')) === val);\n\t\t\t});\n\n\t\t\tif (this.unselect(selectionEls)) {\n\t\t\t\t// also unselect in dropdown\n\t\t\t\tthis.results.find('.select2-result.select2-selected').each(function () {\n\t\t\t\t\tvar $this = $(this);\n\t\t\t\t\tif (self.id($this.data('select2-data')) === val) {\n\t\t\t\t\t\t$this.removeClass('select2-selected');\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tthis.clearSearch();\n\t\t\t}\n\n\t\t\treturn false;\n\t\t} else {\n\t\t\treturn Select2TriggerSelect.apply(this, arguments);\n\t\t}\n\t};\n\n})(Select2);\n\n","/**\n * ownCloud\n *\n * @author John Molakvoæ\n * @copyright 2016-2018 John Molakvoæ \n * @author Morris Jobke\n * @copyright 2013 Morris Jobke \n *\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE\n * License as published by the Free Software Foundation; either\n * version 3 of the License, or any later version.\n *\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU AFFERO GENERAL PUBLIC LICENSE for more details.\n *\n * You should have received a copy of the GNU Affero General Public\n * License along with this library. If not, see .\n *\n */\n\n/*\n * Adds a background color to the element called on and adds the first character\n * of the passed in string. This string is also the seed for the generation of\n * the background color.\n *\n * You have following HTML:\n *\n *
\n *\n * And call this from Javascript:\n *\n * $('#albumart').imageplaceholder('The Album Title');\n *\n * Which will result in:\n *\n *
T
\n *\n * You may also call it like this, to have a different background, than the seed:\n *\n * $('#albumart').imageplaceholder('The Album Title', 'Album Title');\n *\n * Resulting in:\n *\n *
A
\n *\n */\n\n /*\n * Alternatively, you can use the prototype function to convert your string to rgb colors:\n *\n * \"a6741a86aded5611a8e46ce16f2ad646\".toRgb()\n *\n * Will return the rgb parameters within the following object:\n *\n * Color {r: 208, g: 158, b: 109}\n *\n */\n\n(function ($) {\n\n\tString.prototype.toRgb = function() {\n\t\t// Normalize hash\t\t\n\t\tvar hash = this.toLowerCase();\n\n\t\t// Already a md5 hash?\n\t\tif( hash.match(/^([0-9a-f]{4}-?){8}$/) === null ) {\n\t\t\thash = md5(hash);\n\t\t}\n\n\t\thash = hash.replace(/[^0-9a-f]/g, '');\n\n\t\tfunction Color(r,g,b) {\n\t\t\tthis.r = r;\n\t\t\tthis.g = g;\n\t\t\tthis.b = b;\n\t\t}\n\n\t\tfunction stepCalc(steps, ends) {\n\t\t\tvar step = new Array(3);\n\t\t\tstep[0] = (ends[1].r - ends[0].r) / steps;\n\t\t\tstep[1] = (ends[1].g - ends[0].g) / steps;\n\t\t\tstep[2] = (ends[1].b - ends[0].b) / steps;\n\t\t\treturn step;\n\t\t}\n\n\t\tfunction mixPalette(steps, color1, color2) {\n\t\t\tvar count = steps + 1;\n\t\t\tvar palette = new Array();\n\t\t\tpalette.push(color1);\n\t\t\tvar step = stepCalc(steps, [color1, color2])\n\t\t\tfor (var i = 1; i < steps; i++) {\n\t\t\t\tvar r = parseInt(color1.r + (step[0] * i));\n\t\t\t\tvar g = parseInt(color1.g + (step[1] * i));\n\t\t\t\tvar b = parseInt(color1.b + (step[2] * i));\n\t\t\t\t\tpalette.push(new Color(r,g,b));\n\t\t\t}\n\t\t\treturn palette;\n\t\t}\n\n\t\tvar red = new Color(182, 70, 157);\n\t\tvar yellow = new Color(221, 203, 85);\n\t\tvar blue = new Color(0, 130, 201); // Nextcloud blue\n\t\t// Number of steps to go from a color to another\n\t\t// 3 colors * 6 will result in 18 generated colors\n\t\tvar steps = 6;\n\n\t\tvar palette1 = mixPalette(steps, red, yellow);\n\t\tvar palette2 = mixPalette(steps, yellow, blue);\n\t\tvar palette3 = mixPalette(steps, blue, red);\n\n\t\tvar finalPalette = palette1.concat(palette2).concat(palette3);\n\n\t\t// Convert a string to an integer evenly\n\t\tfunction hashToInt(hash, maximum) {\n\t\t\tvar finalInt = 0;\n\t\t\tvar result = Array();\n\n\t\t\t// Splitting evenly the string\n\t\t\tfor (var i=0; i\n * This file is licensed under the Affero General Public License version 3 or\n * later.\n * See the COPYING-README file.\n */\n\n/**\n * This plugin inserts the right avatar for the user, depending on, whether a\n * custom avatar is uploaded - which it uses then - or not, and display a\n * placeholder with the first letter of the users name instead.\n * For this it queries the core_avatar_get route, thus this plugin is fit very\n * tightly for owncloud, and it may not work anywhere else.\n *\n * You may use this on any
\n * Here I'm using
as an example.\n *\n * There are 5 ways to call this:\n *\n * 1. $('.avatardiv').avatar('jdoe', 128);\n * This will make the div to jdoe's fitting avatar, with a size of 128px.\n *\n * 2. $('.avatardiv').avatar('jdoe');\n * This will make the div to jdoe's fitting avatar. If the div already has a\n * height, it will be used for the avatars size. Otherwise this plugin will\n * search for 'size' DOM data, to use for avatar size. If neither are available\n * it will default to 64px.\n *\n * 3. $('.avatardiv').avatar();\n * This will search the DOM for 'user' data, to use as the username. If there\n * is no username available it will default to a placeholder with the value of\n * \"?\". The size will be determined the same way, as the second example.\n *\n * 4. $('.avatardiv').avatar('jdoe', 128, true);\n * This will behave like the first example, except it will also append random\n * hashes to the custom avatar images, to force image reloading in IE8.\n *\n * 5. $('.avatardiv').avatar('jdoe', 128, undefined, true);\n * This will behave like the first example, but it will hide the avatardiv, if\n * it will display the default placeholder. undefined is the ie8fix from\n * example 4 and can be either true, or false/undefined, to be ignored.\n *\n * 6. $('.avatardiv').avatar('jdoe', 128, undefined, true, callback);\n * This will behave like the above example, but it will call the function\n * defined in callback after the avatar is placed into the DOM.\n *\n */\n\n(function ($) {\n\t$.fn.avatar = function(user, size, ie8fix, hidedefault, callback, displayname) {\n\t\tvar setAvatarForUnknownUser = function(target) {\n\t\t\ttarget.imageplaceholder('?');\n\t\t\ttarget.css('background-color', '#b9b9b9');\n\t\t};\n\n\t\tif (typeof(user) !== 'undefined') {\n\t\t\tuser = String(user);\n\t\t}\n\t\tif (typeof(displayname) !== 'undefined') {\n\t\t\tdisplayname = String(displayname);\n\t\t}\n\n\t\tif (typeof(size) === 'undefined') {\n\t\t\tif (this.height() > 0) {\n\t\t\t\tsize = this.height();\n\t\t\t} else if (this.data('size') > 0) {\n\t\t\t\tsize = this.data('size');\n\t\t\t} else {\n\t\t\t\tsize = 64;\n\t\t\t}\n\t\t}\n\n\t\tthis.height(size);\n\t\tthis.width(size);\n\n\t\tif (typeof(user) === 'undefined') {\n\t\t\tif (typeof(this.data('user')) !== 'undefined') {\n\t\t\t\tuser = this.data('user');\n\t\t\t} else {\n\t\t\t\tsetAvatarForUnknownUser(this);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// sanitize\n\t\tuser = String(user).replace(/\\//g,'');\n\n\t\tvar $div = this;\n\t\tvar url;\n\n\t\t// If this is our own avatar we have to use the version attribute\n\t\tif (user === OC.getCurrentUser().uid) {\n\t\t\turl = OC.generateUrl(\n\t\t\t\t'/avatar/{user}/{size}?v={version}',\n\t\t\t\t{\n\t\t\t\t\tuser: user,\n\t\t\t\t\tsize: Math.ceil(size * window.devicePixelRatio),\n\t\t\t\t\tversion: oc_userconfig.avatar.version\n\t\t\t\t});\n\t\t} else {\n\t\t\turl = OC.generateUrl(\n\t\t\t\t'/avatar/{user}/{size}',\n\t\t\t\t{\n\t\t\t\t\tuser: user,\n\t\t\t\t\tsize: Math.ceil(size * window.devicePixelRatio)\n\t\t\t\t});\n\t\t}\n\n\t\tvar img = new Image();\n\n\t\t// If the new image loads successfully set it.\n\t\timg.onload = function() {\n\t\t\t$div.clearimageplaceholder();\n\t\t\t$div.append(img);\n\n\t\t\tif(typeof callback === 'function') {\n\t\t\t\tcallback();\n\t\t\t}\n\t\t};\n\t\t// Fallback when avatar loading fails:\n\t\t// Use old placeholder when a displayname attribute is defined,\n\t\t// otherwise show the unknown user placeholder.\n\t\timg.onerror = function () {\n\t\t\t$div.clearimageplaceholder();\n\t\t\tif (typeof(displayname) !== 'undefined') {\n\t\t\t\t$div.imageplaceholder(user, displayname);\n\t\t\t} else {\n\t\t\t\tsetAvatarForUnknownUser($div);\n\t\t\t}\n\n\t\t\tif(typeof callback === 'function') {\n\t\t\t\tcallback();\n\t\t\t}\n\t\t};\n\n\t\tif (size < 32) {\n\t\t\t$div.addClass('icon-loading-small');\n\t\t} else {\n\t\t\t$div.addClass('icon-loading');\n\t\t}\n\t\timg.width = size;\n\t\timg.height = size;\n\t\timg.src = url;\n\t\timg.alt = '';\n\t};\n}(jQuery));\n","/**\n * Copyright (c) 2017 Georg Ehrke \n * This file is licensed under the Affero General Public License version 3 or\n * later.\n * See the COPYING-README file.\n */\n\n(function ($) {\n\n\tvar LIST = ''\n\t\t+ '';\n\n\t$.fn.contactsMenu = function(shareWith, shareType, appendTo) {\n\t\t// 0 - user, 4 - email, 6 - remote\n\t\tvar allowedTypes = [0, 4, 6];\n\t\tif (allowedTypes.indexOf(shareType) === -1) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar $div = this;\n\t\tappendTo.append(LIST);\n\t\tvar $list = appendTo.find('div.contactsmenu-popover');\n\n\t\t$div.click(function() {\n\t\t\tif (!$list.hasClass('hidden')) {\n\t\t\t\t$list.addClass('hidden');\n\t\t\t\t$list.hide();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t$list.removeClass('hidden');\n\t\t\t$list.show();\n\n\t\t\tif ($list.hasClass('loaded')) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t$list.addClass('loaded');\n\t\t\t$.ajax(OC.generateUrl('/contactsmenu/findOne'), {\n\t\t\t\tmethod: 'POST',\n\t\t\t\tdata: {\n\t\t\t\t\tshareType: shareType,\n\t\t\t\t\tshareWith: shareWith\n\t\t\t\t}\n\t\t\t}).then(function(data) {\n\t\t\t\t$list.find('ul').find('li').addClass('hidden');\n\n\t\t\t\tvar actions;\n\t\t\t\tif (!data.topAction) {\n\t\t\t\t\tactions = [{\n\t\t\t\t\t\thyperlink: '#',\n\t\t\t\t\t\ttitle: t('core', 'No action available')\n\t\t\t\t\t}];\n\t\t\t\t} else {\n\t\t\t\t\tactions = [data.topAction].concat(data.actions);\n\t\t\t\t}\n\n\t\t\t\tactions.forEach(function(action) {\n\t\t\t\t\tvar template = OC.ContactsMenu.Templates['jquery_entry'];\n\t\t\t\t\t$list.find('ul').append(template(action));\n\t\t\t\t});\n\n\t\t\t\tif (actions.length === 0) {\n\n\t\t\t\t}\n\t\t\t}, function(jqXHR) {\n\t\t\t\t$list.find('ul').find('li').addClass('hidden');\n\n\t\t\t\tvar title;\n\t\t\t\tif (jqXHR.status === 404) {\n\t\t\t\t\ttitle = t('core', 'No action available');\n\t\t\t\t} else {\n\t\t\t\t\ttitle = t('core', 'Error fetching contact actions');\n\t\t\t\t}\n\n\t\t\t\tvar template = OC.ContactsMenu.Templates['jquery_entry'];\n\t\t\t\t$list.find('ul').append(template({\n\t\t\t\t\thyperlink: '#',\n\t\t\t\t\ttitle: title\n\t\t\t\t}));\n\t\t\t});\n\t\t});\n\n\t\t$(document).click(function(event) {\n\t\t\tvar clickedList = ($list.has(event.target).length > 0);\n\t\t\tvar clickedTarget = ($div.has(event.target).length > 0);\n\n\t\t\t$div.each(function() {\n\t\t\t\tif ($(this).is(event.target)) {\n\t\t\t\t\tclickedTarget = true;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tif (clickedList || clickedTarget) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t$list.addClass('hidden');\n\t\t\t$list.hide();\n\t\t});\n\t};\n}(jQuery));\n"],"sourceRoot":""} \ No newline at end of file diff --git a/core/js/merged-template-prepend.js b/core/js/merged-template-prepend.js new file mode 100644 index 0000000000000..8ab7810b24004 --- /dev/null +++ b/core/js/merged-template-prepend.js @@ -0,0 +1,19 @@ +import './jquery.ocdialog.js'; +import './oc-dialogs.js'; +import './js.js'; +import './l10n.js'; +import './octemplate.js'; +import './eventsource.js'; +import './public/appconfig.js'; +import './public/comments.js'; +import './public/whatsnew.js'; +import './config.js'; +import './oc-requesttoken.js'; +import './apps.js'; +import './mimetype.js'; +import './mimetypelist.js'; +import './oc-backbone.js'; +import './select2-toggleselect.js'; +import './placeholder.js'; +import './jquery.avatar.js'; +import './jquery.contactsmenu.js'; diff --git a/core/js/merged-template-prepend.json b/core/js/merged-template-prepend.json deleted file mode 100644 index c274201d97e61..0000000000000 --- a/core/js/merged-template-prepend.json +++ /dev/null @@ -1,21 +0,0 @@ -[ - "jquery.ocdialog.js", - "oc-dialogs.js", - "js.js", - "l10n.js", - "octemplate.js", - "eventsource.js", - "public/appconfig.js", - "public/comments.js", - "public/whatsnew.js", - "config.js", - "oc-requesttoken.js", - "apps.js", - "mimetype.js", - "mimetypelist.js", - "oc-backbone.js", - "select2-toggleselect.js", - "placeholder.js", - "jquery.avatar.js", - "jquery.contactsmenu.js" -] diff --git a/core/webpack.common.js b/core/webpack.common.js index 1cb8b7864954e..b5686ecdb3687 100644 --- a/core/webpack.common.js +++ b/core/webpack.common.js @@ -52,7 +52,8 @@ module.exports = [ }, { entry: { - share_backend: path.resolve(__dirname, 'js/merged-share-backend.js') + share_backend: path.resolve(__dirname, 'js/merged-share-backend.js'), + template_prepend: path.resolve(__dirname, 'js/merged-template-prepend.js') }, output: { filename: '[name].js', diff --git a/lib/private/legacy/template.php b/lib/private/legacy/template.php index d0812de5f6838..af4dc3c7ca982 100644 --- a/lib/private/legacy/template.php +++ b/lib/private/legacy/template.php @@ -117,7 +117,7 @@ public static function initTemplateEngine($renderAs) { OC_Util::addStyle('search', 'results'); OC_Util::addScript('search', 'search', true); OC_Util::addScript('search', 'searchprovider'); - OC_Util::addScript('merged-template-prepend', null, true); + OC_Util::addScript('core', 'dist/template_prepend', true); OC_Util::addScript('jquery-ui-fixes'); OC_Util::addScript('files/fileinfo'); OC_Util::addScript('files/client');