Changeset 997559
- Timestamp:
- 09/27/2014 09:07:57 AM (10 years ago)
- Location:
- front-end-editor/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
front-end-editor/trunk/aloha-plugins/wpImage/lib/wpImage-plugin.js
r743437 r997559 1 // Generated by CoffeeScript 1. 6.31 // Generated by CoffeeScript 1. 2 2 define(['aloha/plugin', 'ui/ui', 'ui/button', 'i18n!aloha/nls/i18n'], function(Plugin, Ui, Button, i18nCore) { 3 3 var Aloha; -
front-end-editor/trunk/build/editor.js
r743436 r997559 1 // Generated by CoffeeScript 1. 6.31 // Generated by CoffeeScript 1. 2 2 (function() { 3 var HORIZONTAL_PADDING, HOVER_BORDER, VERTICAL_PADDING, extract_data_attr, _ref, _ref1, _ref10, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9,3 var HORIZONTAL_PADDING, HOVER_BORDER, VERTICAL_PADDING, extract_data_attr, 4 4 __hasProp = {}.hasOwnProperty, 5 5 __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, … … 142 142 143 143 function hover(target) { 144 var _this = this;145 144 this.target = target; 146 145 if (this.target.width() > this.target.parent().width()) { … … 156 155 'class': 'fee-hover-container' 157 156 }).hide().appendTo('body'); 158 this.container.click(function(ev) { 159 ev.preventDefault(); 160 return _this.hide_immediately(); 161 }); 162 this.target.mousemove(function(ev) { 163 return _this.position_vert(ev.pageY); 164 }); 165 this.target.mouseover(function(ev) { 166 return _this.show(ev.pageY); 167 }); 157 this.container.click((function(_this) { 158 return function(ev) { 159 ev.preventDefault(); 160 return _this.hide_immediately(); 161 }; 162 })(this)); 163 this.target.mousemove((function(_this) { 164 return function(ev) { 165 return _this.position_vert(ev.pageY); 166 }; 167 })(this)); 168 this.target.mouseover((function(_this) { 169 return function(ev) { 170 return _this.show(ev.pageY); 171 }; 172 })(this)); 168 173 } 169 174 170 175 hover.prototype.not_editing = function($content) { 171 var _this = this;172 176 this.container.html($content); 173 this.container.bind('mouseover.autohide', function() { 174 return _this.lock = true; 175 }); 176 this.container.bind('mouseout.autohide', function() { 177 _this.lock = false; 178 return _this.hide(); 179 }); 180 return this.target.bind('mouseout.autohide', function(ev) { 181 return _this.hide(); 182 }); 177 this.container.bind('mouseover.autohide', (function(_this) { 178 return function() { 179 return _this.lock = true; 180 }; 181 })(this)); 182 this.container.bind('mouseout.autohide', (function(_this) { 183 return function() { 184 _this.lock = false; 185 return _this.hide(); 186 }; 187 })(this)); 188 return this.target.bind('mouseout.autohide', (function(_this) { 189 return function(ev) { 190 return _this.hide(); 191 }; 192 })(this)); 183 193 }; 184 194 … … 196 206 197 207 hover.prototype.hide = function() { 198 var _this = this; 199 return this.timeout = setTimeout(function() { 200 if (_this.lock) { 201 return; 202 } 203 return _this.hide_immediately(); 204 }, 300); 208 return this.timeout = setTimeout((function(_this) { 209 return function() { 210 if (_this.lock) { 211 return; 212 } 213 return _this.hide_immediately(); 214 }; 215 })(this), 300); 205 216 }; 206 217 … … 265 276 266 277 base.prototype.pre_edit_button = function() { 267 var _this = this;268 278 return jQuery('<button>', { 269 279 'class': 'fee-hover-edit', 270 280 'html': FrontEndEditor.data.edit_text, 271 'click': function(ev) { 272 _this.last_mouse_pos = ev.pageY; 273 return _this.start_editing(); 274 } 281 'click': (function(_this) { 282 return function(ev) { 283 _this.last_mouse_pos = ev.pageY; 284 return _this.start_editing(); 285 }; 286 })(this) 275 287 }); 276 288 }; … … 284 296 285 297 base.prototype.ajax_get = function() { 286 var _this = this;287 298 this.el.trigger('edit_start'); 288 299 return this._ajax_request({ 289 300 data: this.ajax_get_args.apply(this, arguments), 290 success: function() { 291 _this.ajax_get_handler.apply(_this, arguments); 292 return _this.el.trigger('edit_started'); 293 } 301 success: (function(_this) { 302 return function() { 303 _this.ajax_get_handler.apply(_this, arguments); 304 return _this.el.trigger('edit_started'); 305 }; 306 })(this) 294 307 }); 295 308 }; 296 309 297 310 base.prototype.ajax_set = function() { 298 var _this = this;299 311 this.el.trigger('edit_save'); 300 312 return this._ajax_request({ 301 313 data: this.ajax_set_args.apply(this, arguments), 302 success: function() { 303 _this.ajax_set_handler.apply(_this, arguments); 304 return _this.el.trigger('edit_saved'); 305 } 314 success: (function(_this) { 315 return function() { 316 _this.ajax_set_handler.apply(_this, arguments); 317 return _this.el.trigger('edit_saved'); 318 }; 319 })(this) 306 320 }); 307 321 }; … … 349 363 350 364 function input() { 351 _ref = input.__super__.constructor.apply(this, arguments); 352 return _ref; 365 return input.__super__.constructor.apply(this, arguments); 353 366 } 354 367 … … 362 375 363 376 input.prototype.create_buttons = function() { 364 var _this = this;365 377 this.save_button = jQuery('<button>', { 366 378 'class': 'fee-form-save', 367 379 'text': FrontEndEditor.data.save_text, 368 'click': function() { 369 return _this.ajax_set(); 370 } 380 'click': (function(_this) { 381 return function() { 382 return _this.ajax_set(); 383 }; 384 })(this) 371 385 }); 372 386 this.cancel_button = jQuery('<button>', { 373 387 'class': 'fee-form-cancel', 374 388 'text': FrontEndEditor.data.cancel_text, 375 'click': function() { 376 return _this.remove_form(); 377 } 389 'click': (function(_this) { 390 return function() { 391 return _this.remove_form(); 392 }; 393 })(this) 378 394 }); 379 395 return this.save_button.add(this.cancel_button); … … 381 397 382 398 input.prototype.create_form = function() { 383 var _this = this;384 399 this.form = jQuery(this.el.is('span') ? '<span>' : '<div>').addClass('fee-form').addClass('fee-type-' + this.get_type()); 385 return this.form.keypress(function(ev) { 386 return _this.keypress(ev.keyCode || ev.which || ev.charCode || 0); 387 }); 400 return this.form.keypress((function(_this) { 401 return function(ev) { 402 return _this.keypress(ev.keyCode || ev.which || ev.charCode || 0); 403 }; 404 })(this)); 388 405 }; 389 406 … … 493 510 494 511 function select() { 495 _ref1 = select.__super__.constructor.apply(this, arguments); 496 return _ref1; 512 return select.__super__.constructor.apply(this, arguments); 497 513 } 498 514 … … 500 516 501 517 select.prototype.content_to_input = function(content) { 502 var title, value, _ref 2;503 _ref 2= this.data.values;504 for (value in _ref 2) {505 if (!__hasProp.call(_ref 2, value)) continue;506 title = _ref 2[value];518 var title, value, _ref; 519 _ref = this.data.values; 520 for (value in _ref) { 521 if (!__hasProp.call(_ref, value)) continue; 522 title = _ref[value]; 507 523 this.input.append(jQuery('<option>', { 508 524 value: value, … … 526 542 527 543 function textarea() { 528 _ref2 = textarea.__super__.constructor.apply(this, arguments); 529 return _ref2; 544 return textarea.__super__.constructor.apply(this, arguments); 530 545 } 531 546 … … 537 552 538 553 FrontEndEditor.fieldTypes.image_base = (function(_super) { 539 var _ref 4;554 var _ref; 540 555 541 556 __extends(image_base, _super); 542 557 543 558 function image_base() { 544 _ref3 = image_base.__super__.constructor.apply(this, arguments); 545 return _ref3; 546 } 547 548 image_base.prototype.button_text = (_ref4 = FrontEndEditor.data.image) != null ? _ref4.change : void 0; 559 return image_base.__super__.constructor.apply(this, arguments); 560 } 561 562 image_base.prototype.button_text = (_ref = FrontEndEditor.data.image) != null ? _ref.change : void 0; 549 563 550 564 image_base.prototype.start_editing = function() { 551 var _this = this;552 565 tb_show(this.button_text, FrontEndEditor.data.image.url); 553 566 jQuery('#TB_closeWindowButton img').attr('src', FrontEndEditor.data.image.tb_close); 554 return jQuery('#TB_iframeContent').load(function(ev) { 555 var $thickbox, iframe; 556 iframe = ev.currentTarget.contentWindow; 557 $thickbox = iframe.jQuery(iframe.document); 558 _this.thickbox_load($thickbox); 559 if (jQuery.noop !== _this.media_item_manipulation) { 560 $thickbox.find('.media-item').each(function(i, el) { 561 return _this.media_item_manipulation(iframe.jQuery(el)); 567 return jQuery('#TB_iframeContent').load((function(_this) { 568 return function(ev) { 569 var $thickbox, iframe; 570 iframe = ev.currentTarget.contentWindow; 571 $thickbox = iframe.jQuery(iframe.document); 572 _this.thickbox_load($thickbox); 573 if (jQuery.noop !== _this.media_item_manipulation) { 574 $thickbox.find('.media-item').each(function(i, el) { 575 return _this.media_item_manipulation(iframe.jQuery(el)); 576 }); 577 return $thickbox.ajaxComplete(function(event, request) { 578 var item_id; 579 item_id = jQuery(request.responseText).find('.media-item-info').attr('id'); 580 return _this.media_item_manipulation($thickbox.find('#' + item_id).closest('.media-item')); 581 }); 582 } 583 }; 584 })(this)); 585 }; 586 587 image_base.prototype.thickbox_load = function($thickbox) { 588 return $thickbox.delegate('.media-item :submit', 'click', (function(_this) { 589 return function(ev) { 590 var $button, data; 591 $button = jQuery(ev.currentTarget); 592 data = $button.closest('form').serializeArray(); 593 data.push({ 594 name: $button.attr('name'), 595 value: $button.attr('name') 562 596 }); 563 return $thickbox.ajaxComplete(function(event, request) { 564 var item_id; 565 item_id = jQuery(request.responseText).find('.media-item-info').attr('id'); 566 return _this.media_item_manipulation($thickbox.find('#' + item_id).closest('.media-item')); 597 data.push({ 598 name: 'action', 599 value: 'fee_image_insert' 567 600 }); 568 } 569 }); 570 }; 571 572 image_base.prototype.thickbox_load = function($thickbox) { 573 var _this = this; 574 return $thickbox.delegate('.media-item :submit', 'click', function(ev) { 575 var $button, data; 576 $button = jQuery(ev.currentTarget); 577 data = $button.closest('form').serializeArray(); 578 data.push({ 579 name: $button.attr('name'), 580 value: $button.attr('name') 581 }); 582 data.push({ 583 name: 'action', 584 value: 'fee_image_insert' 585 }); 586 jQuery.post(FrontEndEditor.data.ajax_url, data, function(html) { 587 return _this.image_html_handler(html); 588 }); 589 return false; 590 }); 601 jQuery.post(FrontEndEditor.data.ajax_url, data, function(html) { 602 return _this.image_html_handler(html); 603 }); 604 return false; 605 }; 606 })(this)); 591 607 }; 592 608 … … 604 620 605 621 function image() { 606 _ref4 = image.__super__.constructor.apply(this, arguments); 607 return _ref4; 622 return image.__super__.constructor.apply(this, arguments); 608 623 } 609 624 610 625 image.prototype.start_editing = function() { 611 var _this = this;612 626 image.__super__.start_editing.apply(this, arguments); 613 return jQuery('<a id="fee-img-revert" href="#">').text(FrontEndEditor.data.image.revert).click(function(ev) { 614 _this.ajax_set(-1); 615 return false; 616 }).insertAfter('#TB_ajaxWindowTitle'); 627 return jQuery('<a id="fee-img-revert" href="#">').text(FrontEndEditor.data.image.revert).click((function(_this) { 628 return function(ev) { 629 _this.ajax_set(-1); 630 return false; 631 }; 632 })(this)).insertAfter('#TB_ajaxWindowTitle'); 617 633 }; 618 634 … … 650 666 651 667 function thumbnail() { 652 _ref5 = thumbnail.__super__.constructor.apply(this, arguments); 653 return _ref5; 668 return thumbnail.__super__.constructor.apply(this, arguments); 654 669 } 655 670 656 671 thumbnail.prototype.thickbox_load = function($thickbox) { 657 var _this = this;658 672 $thickbox.find('#tab-type_url').remove(); 659 return $thickbox.delegate('.media-item :submit', 'click', function(ev) { 660 var $item, attachment_id; 661 $item = jQuery(ev.currentTarget).closest('.media-item').find('.media-item-info'); 662 attachment_id = $item.attr('id').replace('media-head-', ''); 663 _this.ajax_set(attachment_id); 664 return false; 665 }); 673 return $thickbox.delegate('.media-item :submit', 'click', (function(_this) { 674 return function(ev) { 675 var $item, attachment_id; 676 $item = jQuery(ev.currentTarget).closest('.media-item').find('.media-item-info'); 677 attachment_id = $item.attr('id').replace('media-head-', ''); 678 _this.ajax_set(attachment_id); 679 return false; 680 }; 681 })(this)); 666 682 }; 667 683 … … 677 693 if (typeof Aloha !== "undefined" && Aloha !== null) { 678 694 Aloha.require(['aloha/selection'], function(Selection) { 679 var _ref6;680 695 return FrontEndEditor.fieldTypes.image_rich = (function(_super) { 681 var _ref 7;696 var _ref; 682 697 683 698 __extends(image_rich, _super); 684 699 685 700 function image_rich() { 686 _ref6 = image_rich.__super__.constructor.apply(this, arguments); 687 return _ref6; 701 return image_rich.__super__.constructor.apply(this, arguments); 688 702 } 689 703 690 image_rich.prototype.button_text = (_ref 7 = FrontEndEditor.data.image) != null ? _ref7.insert : void 0;704 image_rich.prototype.button_text = (_ref.insert : void 0; 691 705 692 706 image_rich.prototype.start_editing = function() { … … 713 727 714 728 function rich() { 715 _ref6 = rich.__super__.constructor.apply(this, arguments); 716 return _ref6; 729 return rich.__super__.constructor.apply(this, arguments); 717 730 } 718 731 … … 757 770 758 771 function terminput() { 759 _ref7 = terminput.__super__.constructor.apply(this, arguments); 760 return _ref7; 772 return terminput.__super__.constructor.apply(this, arguments); 761 773 } 762 774 … … 779 791 780 792 function termselect() { 781 _ref8 = termselect.__super__.constructor.apply(this, arguments); 782 return _ref8; 793 return termselect.__super__.constructor.apply(this, arguments); 783 794 } 784 795 … … 798 809 799 810 function widget() { 800 _ref9 = widget.__super__.constructor.apply(this, arguments); 801 return _ref9; 811 return widget.__super__.constructor.apply(this, arguments); 802 812 } 803 813 … … 810 820 811 821 widget.prototype.ajax_set_args = function() { 812 var args, name, value, _i, _len, _ref 10, _ref11;822 var args, name, value, _i, _len, _ref1; 813 823 args = widget.__super__.ajax_set_args.apply(this, arguments); 814 _ref 10= this.form.find(':input').serializeArray();815 for (_i = 0, _len = _ref 10.length; _i < _len; _i++) {816 _ref1 1 = _ref10[_i], name = _ref11.name, value = _ref11.value;824 _ref = this.form.find(':input').serializeArray(); 825 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 826 _ref11.value; 817 827 args[name] = args[name] === void 0 ? value : jQuery.isArray(args[name]) ? args[name].concat(value) : [args[name], value]; 818 828 } … … 847 857 848 858 group.prototype.create_form = function() { 849 var editor, _i, _len, _ref 10;850 _ref 10= this.editors;851 for (_i = 0, _len = _ref 10.length; _i < _len; _i++) {852 editor = _ref 10[_i];859 var editor, _i, _len, _ref; 860 _ref = this.editors; 861 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 862 editor = _ref[_i]; 853 863 editor.create_form(); 854 864 editor.create_input(); … … 858 868 859 869 group.prototype.remove_form = function() { 860 var editor, _i, _len, _ref 10;861 _ref 10= this.editors;862 for (_i = 0, _len = _ref 10.length; _i < _len; _i++) {863 editor = _ref 10[_i];870 var editor, _i, _len, _ref; 871 _ref = this.editors; 872 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 873 editor = _ref[_i]; 864 874 editor.remove_form(); 865 875 } … … 868 878 869 879 group.prototype.content_from_input = function() { 870 var editor, _i, _len, _ref 10, _results;871 _ref 10= this.editors;880 var editor, _i, _len, _ref, _results; 881 _ref = this.editors; 872 882 _results = []; 873 for (_i = 0, _len = _ref 10.length; _i < _len; _i++) {874 editor = _ref 10[_i];883 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 884 editor = _ref[_i]; 875 885 _results.push(editor.content_from_input()); 876 886 } … … 886 896 887 897 group.prototype.ajax_args = function() { 888 var args, commonData, data, dataArr, editor, i, item, key, value, _i, _ref 10;898 var args, commonData, data, dataArr, editor, i, item, key, value, _i, _ref; 889 899 args = group.__super__.ajax_args.apply(this, arguments); 890 900 args.group = true; 891 901 dataArr = (function() { 892 var _i, _len, _ref 10, _results;893 _ref 10= this.editors;902 var _i, _len, _ref, _results; 903 _ref = this.editors; 894 904 _results = []; 895 for (_i = 0, _len = _ref 10.length; _i < _len; _i++) {896 editor = _ref 10[_i];905 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 906 editor = _ref[_i]; 897 907 _results.push(editor.data); 898 908 } … … 903 913 } else { 904 914 commonData = jQuery.extend({}, dataArr[0]); 905 for (i = _i = 1, _ref 10 = dataArr.length; 1 <= _ref10 ? _i < _ref10 : _i > _ref10; i = 1 <= _ref10? ++_i : --_i) {915 for (i = _i = 1, _ref ? ++_i : --_i) { 906 916 for (key in commonData) { 907 917 if (!__hasProp.call(commonData, key)) continue; … … 934 944 935 945 group.prototype.ajax_get_handler = function(response) { 936 var editor, i, _i, _len, _ref 10, _ref11;937 _ref 10= this.editors;938 for (i = _i = 0, _len = _ref 10.length; _i < _len; i = ++_i) {939 editor = _ref 10[i];946 var editor, i, _i, _len, _ref1; 947 _ref = this.editors; 948 for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { 949 editor = _ref[i]; 940 950 editor.ajax_get_handler(response[i]); 941 951 } 942 if ((_ref1 1= this.editors[0].input) != null) {943 _ref1 1.focus();952 if ((_ref1 = this.editors[0].input) != null) { 953 _ref1.focus(); 944 954 } 945 955 return this.hover.editing(this.create_buttons(), this.last_mouse_pos); … … 947 957 948 958 group.prototype.ajax_set_handler = function(response) { 949 var editor, i, _i, _len, _ref 10;950 _ref 10= this.editors;951 for (i = _i = 0, _len = _ref 10.length; _i < _len; i = ++_i) {952 editor = _ref 10[i];959 var editor, i, _i, _len, _ref; 960 _ref = this.editors; 961 for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { 962 editor = _ref[i]; 953 963 editor.ajax_set_handler(response[i]); 954 964 } … … 964 974 965 975 function createPost() { 966 _ref10 = createPost.__super__.constructor.apply(this, arguments); 967 return _ref10; 976 return createPost.__super__.constructor.apply(this, arguments); 968 977 } 969 978 -
front-end-editor/trunk/build/editor.min.js
r743455 r997559 1 (function(){var t,e,r,n,o ,i,a,s,u,p,d,c,_,l,h,f={}.hasOwnProperty,y=function(t,e){function r(){this.constructor=t}for(var n in e)f.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},m=[].indexOf||function(t){for(var e=0,r=this.length;r>e;e++)if(e in this&&this[e]===t)return e;return-1};n=function(t){var e,r,n,o,i,a;for(r={},a=t.attributes,o=0,i=a.length;i>o;o++)if(e=a[o],e.specified&&0===e.name.indexOf("data-")){n=e.value;try{n=jQuery.parseJSON(n)}catch(s){}null===n&&(n=""),r[e.name.substr(5)]=n}return r},jQuery.extend(FrontEndEditor,{fieldTypes:{},overlay:function(){var t;return t=jQuery("<div>",{"class":"fee-loading"}).css("background-image","url("+FrontEndEditor.data.spinner+")").hide().prependTo(jQuery("body")),{cover:function(e){var r,n,o,i,a;for(a=e.parents(),o=0,i=a.length;i>o&&(n=a[o],r=jQuery(n).css("background-color"),"transparent"===r);o++);return t.css({width:e.outerWidth(),height:e.outerHeight(),"background-color":r}).css(e.offset()).show()},hide:function(){return t.hide()}}}(),init_fields:function(){var t,e,r,n,o,i,a,s,u,p,d,c,_;for(d=jQuery(".fee-group").not(".fee-initialized"),a=0,u=d.length;u>a;a++)o=d[a],t=jQuery(o),e=t.find(".fee-field").removeClass("fee-field"),e.length&&(n=function(){var t,n,i;for(i=[],t=0,n=e.length;n>t;t++)o=e[t],r=FrontEndEditor.make_editable(o),r.part_of_group=!0,i.push(r);return i}(),i=t.hasClass("status-auto-draft")?"createPost":"group",r=new FrontEndEditor.fieldTypes[i](t,n),r.init_hover(t),t.data("fee-editor",r));for(c=jQuery(".fee-field").not(".fee-initialized"),_=[],s=0,p=c.length;p>s;s++)o=c[s],_.push(FrontEndEditor.make_editable(o,!0));return _},make_editable:function(t,e){var r,o,i,a;return r=jQuery(t),o=n(t),r.addClass("fee-initialized"),(a=FrontEndEditor.fieldTypes[o.type])?(i=new a,i.el=r,i.data=o,e&&(i.init_hover(r),r.data("fee-editor",i)),i):(console&&console.warn("invalid field type",t),void 0)}}),e=2,t=4,r=2,FrontEndEditor.controls=function(){function t(t){this.container=t}return t.prototype.not_editing=function(t){return this.container.html(t)},t.prototype.editing=function(t){return this.container.html(t)},t}(),FrontEndEditor.hover=function(){function n(t){var r=this;this.target=t,this.target.width()>this.target.parent().width()&&this.target.css("display","block"),this.border=jQuery("<div>",{"class":"fee-hover-border",css:{width:e}}).hide().appendTo("body"),this.container=jQuery("<div>",{"class":"fee-hover-container"}).hide().appendTo("body"),this.container.click(function(t){return t.preventDefault(),r.hide_immediately()}),this.target.mousemove(function(t){return r.position_vert(t.pageY)}),this.target.mouseover(function(t){return r.show(t.pageY)})}return n.prototype.lock=!1,n.prototype.timeout=null,n.prototype.not_editing=function(t){var e=this;return this.container.html(t),this.container.bind("mouseover.autohide",function(){return e.lock=!0}),this.container.bind("mouseout.autohide",function(){return e.lock=!1,e.hide()}),this.target.bind("mouseout.autohide",function(){return e.hide()})},n.prototype.editing=function(t,e){return this.container.html(t),this.target.unbind(".autohide"),this.container.unbind(".autohide"),this.show(e)},n.prototype.hide_immediately=function(){return this.container.hide(),this.border.hide()},n.prototype.hide=function(){var t=this;return this.timeout=setTimeout(function(){return t.lock?void 0:t.hide_immediately()},300)},n.prototype.position_vert=function(t){var r;return r=null!=t?t-this.container.outerHeight()/2-e:this.target.offset().top-2*e,this.container.css("top",r+"px")},n.prototype.show=function(n){var o;return this.position_vert(n),o=this.target.offset(),clearTimeout(this.timeout),this.container.css("left",o.left-this.container.outerWidth()-t-e+"px"),this.container.show(),this.border.css({left:o.left-t-e+"px",top:o.top-r-e+"px",height:this.target.outerHeight()+2*r+"px"}).show()},n}(),jQuery(document).ready(function(){var t,e,r,n,o,i;for(i=jQuery('[data-filter="widget_title"], [data-filter="widget_text"]'),n=0,o=i.length;o>n;n++)r=i[n],t=jQuery(r),e=t.closest(".widget_text"),e.length?(t.attr("data-widget_id",e.attr("id")),e.addClass("fee-group")):t.unwrap();return FrontEndEditor.init_fields()}),jQuery(window).load(function(){var t;return null!=(t=jQuery(".fee-group.status-auto-draft").data("fee-editor"))?t.start_editing():void 0}),FrontEndEditor.fieldTypes.base=function(){function t(){}return t.prototype.el=null,t.prototype.get_type=function(){return this.constructor.name},t.prototype.pre_edit_button=function(){var t=this;return jQuery("<button>",{"class":"fee-hover-edit",html:FrontEndEditor.data.edit_text,click:function(e){return t.last_mouse_pos=e.pageY,t.start_editing()}})},t.prototype.start_editing=null,t.prototype.init_hover=function(t){return this.hover=new FrontEndEditor.hover(t),this.hover.not_editing(this.pre_edit_button())},t.prototype.ajax_get=function(){var t=this;return this.el.trigger("edit_start"),this._ajax_request({data:this.ajax_get_args.apply(this,arguments),success:function(){return t.ajax_get_handler.apply(t,arguments),t.el.trigger("edit_started")}})},t.prototype.ajax_set=function(){var t=this;return this.el.trigger("edit_save"),this._ajax_request({data:this.ajax_set_args.apply(this,arguments),success:function(){return t.ajax_set_handler.apply(t,arguments),t.el.trigger("edit_saved")}})},t.prototype._ajax_request=function(t){return t.url=FrontEndEditor.data.ajax_url,t.type="POST",t.dataType="json",jQuery.ajax(t)},t.prototype.ajax_get_handler=null,t.prototype.ajax_set_handler=null,t.prototype.ajax_get_args=function(){var t;return t=this.ajax_args(),t.callback="get",t},t.prototype.ajax_set_args=function(t){var e;return e=this.ajax_args(),e.callback="save",e.content=t,e},t.prototype.ajax_args=function(){return{action:"front-end-editor",nonce:FrontEndEditor.data.nonce,data:this.data}},t}(),FrontEndEditor.fieldTypes.input=function(t){function e(){return o=e.__super__.constructor.apply(this,arguments)}return y(e,t),e.prototype.input_tag='<input type="text">',e.prototype.start_editing=function(){return this.create_form(),this.create_input(),this.ajax_get()},e.prototype.create_buttons=function(){var t=this;return this.save_button=jQuery("<button>",{"class":"fee-form-save",text:FrontEndEditor.data.save_text,click:function(){return t.ajax_set()}}),this.cancel_button=jQuery("<button>",{"class":"fee-form-cancel",text:FrontEndEditor.data.cancel_text,click:function(){return t.remove_form()}}),this.save_button.add(this.cancel_button)},e.prototype.create_form=function(){var t=this;return this.form=jQuery(this.el.is("span")?"<span>":"<div>").addClass("fee-form").addClass("fee-type-"+this.get_type()),this.form.keypress(function(e){return t.keypress(e.keyCode||e.which||e.charCode||0)})},e.prototype.remove_form=function(){return this.form.remove(),this.el.show()},e.prototype.keypress=function(t){var e;return e={ENTER:13,ESCAPE:27},t===e.ENTER&&"input"===this.get_type()&&this.save_button.click(),t===e.ESCAPE?this.cancel_button.click():void 0},e.prototype.create_input=function(){return this.input=jQuery(this.input_tag).attr({id:"fee-"+(new Date).getTime(),"class":"fee-form-content"}),this.input.prependTo(this.form)},e.prototype.content_to_input=function(t){return this.input.val(t)},e.prototype.content_from_input=function(){return this.input.val()},e.prototype.content_to_front=function(t){return this.el.html(t)},e.prototype.ajax_get=function(){return FrontEndEditor.overlay.cover(this.el),e.__super__.ajax_get.apply(this,arguments)},e.prototype.ajax_set_args=function(t){return FrontEndEditor.overlay.cover(this.form),0===arguments.length&&(t=this.content_from_input()),e.__super__.ajax_set_args.call(this,t)},e.prototype.ajax_get_handler=function(t){var e;return(e=this.error_handler(t))?(this.el.hide(),this.form.insertAfter(e),this.content_to_input(t.content),this.input.focus(),this.part_of_group?void 0:this.show_control_buttons()):void 0},e.prototype.show_control_buttons=function(){var t;return t=new FrontEndEditor.hover(this.form),t.editing(this.create_buttons(),this.last_mouse_pos)},e.prototype.ajax_set_handler=function(t){var e;return(e=this.error_handler(t))?(this.content_to_front(t.content),this.remove_form()):void 0},e.prototype.error_handler=function(t){var e,r;return r=this.el.closest("a"),e=r.length?r:this.el,FrontEndEditor.overlay.hide(),t.error?(jQuery('<div class="fee-error">').append(jQuery('<span class="fee-message">').html(t.error)).append(jQuery('<span class="fee-dismiss">x</span>').click(function(){return $error_box.remove()})).insertBefore(e),!1):e},e}(FrontEndEditor.fieldTypes.base),FrontEndEditor.fieldTypes.select=function(t){function e(){return i=e.__super__.constructor.apply(this,arguments)}return y(e,t),e.prototype.input_tag="<select>",e.prototype.content_to_input=function(t){var e,r,n;n=this.data.values;for(r in n)f.call(n,r)&&(e=n[r],this.input.append(jQuery("<option>",{value:r,html:e,selected:t===r})));return!1},e.prototype.content_from_input=function(){return this.input.find(":selected").val()},e}(FrontEndEditor.fieldTypes.input),FrontEndEditor.fieldTypes.textarea=function(t){function e(){return s=e.__super__.constructor.apply(this,arguments)}return y(e,t),e.prototype.input_tag='<textarea rows="10">',e}(FrontEndEditor.fieldTypes.input),FrontEndEditor.fieldTypes.image_base=function(t){function e(){return u=e.__super__.constructor.apply(this,arguments)}var r;return y(e,t),e.prototype.button_text=null!=(r=FrontEndEditor.data.image)?r.change:void 0,e.prototype.start_editing=function(){var t=this;return tb_show(this.button_text,FrontEndEditor.data.image.url),jQuery("#TB_closeWindowButton img").attr("src",FrontEndEditor.data.image.tb_close),jQuery("#TB_iframeContent").load(function(e){var r,n;return n=e.currentTarget.contentWindow,r=n.jQuery(n.document),t.thickbox_load(r),jQuery.noop!==t.media_item_manipulation?(r.find(".media-item").each(function(e,r){return t.media_item_manipulation(n.jQuery(r))}),r.ajaxComplete(function(e,n){var o;return o=jQuery(n.responseText).find(".media-item-info").attr("id"),t.media_item_manipulation(r.find("#"+o).closest(".media-item"))})):void 0})},e.prototype.thickbox_load=function(t){var e=this;return t.delegate(".media-item :submit","click",function(t){var r,n;return r=jQuery(t.currentTarget),n=r.closest("form").serializeArray(),n.push({name:r.attr("name"),value:r.attr("name")}),n.push({name:"action",value:"fee_image_insert"}),jQuery.post(FrontEndEditor.data.ajax_url,n,function(t){return e.image_html_handler(t)}),!1})},e.prototype.media_item_manipulation=function(t){return t.find("#go_button").remove(),t.find(":submit").val(this.button_text)},e}(FrontEndEditor.fieldTypes.base),FrontEndEditor.fieldTypes.image=function(t){function e(){return p=e.__super__.constructor.apply(this,arguments)}return y(e,t),e.prototype.start_editing=function(){var t=this;return e.__super__.start_editing.apply(this,arguments),jQuery('<a id="fee-img-revert" href="#">').text(FrontEndEditor.data.image.revert).click(function(){return t.ajax_set(-1),!1}).insertAfter("#TB_ajaxWindowTitle")},e.prototype.media_item_manipulation=function(t){return t.find("tbody tr").not(".image-size, .submit").hide(),e.__super__.media_item_manipulation.apply(this,arguments)},e.prototype.image_html_handler=function(t){var e;return e=jQuery(t),e.is("a")&&(e=e.find("img")),this.ajax_set(e.attr("src"))},e.prototype.ajax_set_handler=function(t){var e;return e=t.content,"-1"===e?location.reload(!0):(this.el.find("img").attr("src",e),tb_remove())},e}(FrontEndEditor.fieldTypes.image_base),FrontEndEditor.fieldTypes.thumbnail=function(t){function e(){return d=e.__super__.constructor.apply(this,arguments)}return y(e,t),e.prototype.thickbox_load=function(t){var e=this;return t.find("#tab-type_url").remove(),t.delegate(".media-item :submit","click",function(t){var r,n;return r=jQuery(t.currentTarget).closest(".media-item").find(".media-item-info"),n=r.attr("id").replace("media-head-",""),e.ajax_set(n),!1})},e.prototype.media_item_manipulation=function(t){return t.find("tbody tr").not(".submit").remove(),e.__super__.media_item_manipulation.apply(this,arguments)},e}(FrontEndEditor.fieldTypes.image),"undefined"!=typeof Aloha&&null!==Aloha&&Aloha.require(["aloha/selection"],function(t){var e;return FrontEndEditor.fieldTypes.image_rich=function(r){function n(){return e=n.__super__.constructor.apply(this,arguments)}var o;return y(n,r),n.prototype.button_text=null!=(o=FrontEndEditor.data.image)?o.insert:void 0,n.prototype.start_editing=function(){return jQuery(".aloha-floatingmenu, #aloha-floatingmenu-shadow").hide(),n.__super__.start_editing.apply(this,arguments)},n.prototype.media_item_manipulation=jQuery.noop,n.prototype.image_html_handler=function(e){return GENTICS.Utils.Dom.insertIntoDOM(jQuery(e),t.getRangeObject(),Aloha.activeEditable.obj),tb_remove(),jQuery(".aloha-floatingmenu, #aloha-floatingmenu-shadow").show()},n}(FrontEndEditor.fieldTypes.image_base)}),FrontEndEditor.fieldTypes.rich=function(t){function e(){return c=e.__super__.constructor.apply(this,arguments)}return y(e,t),e.prototype.content_from_input=function(){return Aloha.getEditableById(this.form.attr("id")).getContents()},e.prototype.create_input=jQuery.noop,e.prototype.create_form=function(){return this.form=Aloha.jQuery('<div class="fee-form fee-type-rich">')},e.prototype.remove_form=function(){return this.form.mahalo(),e.__super__.remove_form.apply(this,arguments)},e.prototype.ajax_get_handler=function(t){var e;return(e=this.error_handler(t))?(this.form.html(t.content),this.el.hide(),this.form.insertAfter(e),this.form.aloha(),this.part_of_group?void 0:(this.show_control_buttons(),this.form.focus(),this.form.dblclick())):void 0},e}(FrontEndEditor.fieldTypes.textarea),FrontEndEditor.fieldTypes.terminput=function(t){function e(){return _=e.__super__.constructor.apply(this,arguments)}return y(e,t),e.prototype.content_to_input=function(){return e.__super__.content_to_input.apply(this,arguments),this.input.suggest(FrontEndEditor.data.ajax_url+"?action=ajax-tag-search&tax="+this.data.taxonomy,{multiple:!0,resultsClass:"fee-suggest-results",selectClass:"fee-suggest-over",matchClass:"fee-suggest-match"})},e}(FrontEndEditor.fieldTypes.input),FrontEndEditor.fieldTypes.termselect=function(t){function e(){return l=e.__super__.constructor.apply(this,arguments)}return y(e,t),e.prototype.content_to_input=function(t){var e;return e=jQuery(t),this.input.replaceWith(e),this.input=e},e}(FrontEndEditor.fieldTypes.select),FrontEndEditor.fieldTypes.widget=function(t){function e(){return h=e.__super__.constructor.apply(this,arguments)}return y(e,t),e.prototype.create_input=jQuery.noop,e.prototype.content_to_input=function(t){return this.input=jQuery(t),this.form.prepend(t)},e.prototype.ajax_set_args=function(){var t,r,n,o,i,a,s;for(t=e.__super__.ajax_set_args.apply(this,arguments),a=this.form.find(":input").serializeArray(),o=0,i=a.length;i>o;o++)s=a[o],r=s.name,n=s.value,t[r]=void 0===t[r]?n:jQuery.isArray(t[r])?t[r].concat(n):[t[r],n];return t},e}(FrontEndEditor.fieldTypes.textarea),FrontEndEditor.fieldTypes.group=function(t){function e(t,r){this.el=t,this.editors=r,e.__super__.constructor.apply(this,arguments)}return y(e,t),e.prototype.create_input=jQuery.noop,e.prototype.init_hover=function(t){var r;return r=t.find(".fee-buttons"),r.length?(this.hover=new FrontEndEditor.controls(r),this.hover.not_editing(this.pre_edit_button())):e.__super__.init_hover.apply(this,arguments)},e.prototype.create_form=function(){var t,e,r,n;for(n=this.editors,e=0,r=n.length;r>e;e++)t=n[e],t.create_form(),t.create_input();return this.form=this.el},e.prototype.remove_form=function(){var t,e,r,n;for(n=this.editors,e=0,r=n.length;r>e;e++)t=n[e],t.remove_form();return this.hover.not_editing(this.pre_edit_button())},e.prototype.content_from_input=function(){var t,e,r,n,o;for(n=this.editors,o=[],e=0,r=n.length;r>e;e++)t=n[e],o.push(t.content_from_input());return o},e.prototype.keypress=jQuery.noop,e.prototype.ajax_set=function(){return e.__super__.ajax_set.apply(this,arguments),FrontEndEditor.overlay.cover(this.el)},e.prototype.ajax_args=function(){var t,r,n,o,i,a,s,u,p,d,c;if(t=e.__super__.ajax_args.apply(this,arguments),t.group=!0,o=function(){var t,e,r,n;for(r=this.editors,n=[],t=0,e=r.length;e>t;t++)i=r[t],n.push(i.data);return n}.call(this),1===o.length)t.data=o;else{for(r=jQuery.extend({},o[0]),a=d=1,c=o.length;c>=1?c>d:d>c;a=c>=1?++d:--d)for(u in r)f.call(r,u)&&(p=r[u],p!==o[a][u]&&delete r[u]);t.data=function(){var t,e,i;for(i=[],t=0,e=o.length;e>t;t++){n=o[t],s={};for(u in n)f.call(n,u)&&0>m.call(r,u)&&(s[u]=n[u]);i.push(s)}return i}(),t.commonData=r}return t},e.prototype.ajax_get_handler=function(t){var e,r,n,o,i,a;for(i=this.editors,r=n=0,o=i.length;o>n;r=++n)e=i[r],e.ajax_get_handler(t[r]);return null!=(a=this.editors[0].input)&&a.focus(),this.hover.editing(this.create_buttons(),this.last_mouse_pos)},e.prototype.ajax_set_handler=function(t){var e,r,n,o,i;for(i=this.editors,r=n=0,o=i.length;o>n;r=++n)e=i[r],e.ajax_set_handler(t[r]);return this.remove_form()},e}(FrontEndEditor.fieldTypes.input),FrontEndEditor.fieldTypes.createPost=function(t){function e(){return a=e.__super__.constructor.apply(this,arguments)}return y(e,t),e.prototype.ajax_set_args=function(){var t;return t=e.__super__.ajax_set_args.apply(this,arguments),t.createPost=!0,t},e.prototype.ajax_set_handler=function(t){return window.location=t.permalink},e}(FrontEndEditor.fieldTypes.group)}).call(this);1 (function(){var t,e,r,n,o(e,t),e.prototype.ajax_set_args=function(){var t;return t=e.__super__.ajax_set_args.apply(this,arguments),t.createPost=!0,t},e.prototype.ajax_set_handler=function(t){return window.location=t.permalink},e}(FrontEndEditor.fieldTypes.group)}).call(this);
Note: See TracChangeset
for help on using the changeset viewer.