PageSourceSearch

https://bdadsnetwork.com/common/js/common.js

js bdadsnetwork.com collected 2026-10-08 13:38:56 UTC 11,863 bytes, 439 lines download raw bytes

1function sortSelect(selElem)
2        {
3                var tmpAry = new Array();
4                for (var i=0;i<selElem.options.length;i++) {
5                        tmpAry[i] = new Array();
6                        tmpAry[i][0] = selElem.options[i].text;
7                        tmpAry[i][1] = selElem.options[i].value;
8                }
9                tmpAry.sort();
10                while (selElem.options.length > 0) {
11                    selElem.options[0] = null;
12                }
13                for (var i=0;i<tmpAry.length;i++) {
14                        var op = new Option(tmpAry[i][0], tmpAry[i][1]);
15                        selElem.options[i] = op;
16                }
17                return selElem;
18        }
19
20function CreateResponsiveTable(tableid)
21{
22	if($(window).width() <768)
23	{
24    if($('#'+tableid+'-mobile').length ==0)
25    {
26        var columncount=$('#'+tableid+' tr:first td').length;
27        var rowcount=$('#'+tableid+' > tbody > tr').length;
28
29
30        $(document.createElement('table')).addClass(tableid+'-mobile').insertAfter('#'+tableid);
31
32        $('.'+tableid+'-mobile').attr('id',tableid+'-mobile');
33
34        string='';
35
36        for(i=1;i<rowcount;i++)
37        {
38            string1='';
39			flag=0;
40
41
42			tabletrid=$('#'+tableid+' tr').eq(i).attr('id');
43
44
45			if(typeof tabletrid === 'undefined')
46			stringdata='';
47			else
48			stringdata=' id="table-'+tabletrid+'" ';
49
50            string+='<tr><td><table '+stringdata+'>';
51
52
53            for(ii=0;ii<columncount;ii++)
54            {
55                headtitle=$('#'+tableid+' tr').eq(0).children("td").eq(ii).html();
56
57
58				colunmcount1=$('#'+tableid+' tr').eq(i).children("td").length;
59
60				if(colunmcount1 >1)
61				{
62
63
64					tdclass=$('#'+tableid+' tr').eq(i).children("td").eq(ii).attr('class');
65
66
67					if(typeof tdclass === 'undefined')
68					stringdata1='';
69					else
70					stringdata1=' class="'+tdclass+'" ';
71
72
73
74					contentdata=$('#'+tableid+' tr').eq(i).children("td").eq(ii).html();
75
76                	string1+='<tr '+stringdata1+'><td class="table-head-responsive">'+headtitle+'</td><td>'+contentdata+'</td></tr>';
77
78				}
79				else
80				{
81					tdclass=$('#'+tableid+' tr').eq(i).children("td").eq(0).attr('class');
82
83
84					if(typeof tdclass === 'undefined')
85					stringdata1='';
86					else
87					stringdata1=' class="'+tdclass+'" ';
88
89					contentdata=$('#'+tableid+' tr').eq(i).children("td").eq(0).html();
90
91					string1+='<tr '+stringdata1+'><td class="table-head-responsive">'+headtitle+'</td>';
92
93					if(flag ==0)
94					{
95						flag=1;
96						string1+='<td rowspan="'+columncount+'">'+contentdata+'</td>';
97
98					}
99
100					string1+='</tr>';
101				}
102            }
103            string+=string1+'</table></td></tr>';
104        }
105
106        $('#'+tableid+'-mobile').html(string);
107
108
109        $('#'+tableid).hide();
110    }
111    else
112	{
113        $('#'+tableid+'-mobile').show();
114		 $('#'+tableid).hide();
115	}
116	}
117
118	else
119	{
120	if ($('#'+tableid+'-mobile').length >0)
121	 $('#'+tableid+'-mobile').hide();
122
123	$('#'+tableid).show();
124	}
125}
126
127function set_jnotice(type,msg,imagePath = "")
128{
129	$("#system_notice_area").css({"zIndex":"12001"});
130	$("#system_notice_area").animate({
131		opacity : 'show',
132		height : 'show'
133		}, 400);
134
135	icondata = "";
136
137	if(type==0)
138	{
139		$(".system_notice_area").removeClass("system_notice_area_style1").addClass("system_notice_area_style0");
140
141		icondata = ' fa-exclamation-circle ';
142
143		icondata = '<img src="'+imagePath+'images/failure_red.png" />';
144	}
145	else
146	{
147		$(".system_notice_area").removeClass("system_notice_area_style0").addClass("system_notice_area_style1");
148
149		icondata = '<img src="'+imagePath+'images/tick_green.png" />';
150	}
151
152
153	$("#system_notice_area_tr").html('<td class="notice-icon-box">'+icondata+'</td><td class="notice-content-box">'+msg+'</td><td class="notice-close-box"><span id="system_notice_area_dismiss">X</span></td>');
154
155
156    if($('#system_notice_area').length > 0)
157    {
158	    body_width   = $('body').outerWidth();
159	    notice_width = $('#system_notice_area').outerWidth();
160
161	    width_minus  = body_width - notice_width;
162
163	    if(width_minus > 0)
164	    {
165		    width_divide = width_minus / 2;
166
167		    $('#system_notice_area').css("left",width_divide+'px');
168	    }
169	    else
170	    $('#system_notice_area').css("left",'0px');
171    }
172
173
174
175	setTimeout(function(){$("#system_notice_area").hide(200);},4000)
176
177	jQuery('#system_notice_area_dismiss').click(function() {
178		jQuery('#system_notice_area').animate({
179			opacity : 'hide',
180			height : 'hide'
181		}, 500);
182
183	});
184}
185
186
187
188function get_suggestion_result(table_name, field_name,input_value,url,type)
189{
190
191		$.ajax({
192		type: "POST",
193		url: url,
194		data:'tablename='+table_name+'&filedname='+field_name+'&inputvalue='+input_value+'&type='+type,
195		beforeSend: function(){
196			$("#"+field_name).css("background","#FFF url('images/load.gif') no-repeat 150px");
197		},
198		success: function(data)
199		{
200			$("#user-datalist").html(data);
201			$("#"+field_name).css("background","#FFF");
202		}
203		});
204
205
206}
207
208function change_theme(theme,basePath)
209{
210	document.cookie = "active_theme="+theme+"; path="+basePath;
211	location.reload();
212}
213
214function LoadLocaleFile(language,languageurl,logedin)
215{
216
217	if(language != "")
218	{
219		$.ajax(
220		{
221			type: "GET",
222			url: languageurl+language,
223			success: function(msg)
224			{
225				if(logedin == 1)
226				{
227					if($('#top-ad-iframe').length >0)
228					$('#top-ad-iframe').attr('src',$('#top-ad-iframe').attr('src'));
229
230					if($('#top-ad-iframe1').length >0)
231					$('#top-ad-iframe1').attr('src',$('#top-ad-iframe1').attr('src'));
232
233					if($('#top-adcode-iframe').length >0)
234					$('#top-adcode-iframe').attr('src',$('#top-adcode-iframe').attr('src'));
235
236					if($('#ad-keyword-iframe').length >0)
237					$('#ad-keyword-iframe').attr('src',$('#ad-keyword-iframe').attr('src'));
238
239					if($('#ad-location-iframe').length >0)
240					$('#ad-location-iframe').attr('src',$('#ad-location-iframe').attr('src'));
241
242					if($('#ad-pricing-iframe').length >0)
243					$('#ad-pricing-iframe').attr('src',$('#ad-pricing-iframe').attr('src'));
244
245					if($('#ad-position-iframe').length >0)
246					$('#ad-position-iframe').attr('src',$('#ad-position-iframe').attr('src'));
247
248					if($('#ad-category-iframe').length >0)
249					$('#ad-category-iframe').attr('src',$('#ad-category-iframe').attr('src'));
250
251					if($('#ad-device-iframe').length >0)
252					$('#ad-device-iframe').attr('src',$('#ad-device-iframe').attr('src'));
253
254					if($('#ad-time-iframe').length >0)
255					$('#ad-time-iframe').attr('src',$('#ad-time-iframe').attr('src'));
256
257
258					window.setTimeout(function(){window.location.reload();},20);
259				}
260				else
261				{
262					window.location.reload();
263				}
264			}
265		});
266	}
267}
268
269function LoadNotifications(notificationUrl)
270{
271	admvaluestring=$('#admvaluestring').val();
272
273	if(admvaluestring !="")
274	{
275		var currentcookie=Get_Cookie('adm_content');
276
277		if(currentcookie != null && currentcookie !="")
278		currentcookie=currentcookie+'-'+admvaluestring;
279		else
280		currentcookie=admvaluestring;
281
282		Set_Cookie('adm_content',currentcookie,20000,"/") ;
283
284		$('#admvaluestring').val('');
285	}
286
287	window.location.href = notificationUrl;
288}
289
290
291
292var today = new Date();
293today.setTime(today.getTime());
294today.setHours(0);
295today.setMinutes(0);
296today.setSeconds(0);
297
298function Get_Cookie( name )
299{
300	var start = document.cookie.indexOf( name + "=" );
301	var len = start + name.length + 1;
302	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) )
303	{
304		return null;
305	}
306
307	if ( start == -1 ) return null;
308	var end = document.cookie.indexOf( ";", len );
309	if ( end == -1 ) end = document.cookie.length;
310	return unescape( document.cookie.substring( len, end ) );
311}
312
313function Set_Cookie( name, value, expires, path, domain, secure )
314{
315	if(expires)
316	expires = expires * 1000 * 60 * 60 ;
317
318	var expires_date = new Date( today.getTime() + (expires) );
319	document.cookie = name + "=" +escape( value ) + ";expires=" + expires_date.toUTCString()  + ( ( path ) ? ";path=" + path : "" ) + ( ( domain ) ? ";domain=" + domain : "" ) + ( ( secure ) ? ";secure" : "" );
320}
321function manageTabClicks(from, section, tabIndex, tabCount, direction, tabPricing = "", tabIframeID = "")
322{
323  //from => admin / user
324  //section => passing action name
325
326  $('.tab-btn').removeClass('active');
327  $('.tab-btn-'+tabIndex).addClass('active');
328
329	const tabWidth             = 100 / tabCount;
330	const indicator            = document.getElementById("tabIndicator");
331
332	if(direction == 1)
333	indicator.style.right = `${tabIndex * tabWidth}%`;	
334	else
335  	indicator.style.left = `${tabIndex * tabWidth}%`;
336
337	if(section == 'ad_report' || section == 'adcode_report')
338	{
339		$('.report-div').addClass("d-none");
340		$('.graph-div-outer').addClass("d-none");
341
342		$('.report-div-'+tabPricing).removeClass("d-none");
343		$('.graph-div-outer-'+tabPricing).removeClass("d-none");
344
345		var container = document.querySelector(`#traffic-graph-${tabPricing}`);
346
347		if (!container.dataset.chartRendered)
348		{
349			trafficCharts[tabPricing].render();
350			accountsCharts[tabPricing].render();
351			container.dataset.chartRendered = "true";
352		}
353	}
354	else if(section == 'advertiser_country' || section == 'publisher_country')
355	{
356		$('.country-map-outer').addClass("d-none");
357		$('.country-map-outer-'+tabPricing).removeClass("d-none");
358
359		google.charts.setOnLoadCallback(function () { drawRegionsMap(tabPricing); });
360	}
361	else if(section == 'top_ads' || section == 'top_adcodes')
362	{
363		$('.report-div').addClass("d-none");
364		$('.report-div-'+tabPricing).removeClass("d-none");
365	}
366	else if(section == 'advertiser_statistics')
367	{
368		$('.report-div-tab').addClass("d-none");
369		$('.report-div-tab-'+tabIndex).removeClass("d-none");
370		$('#tab').val(tabIndex);
371
372		//Need to verify
373		if(document.forms['pagination1'])
374		document.forms['pagination1'].tab.value = tabIndex;
375	}
376  else if(section == 'publisher_statistics' || section == 'ad_details' || section == 'adcode_details' || section == 'site_details' || section == 'affiliate_marketplace' || section == 'referral_statistics' || section == 'conversion_code' || section == 'cpd_marketplace'  )
377  {
378		$('.report-div-tab').addClass("d-none");
379		$('.report-div-tab-'+tabIndex).removeClass("d-none");
380		$('#tab').val(tabIndex);
381	}
382
383	if(tabIframeID)
384	{
385		var contentHeight = $(".body-section").outerHeight();
386			contentHeight = parseFloat(contentHeight) + 10;
387
388		$(tabIframeID, window.parent.document).css("height", contentHeight+"px");
389  }
390}
391function resetSortIcons() {
392    document.querySelectorAll(".sort-icons i").forEach(i => i.classList.remove("sort-selected"));
393  }
394
395
396$(document).ready(function() {
397   (function()
398   {  
399
400	if($(".sortable").length > 0)
401	{
402	
403	
404	  document.querySelectorAll(".data_table td.sortable").forEach((cell, index) => {
405	    const ascIcon = cell.querySelector(".fa-sort-asc");
406	    const descIcon = cell.querySelector(".fa-sort-desc");    
407	    const form = document.getElementById("report-filter");
408
409	    if(ascIcon){
410	      ascIcon.addEventListener("click", e => {
411		e.stopPropagation();
412		resetSortIcons();
413		ascIcon.classList.add("sort-selected");
414
415		const ascColumnKey = ascIcon.getAttribute("data-column"); 
416
417		$("#sortBy").val(ascColumnKey);
418		$("#orderBy").val("asc");
419		form.submit();
420	      });
421	    }
422
423	    if(descIcon){
424	      descIcon.addEventListener("click", e => {
425		e.stopPropagation();
426		resetSortIcons();
427		descIcon.classList.add("sort-selected");
428		
429		const descColumnKey = descIcon.getAttribute("data-column"); 
430
431		$("#sortBy").val(descColumnKey);
432		$("#orderBy").val("desc");
433		form.submit();	
434	      });
435	    }
436	  });
437	}
438   })();
439});

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.