PageSourceSearch

https://launio.org/Scripts/App/postform.news-post.js

js launio.org collected 2026-09-27 07:24:22 UTC 3,664 bytes, 129 lines download raw bytes

1App.NewsPostForm = function(){
2	var lang = App.Localization.getLang();
3	
4	var form = $.extend({}, App.NewsFeedsStream.postForm, {
5		
6		setup: function($form){
7			$form.removeData("validator")
8			$form.removeData("unobtrusiveValidation");
9			$form.validate();
10			
11			var hostFileId = App.currentActor.id;
12			var coverUrlSettings = "?w=457&h=200&mode=crop";
13			var self = this;
14			
15			$(".ch-iconphoto", $form).addFileButton({
16				hostFileId: hostFileId,
17				fileFormAccept: $.fn.attachmetns.accept.IMAGES,
18				attach: {
19					container: $(".post-attachments", $form)
20				}
21			});
22			
23			$(".ch-icondoc", $form).addFileButton({
24				hostFileId: hostFileId,
25				fileFormAccept: $.fn.attachmetns.accept.DOCS,
26				title: lang.addDocument,
27				attach: {
28					container: $(".post-attachments", $form)
29				}
30			});
31			
32			$(".ch-iconlink", $form).linkAttachment({
33			    hostFileId: hostFileId,
34			    title: "Attach Link",
35			    attach: {
36			        container: $(".post-attachments", $form)
37			    }
38			});
39
40			$(".ch-iconcloud", $form).attachmetns({
41    			container: $(".post-attachments", $form),
42    			showUploadSection: false
43    		});
44    		
45    		$('.tb-location', $form).tblocation();
46    		
47    		$('.categoriespicker', $form).categoriespicker({
48    			hostId: $("input[name=HostId]", $form).val() 
49    		});
50    		
51    		$("input[name=tags]", $form).tagsAutocomplete();
52    		
53    		$('textarea[name=body]', $form).autoResize({
54				extraSpace: 2
55			});
56			
57			/*$('textarea[name=body]', $form).tinymce({
58	        	script_url : "/scripts/libs/tinymce/tinymce.min.js",
59	        	theme : "modern",
60	        	relative_urls : false,
61	        	plugins : "link",
62	        	menu : " ",
63	        	toolbar : "bold italic underline | bullist numlist | link unlink",
64	        	statusbar : true,
65	        	height : 200//,
66	        	//content_css : "/content/default.css"
67	    	});*/	
68	    	
69	    	var $coverSector = $(".cover-selector", $form).uploadFileForm({
70				filePickerInPopup: true,
71				hostFileId: hostFileId,
72				onFileUploaded: function(file){
73					$coverSector.uploadFileForm("showUploadedFileAsImg", {
74						file: file,
75						imgUrlSettings: coverUrlSettings
76					});
77					$("input[name=coverImg]", $form).val(file.Id);
78				},
79				onFilesSelected: function(files){
80					if (files != null && files.length > 0)
81						$coverSector.uploadFileForm("showSelectedFileAsImg", {
82							fileId: files[0],
83							imgUrlSettings: coverUrlSettings,
84							hostFileId: hostFileId,
85							onShowPreview: function(previewUrl){
86								$("input[name=coverImg]", $form).val(files[0]);		
87							}	
88						});
89				},
90				onRemove: function(){
91					$("input[name=coverImg]", $form).val("");
92				}
93			});		
94		},
95		
96		beforeSubmit: function($form){
97			if ($('.tb-location', $form).tblocation("isWaitingCoords"))
98				return false;
99					
100			$(".button-share", $form).hide();
101			if (!$form.$saving) //refactor this
102				$form.$saving = $("<p>")
103					.addClass('loading-txt')
104					.html(lang.savingPleaseWait)
105					.appendTo($(".submit", $form));
106			else
107				$form.$saving.show();
108				
109			return true
110		},
111		
112		afterSuccess: function($form){
113			if ($form.$saving)
114				$form.$saving.hide();
115			
116			$('textarea[name=body]', $form).css("height", "150px");
117			$("#news-form .post-attachments").resetAttachmetns();
118			$(".button-share", $form).show();
119			$(".preview", $form).hide();
120			$("input[name=coverImg]", $form).val("");
121			$(".coords", $form).val("");
122			$('.categoriespicker', $form).categoriespicker("reset");
123		}
124	});
125	
126	return {
127		form: form
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.