(function (global, factory) { if (typeof define === "function" && define.amd) { define('ss.CMSMain.EditForm', ['../../../framework/javascript/dist/jQuery', '../../../framework/javascript/dist/i18n'], factory); } else if (typeof exports !== "undefined") { factory(require('../../../framework/javascript/dist/jQuery'), require('../../../framework/javascript/dist/i18n')); } else { var mod = { exports: {} }; factory(global.jQuery, global.i18n); global.ssCMSMainEditForm = mod.exports; } })(this, function (_jQuery, _i18n) { 'use strict'; var _jQuery2 = _interopRequireDefault(_jQuery); var _i18n2 = _interopRequireDefault(_i18n); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } _jQuery2.default.entwine('ss', function ($) { $('.cms-edit-form :input[name=ClassName]').entwine({ onchange: function onchange() { alert(_i18n2.default._t('CMSMAIN.ALERTCLASSNAME')); } }); $('.cms-edit-form input[name=Title]').entwine({ onmatch: function onmatch() { var self = this; self.data('OrigVal', self.val()); var form = self.closest('form'); var urlSegmentInput = $('input:text[name=URLSegment]', form); var liveLinkInput = $('input[name=LiveLink]', form); if (urlSegmentInput.length > 0) { self._addActions(); this.bind('change', function (e) { var origTitle = self.data('OrigVal'); var title = self.val(); self.data('OrigVal', title); if (urlSegmentInput.val().indexOf(urlSegmentInput.data('defaultUrl')) === 0 && liveLinkInput.val() == '') { self.updateURLSegment(title); } else { $('.update', self.parent()).show(); } self.updateRelatedFields(title, origTitle); self.updateBreadcrumbLabel(title); }); } this._super(); }, onunmatch: function onunmatch() { this._super(); }, updateRelatedFields: function updateRelatedFields(title, origTitle) { this.parents('form').find('input[name=MetaTitle], input[name=MenuTitle]').each(function () { var $this = $(this); if ($this.val() == origTitle) { $this.val(title); if ($this.updatedRelatedFields) $this.updatedRelatedFields(); } }); }, updateURLSegment: function updateURLSegment(title) { var urlSegmentInput = $('input:text[name=URLSegment]', this.closest('form')); var urlSegmentField = urlSegmentInput.closest('.field.urlsegment'); var updateURLFromTitle = $('.update', this.parent()); urlSegmentField.update(title); if (updateURLFromTitle.is(':visible')) { updateURLFromTitle.hide(); } }, updateBreadcrumbLabel: function updateBreadcrumbLabel(title) { var pageID = $('.cms-edit-form input[name=ID]').val(); var panelCrumb = $('span.cms-panel-link.crumb'); if (title && title != "") { panelCrumb.text(title); } }, _addActions: function _addActions() { var self = this; var updateURLFromTitle; updateURLFromTitle = $('