diff --git a/media/system/js/repeatable-uncompressed.js b/media/system/js/repeatable-uncompressed.js index 6357645ea231b..8e69e2e76d5b9 100644 --- a/media/system/js/repeatable-uncompressed.js +++ b/media/system/js/repeatable-uncompressed.js @@ -483,6 +483,12 @@ $select.attr('href', oldHref.replace(/&fieldid=(.+)&/, '&fieldid=' + inputId + '&')); jMediaRefreshPreview(inputId); }); + + // fix media field in ISIS Template + $row.find('.field-media-wrapper').each(function(){ + var $el = $(this); + $el.fieldMedia(); + }); // another modals if(window.SqueezeBox && window.SqueezeBox.assign){ diff --git a/media/system/js/repeatable.js b/media/system/js/repeatable.js index c5c24dab085be..934f6d793e44a 100644 --- a/media/system/js/repeatable.js +++ b/media/system/js/repeatable.js @@ -1 +1 @@ -(function($){"use strict";$.JRepeatable=function(input,options){var self=this;if(!self||self===window){return new $.JRepeatable(input,options)}self.$input=$(input);if(self.$input.data("JRepeatable")){return self}self.$input.data("JRepeatable",self);self.init=function(){self.options=$.extend({},$.JRepeatable.defaults,options);self.$container=$(self.options.container);$("body").append(self.$container);self.$rowsContainer=self.$container.find(self.options.repeatableElement).parent();self.prepareModal();self.inputs=[];self.values={};self.prepareTemplate();var val=self.$input.val();if(val){try{self.values=JSON.parse(val)}catch(e){if(e instanceof SyntaxError){try{val=val.replace(/'/g,'"').replace(/\\"/g,"'");self.values=JSON.parse(val)}catch(e){if(window.console){console.log(e)}}}else if(window.console){console.log(e)}}}self.buildRows();$(document).on("click",self.options.btModalOpen,function(e){e.preventDefault();self.$modalWindow.modal("show")});self.$modalWindow.on("click",self.options.btModalClose,function(e){e.preventDefault();self.$modalWindow.modal("hide");self.buildRows()});self.$modalWindow.on("click",self.options.btModalSaveData,function(e){e.preventDefault();self.$modalWindow.modal("hide");self.refreshValue()});self.$container.on("click",self.options.btAdd,function(e){e.preventDefault();var after=$(this).parents(self.options.repeatableElement);if(!after.length){after=null}self.addRow(after)});self.$container.on("click",self.options.btRemove,function(e){e.preventDefault();var row=$(this).parents(self.options.repeatableElement);self.removeRow(row)});self.$input.trigger("weready")};self.prepareTemplate=function(){var $rows=self.$container.find(self.options.repeatableElement);var $row=$($rows.get(0));try{self.clearScripts($row)}catch(e){if(window.console){console.log(e)}}var inputs=$row.find("*[name]");for(var i=0,l=inputs.length;i=docHalfWidth?0:-modalHalfWidth,left=marginLeft?"50%":0,top=$(document).scrollTop()+$(window).height()*.2;self.$modalWindow.css({top:top,left:left,"margin-left":marginLeft,overflow:rowsHalfWidth>modalHalfWidth?"auto":"visible"})};self.buildRows=function(){var $oldRows=self.$rowsContainer.children();if($oldRows.length){self.removeRow($oldRows)}var count=self.values[Object.keys(self.values)[0]].length||1,row=null;for(var i=0;i=self.options.maximum){return null}var row=$.parseHTML(self.template);if(after){$(after).after(row)}else{self.$rowsContainer.append(row)}var $row=$(row);self.fixUniqueAttributes($row,count+1);if(valueKey!==null&&valueKey!==undefined){for(var i=0,l=self.inputs.length;i1){val=[];for(var c=0,cl=checked.length;c=t?0:-n,r=i?"50%":0,l=e(document).scrollTop()+.2*e(window).height();a.$modalWindow.css({top:l,left:r,"margin-left":i,overflow:o>n?"auto":"visible"})}},a.buildRows=function(){var e=a.$rowsContainer.children();e.length&&a.removeRow(e);for(var t=a.values[Object.keys(a.values)[0]].length||1,n=null,o=0;o=a.options.maximum)return null;var i=e.parseHTML(a.template);t?e(t).after(i):a.$rowsContainer.append(i);var r=e(i);if(a.fixUniqueAttributes(r,o+1),null!==n&&void 0!==n)for(var l=0,d=a.inputs.length;l1){c=[];for(var u=0,f=p.length;u