1 (function ($, Drupal, Backbone) {
15 Drupal.behaviors.webprofiler = {
16 attach: function (context) {
27 livefilter = function (e) {
28 el = $(e).attr('id').replace('edit-', '');
30 filter[el] = value.replace('/', '\/');
35 if (filter[key].length > 0 && filter[key] != ' ') {
36 select = filter[key].split(' ').filter(Boolean);
38 selector.push('[data-wp-' + key + ' *= ' + select[sel].toLowerCase() + ']');
39 unselected.push('[data-wp-' + key + ']:not([data-wp-' + key + ' *= ' + select[sel].toLowerCase() + '])');
43 selector.push('[data-wp-' + key + ']');
46 for (elz in unselected) {
47 $(unselected[elz]).addClass('is--hidden');
49 $(selector.join('')).removeClass('is--hidden');
52 modalFill = function(t,c){
53 $('.modal__title').html(t);
54 $('.modal__main-data').html(c);
57 clipboard = function (e, t) {
58 var clip = e.parent().find(t).get(0),
59 title = 'Original Code',
60 content = '<textarea readonly >' +
64 modalFill(title,content);
68 $(context).find('#collectors').once('webprofiler').each(function () {
69 new Drupal.webprofiler.routers.CollectorsRouter({el: $('#collectors')});
70 Backbone.history.start({
75 $(context).find('.js--modal-close').each(function () {
76 $(this).on('click', function () {
77 $('.js--modal').hide();
81 $(context).find('.js--live-filter').each(function () {
82 $(this).on('keyup', function () {
85 $(this).on('change', function () {
90 $(context).find('.js--panel-toggle').once('js--panel-toggle').each(function () {
91 $(this).on('click', function () {
92 $(this).parent().parent().toggleClass('is--open');
96 $(context).find('.js--clipboard-trigger').once('js--clipboard-trigger').each(function () {
97 $(this).on('click', function () {
98 clipboard($(this), '.js--clipboard-target')
105 }(jQuery, Drupal, Backbone));