PageSourceSearch

https://freeipost.post.gov.tw/pstacce/assets/js/directives/ngJqGrid.js

js post.gov.tw collected 2026-09-24 08:39:50 UTC 2,028 bytes, 65 lines download raw bytes

1///======================
2/// JQuery Grid
3///======================
4eSoafApp.directive('ngJqGrid', function () {
5    return {
6      restrict: 'E',
7      scope: {
8        config: '=',
9        data: '='
10      },
11      link: function (scope, element, attrs) {        
12        var guid = (function() {
13          function s4() {
14            return Math.floor((1 + Math.random()) * 0x10000)
15                       .toString(16)
16                       .substring(1);
17          }
18          return function() {
19            return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
20                   s4() + '-' + s4() + s4() + s4();
21          };
22        })();
23        scope.uuid = guid();        
24        element.attr("id", scope.uuid);
25        var sPage = scope.config.pager || "";
26        if (sPage != "") {
27          console.log(sPage);
28          var nPagerId = sPage.substr(1, sPage.length-1) + scope.uuid;
29          $(sPage).attr("id", nPagerId);
30          scope.config.pager = "#" + nPagerId; 
31        } 
32
33        scope.$watch('config', function (newValue) {
34          //console.log("step2");
35          $(element).jqGrid(newValue);
36        });
37        
38        scope.$watch('data', function (newValue, oldValue) {
39          console.log("reloadGrid");
40          $(element).clearGridData();
41          $(element).setGridParam({
42              datatype: "local",
43              data: newValue
44          }).trigger("reloadGrid", [{current: true}]);
45          return;
46
47          /* 效能太差
48          if (oldValue) {
49            for (var i = oldValue.length - 1; i >= 0; i--) {
50              $(element).jqGrid('delRowData', i);
51            }
52          }
53          if (newValue) {
54            var nMax = Math.min(50, newValue.length);
55            for (var i = 0; i < nMax; i++) {
56              $(element).jqGrid('addRowData', i, newValue[i]);
57            }
58          }
59          */
60        });       
61      },
62      template: "<table></table>",
63      replace: true
64    };
65  });

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.