PageSourceSearch

https://shashankvivek.github.io/advance_editor_change_tracker/js/controller/table-generator.ctrl.js

js shashankvivek.github.io collected 2026-10-03 09:56:27 UTC 1,920 bytes, 50 lines download raw bytes

1(function() {
2	angular.module('leaf').controller('TableGeneratorController',
3			function($uibModalInstance,$window,dirty,util) {
4				util.saveCursorPosition($window);
5				var template_body = '</tr></thead><tbody>';
6				var template_footer = '</tbody></table>';
7				
8				var $ctrl = this;
9				$ctrl.data = {
10					row : 1,
11					column : 1,
12					width : 100
13				};
14
15				$ctrl.generateTable = function() {
16					// TODO - remove "td img" style with some class name
17					var template_head_pristine =  '<style>td img {max-width:100%;height:auto;}</style><table '+ 'style="table-layout: fixed; word-wrap: break-word;text-align: center;width:'+$ctrl.data.width+'%"' +' class="table table-bordered" ><thead><tr style="background-color: #e9ecef">';
18					var template_head_dirty = '<style>td img {max-width:100%;height:auto;}</style><table '+ 'style="table-layout: fixed; word-wrap: break-word;text-align: center;width:'+$ctrl.data.width+'%"' +' class="table table-bordered new" ><thead><tr style="background-color: #e9ecef">';
19					var template_head = (dirty) ? template_head_dirty : template_head_pristine ;
20					var table_template = template_head+ createColumns($ctrl.data.column)+template_body+createRows($ctrl.data.row,$ctrl.data.column)+template_footer;
21					return $uibModalInstance.close(table_template);
22				}
23
24				$ctrl.cancel = function() {
25					return $uibModalInstance.close(false);
26				}
27
28			})
29		
30			// TODO -move to sevice
31		function createColumns(count) {
32			var str = '';
33			for(var i=0; i< count;i++){
34				str = str + '<th style="table-layout: fixed; word-wrap: break-word;text-align: center;"></th>';
35			}
36			return str;
37		}
38		function createRows(row_count,column_count) {
39			var row = '';
40			for(var r = 0 ; r < row_count; r++){
41				row = row+'<tr>';
42				var column = '';
43				for(var c = 0;c < column_count;c++){
44					column = column +'<td></td>';
45				}
46				row = row+column+'<tr>';
47			}
48			return row;
49		}
50})()

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.