PageSourceSearch

https://news.csn.edu/wp-content/plugins/upf-editor/editor.js?ver=7.1.2

js csn.edu collected 2026-09-24 09:20:31 UTC 4,842 bytes, 164 lines download raw bytes

1jQuery(document).ready(function ($) {
2
3	// Download text file
4	$('#upfp_download_btn_txt').on('click', function() {
5		var doc_id = $('.upfp-popup.upfp-download-file-pp').attr('doc_id');
6		doc_id = doc_id.replace('doc_', '');
7		var doc_name = $('.upfp-download-file-pp #upfp_download_btn_html').attr('download');
8		
9		var fd = new FormData();
10		fd.append('doc_id', doc_id);
11		fd.append("action", "upf_te_download_file");
12		fd.append("upf_nonce", ajax_upf_te_obj.nonce);
13		$.ajax({
14			url: ajax_upf_te_obj.ajaxurl,
15			type: "POST",
16			data: fd,
17			contentType: false,
18			processData: false,
19			dataType: "JSON",
20		})
21		.done(function (results) {
22			if (results.error) {
23				console.log(results.error);
24			} 
25			else {
26				var blob = new Blob([results.file_content], {type: 'text/plain'});
27				var link = document.createElement('a');
28				link.href = window.URL.createObjectURL(blob);
29				link.download = doc_name;
30				link.style.display = 'none';
31				document.body.appendChild(link);
32				link.click();
33				document.body.removeChild(link);
34			}
35		})
36		.fail(function (data) {
37			console.log(data.responseText);
38			console.log("Request Failed. Status - " + data.statusText);
39		});
40
41	});
42	
43	// close download popup
44	$('.upvf-download-file-cls').on('click', function() {
45		$(this).closest(".upfp-popup.upfp-download-file-pp").hide();
46	});
47
48	// Create New file
49	$('#upvf-file-sbmt').on('click', function(e) {
50		
51		e.preventDefault();
52		var filename = $('.upfp-popup.new-file #new-file-name').val();
53
54		$(this).closest(".upfp-popup.new-file").hide();
55		$(".upfp-popup.new-file").find("form")[0].reset();
56
57		$('.edit_doc_upf_popup .doc_view').hide();
58		$('.edit_doc_upf_popup #upfp_text_editor_wrapper').next('.ck-editor').show();
59		$('.edit_doc_upf_popup #upf-file-editor-save-btn').show();
60
61		$(".edit_doc_upf_popup").removeAttr('data-file');
62		$(".edit_doc_upf_popup").attr('data-file-name', filename);
63		$(".edit_doc_upf_popup").show();
64
65		//update breadcrumbs
66		$(".upfp_folder_banner .upfp_parmalink").append('<small class="bc_file_name"> / ' + filename + "</small>");
67
68		//hide new button
69		$('.new-btns-dropdown-wrapper').hide();
70
71		// Remove bulk selection
72		if (is_bulk === 'Yes') {
73			jQuery('.upfp_folder_tool #upfp_bulk_slct_fldr_btn').click();
74		}
75
76		//update right side bar
77		$('.upfp_file_info').hide();
78		$('.upfp_folder_info').hide();
79		
80	});
81
82	// Save text file
83	$('#upf-file-editor-save-btn').on('click', function() {
84		var content = upf_textEditor.getData();
85		content = encodeURIComponent(content);
86		var doc_id = $('.edit_doc_upf_popup').attr('data-file');
87
88		var fd = new FormData();
89		var filename = $(".edit_doc_upf_popup").attr('data-file-name');
90		
91		if(doc_id && doc_id != undefined) { 
92			//update text file
93			fd.append('operation', 'update');
94			doc_id = doc_id.replace('doc_', '');
95			fd.append('doc_id', doc_id);
96		} 
97		else { 
98			//create new text file
99			var target_folder_id = $(".upfp_content").attr("data-current-folder");
100			fd.append("fldr_id", target_folder_id);
101			fd.append('filename', filename);
102			fd.append('operation', 'create');
103		}
104
105		fd.append('content', content);
106		fd.append("action", "upf_te_create_file");
107		fd.append("upf_nonce", ajax_upf_te_obj.nonce);
108		$.ajax({
109			url: ajax_upf_te_obj.ajaxurl,
110			type: "POST",
111			data: fd,
112			contentType: false,
113			processData: false,
114			dataType: "JSON"
115		})
116		.done(function (results) {
117			if (results.error) {
118				console.log(results.error);
119			} 
120			else {
121				
122				upf_textEditor.setData('');
123				$(".edit_doc_upf_popup").hide();
124
125				if(results.file_id) {
126					
127					let all_items = jQuery('.upfp_template_data').attr('data-all-items');
128					let file_id = results.file_id;
129
130					all_items = JSON.parse(all_items);
131					all_items.unshift(file_id);
132					all_items = JSON.stringify(all_items);
133					jQuery('.upfp_template_data').attr('data-all-items', all_items);
134					loadTemplate(1);
135
136                    jQuery(".upf_file_count_wrapper")
137                        .find(".upfp_folder_file_count")
138                        .each(function () {
139                            let count = parseInt(jQuery(this).html()) || 0;
140                            jQuery(this).html(count + 1);
141                        });
142				}
143
144				if (results.file_size && doc_id) {
145					jQuery("#doc_" + doc_id)
146						.find('[data-col-item-number="3"]')
147						.text(results.file_size);
148				}
149
150				closeFilePreview(results);
151
152				if(!doc_id || doc_id == undefined) {
153					jQuery(document).trigger('upf-js-after-file-upload', [ { file_id : results.file_id } ] );
154				}
155				
156			}
157		})
158		.fail(function (data) {
159			console.log(data.responseText);
160			console.log("Request Failed. Status - " + data.statusText);
161		});
162	});
163
164});

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.