PageSourceSearch

https://dominiren.gr.jp/js/block_sns_load.js?1492672170

js dominiren.gr.jp collected 2026-10-06 17:52:17 UTC 13,643 bytes, 432 lines download raw bytes

1$(function(){
2
3/** Upload files on the sns post area. **/
4$('body').on('fileuploaddone', '.block .uploadfiles.type-attach-files', function(e, data){
5
6	var dropzone = $(this).closest('.dropzone');
7	var filenumber = dropzone.find('ul.files li').length + 1;
8
9	$.each(data.result.files, function (index, file) {
10		console.log("filename=" + file.name);
11		var image;
12		if(file.name.search(/(jpg|jpeg|gif|png)$/) >= 0 ){
13			//image = $('<img>').attr({'class':'image',src: '/s/file/tmp_image/'+file.name+'/'});
14			image = '<br /><img class="image" style="max-height:100px;" src="/s/file/tmp_image/'+file.name+'/">';
15		}
16
17		var icon_clip = '<i class="glyphicon glyphicon-paperclip"></i>';
18		var btn_delete = '<a class="delete" href="#" data-type="DELETE" data-url="'+file.deleteUrl+'" data-filenumber="'+filenumber+'"><i class="glyphicon glyphicon-trash"></i></a>';
19		var html_file = icon_clip + ' ' + file.originalName + image + ' ' + btn_delete;
20		$('<li/>').html(html_file).appendTo(dropzone.find('ul.files').last().show());
21
22		var hidden_var = '<input type="hidden" name="filenames[]" value="'+file.name+'"  data-filenumber="'+filenumber+'"/>';
23		hidden_var += '<input type="hidden" name="originalnames[]" value="'+file.originalName+'"  data-filenumber="'+filenumber+'"/>';
24		dropzone.find('form').append(hidden_var);
25
26	});
27
28	$(this).closest('.dropzone').find('.progress').hide();
29})
30
31	// アップロードファイルを削除
32	$(document).on('click','.block .file-upload .delete', function(){
33		var btn_delete = $(this);
34		var dropzone = $(this).closest('.dropzone');
35		var url = btn_delete.data('url');
36		var filenumber = $(this).data('filenumber');
37
38		$.ajax({
39				type: 'DELETE',
40				url : url,
41				dataType : 'json',
42				success: function(json) {
43					btn_delete.parent().remove();
44					dropzone.find('input[type=hidden][data-filenumber='+filenumber+']').remove();
45				}
46		});
47		return false;
48	});
49
50	// 展開モード切り替えボタンおしたとき
51	$(document).on('click', '#btn-change-collapse', function(){
52		var collapse_in = $(this).data('collapse-in');
53		if(collapse_in == 1){// 展開済み
54			collapse_in = 0;
55		}else{
56			collapse_in = 1;
57		}
58		var options = {
59			collapse_in : collapse_in
60		};
61
62		updatePostList($(this).closest('.block'), options);
63
64	});
65
66	// リロードボタンおしたとき
67	$(document).on('click', '#btn-reload-postlist', function(){
68		updatePostList($(this).closest('.block'));
69	});
70
71	// 投稿のタイトルクリックしたとき(展開時は見たフラグをつけるためリロードしてから展開する
72	$(document).on('click', '.post-area .title', function(){
73
74		if($(this).hasClass('collapsed')){ //これから収納。何もしない
75
76		}else{// これから展開
77
78			var post_id = $(this).closest('.post-area').data('pid');
79
80			var url = uri_ajax + 'parts/get_the_post';
81
82			var post_area = $('#post-' + post_id);
83			var collapse_in = 1;//強制的に展開モード
84
85			$.ajax({
86				type: 'post',
87				url : url,
88				data : {
89					post_id : post_id,
90					collapse_in : collapse_in
91				},
92				dataType : 'html',
93				success: function(html) {
94					post_area.find('.collapse').children().remove();
95					post_area.find('.collapse').append($(html).find('.collapse').children());
96				},
97				error :  function(jqXHR, textStatus, errorThrown) {
98					debugMessage("展開時にエラーが発生しました。");
99					console.log($(jqXHR.responseText).text());
100				},
101				complete: function(XMLHttpRequest, textStatus){
102
103				}
104			});
105
106
107		}
108
109	});
110
111	/** Delete the already uploaded files. **/
112	$('.block').on('click', '.post-area .delete-file', function(){
113		var file_id = $(this).data('fid');
114		var post_id = $(this).data('pid');
115		var parent_post_id = $(this).closest('.post-area').data('pid');
116		var block = $(this).closest('.block');
117
118		$.ajax({
119			type: 'post',
120			url : uri_ajax + 'ajax/delete_file.json',
121			data : {
122				post_id : post_id,
123				file_id : file_id
124			},
125			dataType : 'json',
126			success: function(json) {
127				//console.log(json);
128				if(json.error){
129					debugMessage(json.error);
130				}else{
131					updateThePost(block, parent_post_id);
132				}
133
134			},
135			error :  function(jqXHR, textStatus, errorThrown) {
136				debugMessage("ファイル削除時にエラーが発生しました。");
137				debugMessage($(jqXHR.responseText).text());
138			},
139			complete: function(XMLHttpRequest, textStatus){
140
141			}
142		});
143
144
145		return false;
146	});
147
148	// 投稿タイトルを編集
149	$(document).on('click', '.block .edit-post-title', function(){
150		var head = $(this).parent();
151		head.find('.text').hide();
152		$(this).hide();
153		var text = head.find('.title .text').text();
154		//head.find('.placard').placard('setValue',text).placard({externalClickAction : 'cancel'}).show();
155		var placard = head.find('.placard');
156		placard.placard('setValue',text).show();
157		placard.find('input[type=text]').focus();
158		return false;
159	});
160
161	//投稿タイトル編集をキャンセルしたとき
162	$(document).on('cancel.fu.placard', '.block .post-head-area .placard', function () {
163		var head = $(this).closest('.title-area');
164		head.find('.text').show();
165		head.find('.edit-post-title').show();
166		$(this).hide();;
167	});
168
169	//投稿タイトル編集をOKのとき
170	$(document).on('accept.fu.placard', '.block .post-head-area .placard', function () {
171		var head = $(this).closest('.title-area');
172		var value = $(this).placard('getValue');
173		var post_id = $(this).data('pid');
174		head.find('.text').text(value).show();
175		head.find('.edit-post-title').show();
176		$(this).hide();
177
178		  $.ajax({
179		    type:  "post",
180		    url:   uri_ajax + "ajax/update_post_title.json",
181		    data:  {post_id : post_id, value : value},
182		    success: function(json) {
183		      //updateThePost(post_id);
184		    },
185		    error: function(jqXHR, textStatus, errorThrown) {
186		      console.log(jqXHR.status);
187		      console.log(textStatus);
188		      console.log($(jqXHR.responseText).text());
189		      debugMessage('タイトル編集時にエラー発生しました。');
190		    },
191		    complete : function(data) {
192
193		    }
194		  });
195
196	});
197
198	// 本文(投稿・コメント両方)を編集
199	$(document).on('click', '.block .edit-post-body', function(){
200		var head = $(this).parent();
201		head.find('.text').hide();
202		$(this).hide();
203		var text = head.find('.text').text();
204		var placard = head.find('.placard');
205		placard.placard('setValue',text).show();
206		placard.find('textarea').focus();
207		return false;
208	});
209
210	//本文編集をキャンセルしたとき
211	$(document).on('cancel.fu.placard', '.block .post-body-area .placard, .block .comment-area .placard', function () {
212		var head = $(this).closest('.body');
213		head.find('.text').show();
214		head.find('.edit-post-body').show();
215		$(this).hide();
216	});
217
218	//本文編集OKのとき
219	$(document).on('accept.fu.placard', '.block .post-body-area .placard, .block .comment-area .placard', function () {
220		var head = $(this).closest('.body');
221		var value = $(this).placard('getValue');
222		var post_id = $(this).data('pid');
223		head.find('.text').html(nl2br(value)).show();
224		head.find('.edit-post-body').show();
225		$(this).hide();
226
227		  $.ajax({
228		    type:  "post",
229		    url:   uri_ajax + "ajax/update_post_body.json",
230		    data:  {post_id : post_id, value : value},
231		    success: function(json) {
232		      //updateThePost(post_id);
233		    },
234		    error: function(jqXHR, textStatus, errorThrown) {
235		      console.log(jqXHR.status);
236		      console.log(textStatus);
237		      console.log($(jqXHR.responseText).text());
238		      debugMessage('本文編集時にエラー発生しました。');
239		    },
240		    complete : function(data) {
241
242		    }
243		  });
244
245	});
246
247	//投稿ヘッダーにある投稿削除ボタンを押したとき
248	// $('.block[data-type=sns]').on('click', '.post-area .delete-post', function(){
249	// 	$(this).popover('toggle');
250	// 	return false;
251	// });
252
253	//$('.block[data-type=sns]').on('click', '.post-area .post-body-area .footer a[data-toggle=popover]', function(){
254	$('.block[data-type=sns], .block[data-type=list], #side-panel-right').on('click', 'a[data-toggle=popover]', function(){
255		$(this).popover('toggle');
256		return false;
257	});
258
259	// Delete the comment.
260	$('.block').on('click', '.post-area .delete-post-ok', function(){
261		var post_area = $(this).closest('.post-area');
262		var parent_post_id = post_area.data('pid');
263		var collapse_in = 0;
264		var post_id = $(this).data('pid');
265		var btn = $(this);
266		var block = $(this).closest('.block');
267
268		if(parent_post_id != post_id){
269		 collapse_in = 1;
270		}
271
272		waitingIconOnButton(btn, true);
273
274	  $.ajax({
275	    type:  "post",
276	    url:   uri_ajax + "ajax/delete_post.json",
277	    data:  {post_id : post_id},
278	    success: function(json) {
279	    	if(json.error){
280	    		waitingIconOnButton(btn, false);
281	    		debugMessage(json.error, true);
282	    	}else{
283	    		updatePostList(block, {collapse_in: collapse_in});//if this post is comment, this post box collapse in.
284	    	}
285	    },
286	    error: function(jqXHR, textStatus, errorThrown) {
287	    	waitingIconOnButton(btn, false);
288	      console.log($(jqXHR.responseText).text());
289	      debugMessage('削除時にエラー発生しました。');
290	    },
291	    complete : function(data) {
292
293	    }
294	  });
295
296	});
297
298	// Reply comments.
299	$('.block').on('click', '.btn-reply-comment', function(){
300		var form = $(this).closest('.post-area').find('.comment-form');
301
302		// Toggle comment form.
303		if(form.is(':visible')){
304			form.hide();
305		}else{
306			form.show();
307		}
308		return false;
309	});
310
311	$('.block').on('click', '.post-area .delete-post-cancel', function(){
312		var post_area = $(this).closest('.post-area');
313		post_area.find('.delete-post').popover('hide');
314	});
315
316	// 投稿ヘッダーのカテゴリ変更した場合
317	$(document).on('click', '.block .post-head-area .dropdown .dropdown-menu a', function () {
318		var category_id = $(this).data('cid');
319		var post_id = $(this).closest('.post-area').data('pid');
320		var dropdown = $(this).closest('.dropdown');
321		dropdown.find('button').text($(this).text());
322
323		$.ajax({
324		    type:  "post",
325		    url:   uri_ajax + "ajax/update_post_category.json",
326		    data:  {post_id : post_id, category_id : category_id},
327		    success: function(json) {
328		      //updateThePost(post_id);
329		      updatePostList($(this).closest('.block'));
330		    },
331		    error: function(jqXHR, textStatus, errorThrown) {
332		      console.log($(jqXHR.responseText).text());
333		      debugMessage('本文編集時にエラー発生しました。');
334		    },
335		    complete : function(data) {
336
337		    }
338		});
339
340	});
341
342	// カテゴリコンボの選択切り替え時
343	$('#categoriesCombo').on('changed.fu.combobox', function (evt, data) {
344		updatePostList($(this).closest('.block'));
345	});
346
347	// グループコンボの選択切り替え時
348	$('#groupsCombo').on('changed.fu.combobox', function (evt, data) {
349		updateGroupBox();
350		updatePostList($(this).closest('.block'));
351	});
352
353	// 投稿処理
354	$('.block .add-post').click(function(){
355		var form = $(this).closest('.post-form').find('form');
356		addPost(form);
357	});
358
359	// コメント送信処理
360	$('.block').on('click', '.add-comment', function(){
361  	var form = $(this).closest('form');
362		addComment(form);
363	  return false;
364	});
365
366  // OK! ボタンおしたとき
367  $(document).on('click','.block .send-ok', function(){
368    var post_id = $(this).data('pid');
369    var update_post_id = $(this).data('update-targetid');
370		var block = $(this).closest('.block');
371
372    var url = uri_ajax + 'ajax/add_ok';
373    //loadingIcon($('.post-list'), true);
374    $.ajax({
375        type: 'post',
376        url : url,
377        data : {
378          post_id : post_id
379        },
380        dataType : 'json',
381        success: function(json) {
382          if(json.validation_error){
383            debugMessage(json.validation_error);
384          }else{
385            updateThePost(block, update_post_id);
386          }
387        },
388        error :  function(jqXHR, textStatus, errorThrown) {
389          debugMessage("OK!処理時にエラーが発生しました。");
390          console.log($(jqXHR.responseText).text());
391        },
392        complete: function(XMLHttpRequest, textStatus){
393
394        }
395    });
396
397    return false;//リンク先は処理しない
398  });
399
400  // ページネーションをクリックしたとき
401  $(document).on('click','.block .post-list .pagination li a', function(){
402		var block = $(this).closest('.block');
403		var options = {page : $(this).data('page')};
404    updatePostList(block, options);
405    return false;//リンク先は処理しない
406  });
407
408  // ページナビの1ページあたりの件数コンボを変更したとき
409  $(document).on('change','#per_page', function(){
410    var page = 1;
411    updatePostList($(this).closest('.block'), {page:page});
412  });
413
414	// When pushed the read more button.
415  $(document).on('click','.block .post-list .btn-read-more.type-sns', function(){
416		var block = $(this).closest('.block');
417		var type = block.attr('data-type');
418
419		var options = {
420			page : $(this).attr('data-page'),
421			read_more: true,
422			per_page: block.attr('data-list-limit')
423		};
424		if(type == 'list'){
425			options.list_page_id = $(this).closest('.post-list').attr('data-page-id');
426		}
427		$(this).parent().remove();
428    updatePostList(block, options);
429    return false;//リンク先は処理しない
430  });
431
432});

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.