PageSourceSearch

https://exploratorilor.ro/static/js/PTL.col.js

js exploratorilor.ro collected 2026-10-04 08:03:05 UTC 3,945 bytes, 129 lines download raw bytes

1// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later
2
3PTL.col = {
4  del: function($column) {
5
6    const $panel = $column.parent();
7
8    const nbOfColumnsInTab = $panel.find('.column').length;
9
10    $column.hide('fast', function() {
11
12      if (nbOfColumnsInTab <= 2) {
13        $panel.find('.col-del').addClass('ui-state-disabled');
14      }
15
16      $(this).remove();
17
18      PTL.tab.saveTabs();
19
20    });
21  },
22  add: function(colIndex) {
23
24    const $colButtons = $('<div>')
25          .attr('class', 'colButtons flexBox');
26
27    const $colLegend = $('<legend>')
28        .attr('class', 'colLegend legend-col unique translate')
29        .data('title', 'Column')
30        .data('content', 'Column')
31        .text(PTL.tr('Column'));
32
33    const $column = $('<ul>')
34          .attr('class', 'column')
35          .append($colButtons);
36
37    const $colNewButton = $('<button>')
38          .attr('title', PTL.tr('Add a column'))
39          .data('title', 'Add a column')
40          .attr('class', 'icon-plus twin translate last')
41          .data('colIndex', colIndex)
42          .button();
43
44    const $colDelButton = $('<button>')
45          .attr('title', PTL.tr('Remove this column'))
46          .data('title', 'Remove this column')
47          .attr('class', 'col-del icon-minus twin')
48          .data('colIndex', colIndex)
49          .button();
50
51    $colDelButton.bind('click', function() {
52
53      const $column = $(this).parent().parent(),
54            $feedsInCol = $column.find('.feed'),
55            nbOfFeedsInCol = $feedsInCol.length;
56      
57      if (nbOfFeedsInCol < 1) {
58        PTL.col.del($column);
59      } else {
60        PTL.dialog.killColumn($(this));
61      }
62
63    });
64
65    $colNewButton.bind('click', function() {
66
67      const $column = $(this).parent().parent(),
68            $panel = $column.parent(),
69            colIndex = $panel.find('.column').index($column);
70
71      const $newColumn = PTL.col.add(colIndex, true);
72
73      $panel.find('button.col-del').removeClass('ui-state-disabled');
74
75      $newColumn.insertAfter($column);
76
77    });
78
79    $column.sortable({
80      cursor: 'move',
81      handle: ".feedHandle",
82      connectWith: ".column",
83      cursorAt: {top: 10, left: 32},
84      receive: function(e, ui) {
85        if (ui.helper)
86          ui.helper.first().removeAttr('style'); // undo styling set by jqueryUI
87      },
88      helper: function (e, item) { //create custom helper
89        if (!item.hasClass('selected')) item.addClass('selected');
90        // clone selected items before hiding
91        const $elements = $('.selected').not('.ui-sortable-placeholder').clone();
92        //hide selected items
93        item.siblings('.selected').addClass('hidden');
94        const $helper = $('<ul class="feedHelper">');
95        return $helper.append($elements);
96      },
97      start: function (e, ui) {
98        // Drag begins
99        const $elements = ui.item.siblings('.selected.hidden').not('.ui-sortable-placeholder');
100        // Store the selected items to item being dragged
101        ui.item.data('items', $elements);
102        // Size the placeHolder
103        $('.ui-sortable-placeholder').css('height', ui.item.height());
104      },
105      update: function (e, ui) {
106        //manually add the selected items before the one actually being dragged
107        ui.item.before(ui.item.data('items'));
108      },
109      stop: function (e, ui) {
110        //show the selected items after the operation
111        ui.item.siblings('.selected').removeClass('hidden');
112        //unselect since the operation is complete
113        $('.selected').removeClass('selected ui-state-hover');
114        $('i.feedSelect').removeClass('icon-checked').addClass('icon-checkbox');
115
116        PTL.tab.saveTabs();
117        // console.error('BOOM: %s (%s)');
118      }
119      }).disableSelection();
120
121    $colButtons
122      .append($colLegend,
123        $colDelButton,
124        $colNewButton)
125      .addClass('ui-state-disabled');
126
127    return $column;
128  }
129};

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.