1(function($, Drupal) { 2 'use strict'; 3 4 /** 5 * Load link in modal. 6 * 7 * Duplicates Drupal.behaviors.ZZCToolsModal, using custom menu callback 8 * rather then href attribute, to trigger ctools modal depending 9 * on screen width. Requires a to have class 'cola-pages-use-modal' and 10 * data-nid value. 11 * 12 * @see ctools/help/modal.html 13 * @see ctools/js/modal.js 14 * @see Drupal.behaviors.ZZCToolsModal 15 */ 16 Drupal.behaviors.colaPagesNodeModalView = { 17 attach: function(context, settings) { 18 19 Drupal.theme.prototype.colaPagesNodeModal = function () { 20 var html = '' 21 html += ' <div id="ctools-modal">' 22 html += ' <div class="ctools-modal-content cola-pages-node-modal">' 23 html += ' <div class="modal-header">'; 24 html += ' <a class="close" href="#">'; 25 html += Drupal.CTools.Modal.currentSettings.closeText + Drupal.CTools.Modal.currentSettings.closeImage; 26 html += ' </a>'; 27 html += ' <span id="modal-title" class="modal-title"> </span>'; 28 html += ' </div>'; 29 html += ' <div id="modal-content" class="modal-content">'; 30 html += ' </div>'; 31 html += ' </div>'; 32 html += ' </div>'; 33 return html; 34 } 35 36 $('a.cola-pages-use-modal', context).once('cola-pages-use-modal', function () { 37 // Borrow breakpoint check from mobile menu toggle. 38 // (CSS appplies display: none at bp(m)) 39 if ($('.mobile-menu__toggle').css('display') !== 'none') { 40 // If mobile toggle is displayed then we're on smaller screen so don't 41 // do anything; no modals on mobile. 42 return; 43 } 44 45 var $this = $(this); 46 // We can't do our modal without an nid. 47 if (! $this.data('nid')) { 48 return; 49 } 50 // Add style class so ctools uses our custom modal theme. 51 $this.addClass('ctools-modal-cola-pages-modal-node'); 52 53 $this.click(Drupal.CTools.Modal.clickAjaxLink); 54 // Create a drupal ajax object. 55 var element_settings = {}; 56 element_settings.url = '/modals/node/' + $this.data('nid'); 57 element_settings.event = 'click'; 58 element_settings.progress = { type: 'throbber' }; 59 60 var base = element_settings.url; 61 Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); 62 }); 63 }, 64 }; 65 66})(jQuery, Drupal); 67;
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.