PageSourceSearch

http://www.lanaicycles.com/js/cms/item/item.js

js lanaicycles.com collected 2026-10-08 07:46:57 UTC 7,623 bytes, 300 lines download raw bytes

1//#item_
2
3function delete_item(array, verified){
4	var id = [];
5	$.each(array, function(k, v){
6		id.push(v.replace(/[^0-9]/g, ''));
7	});
8	
9	if(!id.length) return false;
10	
11	//if(!confirm(P8LANG.confirm_to_delete)) return;	
12	//var delete_hook = confirm(P8LANG.retain_hook_module_data) ? 0 : 1;
13	p8_window.confirm(P8LANG.confirm_to_delete, function (r) {
14		if(r){	
15			$.ajax({
16				url: $this_router +'-delete',
17				type: 'POST',
18				dataType: 'json',
19				data: ajax_parameters({id: id, verified: verified === undefined ? 1 : verified, delete_hook: 0}),
20				cache: false,
21				beforeSend: function(){
22					ajaxing({});
23				},
24				success: function(json){
25					ajaxing({action: 'hide'});
26					
27					for(var i in json){
28						$('#delete_'+ json[i]).parent().parent().remove();
29					}
30				}
31			});
32			return false;
33		}else{
34			return;
35		}
36	});		
37}
38
39function verify_item(array, value, verified){
40	verify_item_id = [];
41	$.each(array, function(k, v){
42		verify_item_id.push(v.replace(/[^0-9]/g, ''));
43	});
44	
45	if(!verify_item_id.length) return false;
46	verify_dialog.show();
47	
48}
49
50function list_order(array, time, verified){
51	if(!verified) return;
52	
53	up_down_id = [];
54	$.each(array, function(k, v){
55		up_down_id.push(v.replace(/[^0-9]/g, ''));
56	});
57	
58	if(!up_down_id.length) return false;
59	
60	up_down_dialog.show();
61}
62
63function move_item(array){
64	move_item_id = [];
65	$.each(array, function(k, v){
66		move_item_id.push(v.replace(/[^0-9]/g, ''));
67	});
68	
69	if(!move_item_id.length) return false;
70	
71	dialog.show();
72}
73
74function push_item(id, cid){
75	
76	$.ajax({
77		url: $this_router +'-cluster_push',
78		type: 'POST',
79		dataType: 'json',
80		data: ajax_parameters({id: id, cid: cid}),
81		cache: false,
82		beforeSend: function(){
83			ajaxing({});
84		},
85		success: function(json){
86			ajaxing({action: 'hide'});
87			
88			p8_window.alert(lang_array(P8LANG.cms.item.cluster_pushed, [json.length]));
89		}
90	});
91}
92
93function collect(id){
94	id = id.replace(/[^0-9]/g, '')*1;
95	if( id < 0) return false;
96	$.ajax({
97		url: P8CONFIG['U_controller'] + "/cms/item-favory",
98		type: 'POST',
99		data: ajax_parameters({request_type: 'add', id: id}),
100		cache: false,
101		beforeSend: function(){
102			ajaxing({});
103		},
104		success: function(data){
105			if(data == 0){
106				ajaxing({text: P8LANG.cms.item.collected, action: 'hide'});
107			}else if(data == 1){
108				ajaxing({text: P8LANG.cms.item.collect_success, action: 'hide'});
109			}else{
110				ajaxing({text: P8LANG.cms.item.collect_fail, action: 'hide'});
111			}
112		}
113	});
114}
115
116function item_operation(ele){
117	var menu = $(
118	['<ul style="position: absolute; border: 2px solid #09C; background-color: #ffffff; padding: 5px;">',
119		'<li><a href="'+ P8CONFIG.U_controller+ '/'+ SYSTEM +'/item-add?model='+ model +'&cid='+ item_cid +'" target="_blank">'+ P8LANG.add +'</a></li>',
120		'<li><a href="'+ P8CONFIG.U_controller+ '/'+ SYSTEM +'/item-update?verified='+ verified +'&id='+ item_id +'&model='+ model +'" target="_blank">'+ P8LANG.edit +'</a></li>',
121		'<li><a href="'+ P8CONFIG.U_controller+ '/'+ SYSTEM +'/item-view_frame-id-'+ item_id+'?verified='+ verified+'" target="_blank">'+ P8LANG.view_frame +'</a></li>',
122		'<li><a href="'+ P8CONFIG.U_controller+ '/'+ SYSTEM +'/item-delete?verified='+ verified +'&id='+ item_id +'&model='+ model +'" onclick="return confirm(\''+ P8LANG['delete'] +'???\');" target="_blank">'+ P8LANG['delete'] +'</a></li>',
123		'<li><a router="/'+ SYSTEM +'/item-list?verified='+ verified +'&id='+ item_id +'" target="_blank">'+ P8LANG.cms.item.more_operation +'</a></li>',
124	'</ul>'].join('')
125	);
126	
127	$(ele).click(function(){
128		var offset = $(this).offset();
129		menu.toggle().css({
130			left: offset.left +'px',
131			top: ($(this).height() + offset.top) +'px'
132		});
133		
134		if(!$(ele).data('shown')){
135			get_admin_controller(function(c){
136				menu.find("li a[router^='/']").each(function(){
137					this.href = c + $(this).attr('router');
138				});
139			});
140		}else{
141			$(ele).data('shown', 1);
142		}
143	});
144	
145	$(document.body).append(menu);
146	menu.hide();
147}
148
149
150
151function Comment(options){
152
153this.iid = options.iid;
154this.url = options.url;
155this.callback = options.callback;
156this.view_page = options.view_page || false;
157this.quotes = {};
158this.items = {};
159var _this = this;
160
161this.digg = function(id, obj){
162	var cookie = get_cookie('digged_'+ SYSTEM +'_comment') || ',';
163	if(cookie.indexOf(','+ id +',') != -1){
164		alert(P8LANG.cms.comment.digged);
165		return;
166	}
167	
168	cookie += id +',';
169	set_cookie('digged_'+ SYSTEM +'_comment', cookie);
170	$.ajax({
171		url: this.url,
172		type: 'post',
173		data: {action: 'digg', id: id},
174		success: function(status){
175			$(obj).html(
176				$(obj).html().replace(/(\d+)/g, function(s, m){return parseInt(m)+1;})
177			);
178		}
179	});
180};
181
182this.item = function(json, copy){
183	
184	var quotes = json.quote.split(',').reverse(),
185		id = json.id,
186		repeat = false;
187	
188	for(var i in this.items){
189		if(
190			this.items[id] && quotes.length > 1 &&
191			this.items[i].quote.indexOf(this.items[id].quote +',') == 0 &&
192			this.items[i].quote != this.items[id].quote
193		){
194			repeat = true;
195			break;
196		}
197	}
198	
199	var repeat_hide = $(repeat ? this._quote(quotes.slice(quotes.length -1), 1, true) :  '<div></div>');
200	repeat_hide.find('.repeat').
201		click(function(){
202			quote.show();
203			repeat_hide.hide();
204		});
205	
206	var quote = $(this._quote(quotes, quotes.length));
207	var wrapper = $('<div class="quote_wrapper"></div>').
208		append(repeat_hide).
209		append(quote[repeat ? 'hide' : 'show']());
210	
211	copy.attr('id', 'comment_'+ json.id).
212		addClass('comment_item').
213		find('.author').html(
214			copy.find('.author').html().replace('__author__', json.username)
215		);
216	
217	copy.find('.content').
218		append(wrapper).
219		append($('<div class="content">'+ nl2br(json.content) +'</div>'));
220	
221	copy.find('.date').html(
222		copy.find('.date').html().replace('__date__', date('Y-m-d H:i:s', json.timestamp))
223	);
224	
225	copy.find('.localip').html(
226		copy.find('.localip').html().replace('__localip__', json.ip)
227	);
228	
229	copy.find('.button_bar').html(
230		copy.find('.button_bar').html().replace(/__id__/g, json.id).
231		replace('__digg__', json.digg)
232	);
233	
234	return copy;
235};
236
237this._quote = function(quote_path, floor, repeat){
238	var id = quote_path.shift();
239	if(!id) return '<div></div>';
240	
241	var quote_item = this.quotes[id];
242	
243	var quote = [
244		'<div class="quote">',
245			this._quote(quote_path, floor -1),
246			'<div class="postby">',
247				'<span class="floor">', floor, '</span>',
248				'<span class="author">',
249					(quote_item ? lang_array(P8LANG[SYSTEM].comment.quote_who, [quote_item.username]) : ''),
250				'</span>',
251			'</div>',
252			'<div class="content">',
253				nl2br(quote_item ? quote_item.content : P8LANG[SYSTEM].comment.deleted),
254			'</div>',
255		'</div>'].join('');
256	
257	if(repeat){
258		quote = ['<div class="quote">', quote,
259				'<div class="repeat" style="cursor: pointer;">',
260					P8LANG[SYSTEM].comment.repeat,
261				'</div>',
262			'</div>'].join('');
263	}
264	
265	return quote;
266};
267
268this._callback = function(json){
269	
270	ajaxing({action: 'hide'});
271	
272	_this.quotes = json.quotes;
273	_this.items = json.items;
274	
275	_this.callback(json);
276};
277
278this.request = function(page){
279	page = page === undefined ? 1 : intval(page);
280	page = Math.max(page, 1);
281	
282	ajaxing({});
283	
284	$.getJSON(
285		this.url +'?iid='+ this.iid +'&page='+ page +'&_ajax_request=1'+ (this.view_page ? '&view_page=1' : '') +'&callback=?',
286		this._callback);
287};
288
289}
290
291function viewcount(id){
292    $.get(P8CONFIG.RESOURCE+'/search/count.php?id='+id,function(ret){
293        $('.item_views').each(function(){$(this).html(parseInt(ret['views']))});
294        $('.item_comments').each(function(){$(this).html(parseInt(ret['comments']))});
295    },'json')
296}
297
298$(function(){
299    $('.priview_image').click(function(){ window.open($(this).attr('src').replace('.cthumb.jpg','')) })
300})

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.