1(function ($) { 2 3 Drupal.behaviors.panopolyMagic = { 4 attach: function (context, settings) { 5 6 /** 7 * Title Hax for Panopoly 8 * 9 * Replaces the markup of a node title pane with 10 * the h1.title page element 11 */ 12 if ($.trim($('.pane-node-title .pane-content').html()) == $.trim($('h1.title').html())) { 13 $('.pane-node-title .pane-content').html(''); 14 $('h1.title').hide().clone().prependTo('.pane-node-title .pane-content'); 15 $('.pane-node-title h1.title').show(); 16 } 17 18 } 19 } 20 21})(jQuery); 22 23(function ($) { 24 25 /** 26 * Improves the Auto Submit Experience for CTools Modals 27 */ 28 Drupal.behaviors.panopolyMagicAutosubmit = { 29 attach: function (context, settings) { 30 // Replaces click with mousedown for submit so both normal and ajax work. 31 $('.ctools-auto-submit-click', context) 32 // Exclude the 'Style' type form because then you have to press the 33 // "Next" button multiple times. 34 // @todo: Should we include the places this works rather than excluding? 35 .filter(function () { return $(this).closest('form').attr('id').indexOf('panels-edit-style-type-form') !== 0; }) 36 .click(function(event) { 37 if ($(this).hasClass('ajax-processed')) { 38 event.stopImmediatePropagation(); 39 $(this).trigger('mousedown'); 40 return false; 41 } 42 }); 43 44 // 'this' references the form element 45 function triggerSubmit (e) { 46 var $this = $(this), preview_widget = $('.widget-preview', context); 47 if (!preview_widget.hasClass('panopoly-magic-loading')) { 48 preview_widget.addClass('panopoly-magic-loading'); 49 $this.find('.ctools-auto-submit-click').click(); 50 } 51 } 52 53 // e.keyCode: key 54 var discardKeyCode = [ 55 16, // shift 56 17, // ctrl 57 18, // alt 58 20, // caps lock 59 33, // page up 60 34, // page down 61 35, // end 62 36, // home 63 37, // left arrow 64 38, // up arrow 65 39, // right arrow 66 40, // down arrow 67 9, // tab 68 13, // enter 69 27 // esc 70 ]; 71 72 // Special handling for link field widgets. This ensures content which is ahah'd in still properly autosubmits. 73 $('.field-widget-link-field input:text', context).addClass('panopoly-textfield-autosubmit').addClass('ctools-auto-submit-exclude'); 74 75 // Handle text fields and textareas. 76 var timer; 77 $('.panopoly-textfield-autosubmit, .panopoly-textarea-autosubmit', context) 78 .once('ctools-auto-submit') 79 .bind('keyup blur', function (e) { 80 var $element; 81 $element = $('.widget-preview .pane-title', context); 82 83 clearTimeout(timer); 84 85 // Filter out discarded keys. 86 if (e.type !== 'blur' && $.inArray(e.keyCode, discardKeyCode) > 0) { 87 return; 88 } 89 90 // Automatically submit the field on blur. This won't happen if title 91 // markup is already present. 92 if (e.type == 'blur') { 93 triggerSubmit.call(e.target.form) 94 } 95 // Otherwise, just trigger a timer to submit the form a second after 96 // the last activity. 97 else { 98 timer = setTimeout(function () { triggerSubmit.call(e.target.form); }, 1000); 99 } 100 }); 101 102 // Handle autocomplete fields. 103 $('.panopoly-autocomplete-autosubmit', context) 104 .once('ctools-auto-submit') 105 .bind('keyup blur', function (e) { 106 // Detect when a value is selected via TAB or ENTER. 107 if (e.type === 'blur' || e.keyCode === 13) { 108 // We defer the submit call so that it happens after autocomplete has 109 // had a chance to fill the input with the selected value. 110 setTimeout(function () { 111 triggerSubmit.call(e.target.form); 112 }, 0); 113 } 114 }); 115 116 // Prevent ctools auto-submit from firing when changing text formats. 117 $(':input.filter-list').addClass('ctools-auto-submit-exclude'); 118 119 } 120 } 121})(jQuery); 122; 123(function ($) { 124 125 Drupal.behaviors.PanelsAccordionStyle = { 126 attach: function (context, settings) { 127 for ( region_id in Drupal.settings.accordion ) { 128 var accordion = Drupal.settings.accordion[region_id] ; 129 jQuery('#'+region_id).accordion(accordion.options); 130 } 131 } 132 } 133 134})(jQuery); 135; 136/** 137 * @file 138 * JavaScript integrations between the Caption Filter module and particular 139 * WYSIWYG editors. This file also implements Insert module hooks to respond 140 * to the insertion of content into a WYSIWYG or textarea. 141 */ 142(function ($) { 143 144$(document).bind('insertIntoActiveEditor', function(event, options) { 145 if (options['fields']['title'] && Drupal.settings.captionFilter.widgets[options['widgetType']]) { 146 options['content'] = '[caption]' + options['content'] + options['fields']['title'] + '[/caption]'; 147 } 148}); 149 150Drupal.captionFilter = Drupal.captionFilter || {}; 151 152Drupal.captionFilter.toHTML = function(co, editor) { 153 return co.replace(/(?:<p>)?\[caption([^\]]*)\]([\s\S]+?)\[\/caption\](?:<\/p>)?[\s\u00a0]*/g, function(a,b,c){ 154 var id, cls, w, tempClass; 155 156 b = b.replace(/\\'|\\'|\\'/g, ''').replace(/\\"|\\"/g, '"'); 157 c = c.replace(/\\'|\\'/g, ''').replace(/\\"/g, '"'); 158 id = b.match(/id=['"]([^'"]+)/i); 159 cls = b.match(/align=['"]([^'"]+)/i); 160 w = c.match(/width=['"]([0-9]+)/); 161 162 id = ( id && id[1] ) ? id[1] : '';
163 cls = ( cls && cls[1] ) ? 'caption-' + cls[1] : ''; 164 w = ( w && w[1] ) ? w[1] : ''; 165 166 if (editor == 'tinymce') 167 tempClass = (cls == 'caption-center') ? 'mceTemp mceIEcenter' : 'mceTemp'; 168 else if (editor == 'ckeditor') 169 tempClass = (cls == 'caption-center') ? 'mceTemp mceIEcenter' : 'mceTemp'; 170 else 171 tempClass = ''; 172 173 return '<div class="caption ' + cls + ' ' + tempClass + ' draggable"><div class="caption-inner" style="width: '+(parseInt(w))+'px">' + c + '</div></div>'; 174 }); 175}; 176 177Drupal.captionFilter.toTag = function(co) { 178 return co.replace(/(<div class="caption [^"]*">)\s*<div[^>]+>(.+?)<\/div>\s*<\/div>\s*/gi, function(match, captionWrapper, contents) { 179 var align; 180 align = captionWrapper.match(/class=.*?caption-(left|center|right)/i); 181 align = (align && align[1]) ? align[1] : ''; 182 183 return '[caption' + (align ? (' align="' + align + '"') : '') + ']' + contents + '[/caption]'; 184 }); 185}; 186 187})(jQuery); 188;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.