1//var zoom = document.documentElement.clientWidth / window.innerWidth; 2var url_root = location.protocol + '//' + location.hostname; 3 4/*if("Audio" in window){ 5 var msgbeep = new Audio(); 6 if(!!(msgbeep.canPlayType && msgbeep.canPlayType('audio/ogg; codecs="vorbis"').replace(/no/, ''))){ 7 msgbeep.src = url_root + '/assets/sounds/glass.ogg'; 8 } 9 else if(!!(msgbeep.canPlayType && msgbeep.canPlayType('audio/mpeg;').replace(/no/, ''))) 10 msgbeep.src = url_root + '/assets/sounds/glass.mp3'; 11 else if(!!(msgbeep.canPlayType && msgbeep.canPlayType('audio/mp4; codecs="mp4msgbeep.40.2"').replace(/no/, ''))) 12 msgbeep.src = url_root + '/assets/sounds/glass.aac'; 13 else { 14 msgbeep.src = url_root + '/assets/sounds/glass.mp3'; 15 } 16}*/ 17 18 19 20//audioElement.setAttribute('autoplay', 'autoplay'); 21 22function redirectifLoggedin($code){ // redirect to login 23 if($code=="login"){ 24 window.location.href = url_root + "/members/login.php?cb=" + encodeURIComponent(window.location.href); 25 } 26} 27 28$(document).on('click', '.fAdPst',function() { 29 var href = $(this).attr('data-href'); 30 if(href == ''){ 31 return false; 32 } 33 window.location.href = href; 34}); 35 36var msg_notify_refresh; 37var msg_notify_lastchecked = Math.floor($.now() / 1000); 38function checkUnreadmessages(loop, callback){ 39 currtimestamp = msg_notify_lastchecked; 40 var parameters = {timestamp:currtimestamp,check:'unreadmsgs'}; 41 $.ajax({ 42 type: "POST", 43 data: parameters, 44 cache: false, 45 url: window.location.href, 46 success: function(msgcount){ 47 var currCount = localStorage.getItem('msgcount'); 48 if (typeof msgcount === "undefined" || msgcount === null) { 49 if (typeof currCount === "undefined" || currCount === null) { 50 msgcount = 0; 51 } 52 else{ 53 msgcount = currCount; 54 } 55 } 56 else{ 57 msgcount = parseInt(msgcount); 58 } 59 var returnval = 0; 60 if(isNaN(msgcount)){ 61 msgcount = 0; 62 } 63/* if(msgcount != currCount){ 64 localStorage.setItem('msgcount',msgcount); 65 returnval = 1; 66 msg_notify_lastchecked = Math.floor($.now() / 1000); 67 if(msgcount < 1 ){ 68 $("#topbar .msg-badge, .navbar-header .msg-badge, li.messageicon .msg-badge").html('0'); 69 $("#topbar .msg-badge, .navbar-header .msg-badge, li.messageicon .msg-badge").addClass("hidden"); 70 } 71 else if(msgcount > currCount){ 72 msgbeep.play(); 73 $("#topbar .msg-badge, .navbar-header .msg-badge, li.messageicon .msg-badge").html(msgcount); 74 $("#topbar .msg-badge, .navbar-header .msg-badge, li.messageicon .msg-badge").removeClass("hidden"); 75 } 76 else{ 77 $("#topbar .msg-badge, .navbar-header .msg-badge, li.messageicon .msg-badge").html(msgcount); 78 } 79 }*/ 80 if(msgcount != currCount){ 81 localStorage.setItem('msgcount',msgcount); 82 returnval = 1; 83 msg_notify_lastchecked = Math.floor($.now() / 1000); 84 if(msgcount < 1 ){ 85 $("#topbar .msg-badge-pm, .navbar-header .msg-badge-pm, li.messageicon .msg-badge-pm").html('0'); 86 $("#topbar .msg-badge-pm, .navbar-header .msg-badge-pm, li.messageicon .msg-badge-pm").addClass("hidden"); 87 } 88 else if(msgcount > currCount){ 89 msgbeep.play(); 90 $("#topbar .msg-badge-pm, .navbar-header .msg-badge-pm, li.messageicon .msg-badge-pm").html(msgcount); 91 $("#topbar .msg-badge-pm, .navbar-header .msg-badge-pm, li.messageicon .msg-badge-pm").removeClass("hidden"); 92 } 93 else{ 94 $("#topbar .msg-badge-pm, .navbar-header .msg-badge-pm, li.messageicon .msg-badge-pm").html(msgcount); 95 } 96 } 97 callback(returnval); 98 }, 99 error: function (xhr, ajaxOptions, thrownError) { 100 console.log('error'); 101 console.log(xhr.status); 102 console.log(thrownError); 103 } 104 }).complete(function(){ 105 if(loop){ 106 //msg_notify_refresh = window.setTimeout(function(){checkUnreadmessages(1,function(count){});}, 10000); 107 } 108 }); 109 110} 111 112 113window.addEventListener('storage', storage_handler, false); 114 115function storage_handler(evt){ // when localstorage value changed 116 if (evt.key == 'msgcount') { 117 currCount = evt.oldValue; 118 msgcount = evt.newValue; 119 if (typeof msgcount === "undefined" || msgcount === null) { 120 if (typeof currCount === "undefined" || currCount === null) { 121 msgcount = 0; 122 } 123 else{ 124 msgcount = currCount; 125 } 126 } 127 if(isNaN(msgcount)){ 128 msgcount = 0; 129 } 130 if(msgcount < 1 ){ 131 $("#topbar .msg-badge-pm, .navbar-header .msg-badge-pm, li.messageicon .msg-badge-pm").html('0'); 132 $("#topbar .msg-badge-pm, .navbar-header .msg-badge-pm, li.messageicon .msg-badge-pm").addClass("hidden"); 133 } 134 else if(msgcount > currCount){ 135 136 $("#topbar .msg-badge-pm, .navbar-header .msg-badge-pm, li.messageicon .msg-badge-pm").html(msgcount); 137 $("#topbar .msg-badge-pm, .navbar-header .msg-badge-pm, li.messageicon .msg-badge-pm").removeClass("hidden"); 138 } 139 else{ 140 $("#topbar .msg-badge-pm, .navbar-header .msg-badge-pm, li.messageicon .msg-badge-pm").html(msgcount); 141 } 142 } 143} 144 145var manageAdsCommand = function(_data) { // processing manage ad action 146 $.ajax({ 147 type: "POST", 148 dataType: "json", 149 url: url_root + "/marketplace/ajax-common-commands.php", 150 data: _data, 151 success: function(data) { 152 var _refresh = false;
153 if(data['retval'] == 'success'){ 154 _refresh = true; 155 } else if(data['retval'] == 0){ 156 window.location = "http://www.togoparts.com/members/add_credits.php"; 157 } 158 159 if($.inArray( "msg", data ) && data['msg'] != "" ){ 160 if(_data.action == 'sold'){ 161 //if(typeof(_data.ids) !== 'undefined'){ 162// var aid = _data.ids; 163// } 164// else{ 165// var aid = _data.id; 166// } 167// 168// var _url = url_root + '/members/rate-user.php?aids=' + aid + '&type=sold'; 169// openRateModal(_url); 170 modalAlert(data['msg'], true); 171 } 172 else{ 173 modalAlert(data['msg'], _refresh); 174 } 175 } 176 else if(_refresh == true){ 177 top.location.reload(); 178 } 179 } 180 }); 181}; 182 183var manageAdsCommandSold = function(_data) { // processing manage ad action for sold 184 $.ajax({ 185 type: "POST", 186 dataType: "json", 187 url: url_root + "/marketplace/ajax-common-commands.php", 188 data: _data, 189 success: function(data) { 190 var _refresh = false; 191 if(data['retval'] == 'success'){ 192 _refresh = true; 193 } 194 if($.inArray( "msg", data ) && data['msg'] != "" ){ 195 modalAlert(data['msg'], _refresh); 196 } 197 else if(_refresh == true){ 198 top.location.reload(); 199 } 200 } 201 }); 202}; 203 204function supports_history_api() { 205 return !!(window.history && history.pushState); 206} 207 208function openRateModal(_url){ 209 var modalcontent = '<div class="modal fade" id="rateModal" ><div class="modal-dialog"><div class="modal-content"></div></div></div>'; 210 var rateModal = $(modalcontent); 211 rateModal.modal({backdrop: 'static',keyboard:false, remote: _url}) ; 212 rateModal.modal('show').on('hidden.bs.modal', function() { 213 rateModal.removeData('bs.modal'); 214 }); 215} 216 217function confirmRefreshAction(heading, credits, count, cancelButtonTxt, okButtonTxt, callback, _data, onclose) { 218 var buttonState = ''; 219 220 if (typeof onclose === "undefined" || onclose === null) { 221 onclose = $.noop; 222 } 223 var modalcontent = '<div class="modal fade confirm-box">' + 224 '<div class="modal-dialog"><div class="modal-content"><div class="modal-header">' + 225 '<a class="close" data-dismiss="modal" >×</a>' + 226 '<h3>' + heading +'</h3>' + 227 '</div>' + 228 '<div class="modal-body alert-primary" style="text-align: center;">' + 229 '<p><strong>You have ' + credits + ' T-Credits.</strong></p>' + 230 '<p><strong>Refreshing ' + count + ' ad(s) will use ' + count + ' T-credit(s).</strong></p>'; 231 232 if (credits < count) { 233 modalcontent += '<p class="text-danger">' + 234 '<strong>'+ 235 'Opps! You have insufficient T-credits.<br>' + 236 '<a href="' + url_root + '/members/add_credits.php">Buy some here</a>' + 237 '</strong>' + 238 '</p>'; 239 } 240 241 if (credits < count || count <= 0) { 242 buttonState = 'disabled'; 243 } 244 245 modalcontent += '</div>' + 246 '<div class="modal-footer">'; 247 248 if(okButtonTxt != ""){ 249 modalcontent += '<button id="okButton" class="btn btn-primary"' + buttonState + '>' + 250 okButtonTxt + 251 '</button>'; 252 } 253 254 modalcontent += '<button class="btn btn-default" data-dismiss="modal">' + 255 cancelButtonTxt + 256 '</button>' + 257 '</div></div></div>' + 258 '</div>'; 259 260 var confirmModal = $(modalcontent); 261 262 confirmModal.find('#okButton').click(function(event) { 263 callback(_data); 264 confirmModal.modal('hide'); 265 }); 266 confirmModal.modal({backdrop: 'static',keyboard:false}) ; 267 confirmModal.modal('show').on('hidden.bs.modal', function() { 268 onclose() 269 }); 270} 271 272function confirmAction(heading, question, cancelButtonTxt, okButtonTxt, callback,_data, onclose) { 273 if (typeof onclose === "undefined" || onclose === null) { 274 onclose = $.noop; 275 } 276 var modalcontent = '<div class="modal fade confirm-box">' + 277 '<div class="modal-dialog"><div class="modal-content"><div class="modal-header">' + 278 '<a class="close" data-dismiss="modal" >×</a>' + 279 '<h3>' + heading +'</h3>' + 280 '</div>' + 281 282 '<div class="modal-body alert-primary">' + 283 '<p><strong>' + question + '</strong></p>' + 284 '</div>' + 285 286 '<div class="modal-footer">'; 287 if(okButtonTxt != ""){ 288 modalcontent = modalcontent + '<button id="okButton" class="btn btn-primary">' + 289 okButtonTxt + 290 '</button>'; 291 } 292 293 modalcontent = modalcontent + '<button class="btn btn-default" data-dismiss="modal">' +
294 cancelButtonTxt + 295 '</button>' + 296 '</div></div></div>' + 297 '</div>'; 298 299 var confirmModal = 300 $(modalcontent); 301 302 confirmModal.find('#okButton').click(function(event) { 303 callback(_data); 304 confirmModal.modal('hide'); 305 }); 306 confirmModal.modal({backdrop: 'static',keyboard:false}) ; 307 confirmModal.modal('show').on('hidden.bs.modal', function() { 308 onclose() 309 }); 310} 311 312 313function modalAlert(message, refreshpage, modalsize, _modalclass) { 314 if (typeof modalsize === "undefined" || modalsize === null) { 315 modalsize = ""; 316 } 317 var confirmModal = 318 $('<div class="modal fade confirm-box">' + 319 '<div class="modal-dialog ' + modalsize + '"><div class="modal-content">' + 320 321 '<div class="modal-body ' + _modalclass + '"><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>' + 322 '<div><strong>' + message + '</strong></div>' + 323 '</div>' + 324 325 '</div></div>' + 326 '</div>'); 327 328 confirmModal.modal('show').on('hidden.bs.modal', function() { 329 if(refreshpage == true){ 330 top.location.reload(); 331 } 332 }); 333} 334 335function onBrowserResize(){ 336 var width = $(document).width(); 337 if( width >= 768 ){ 338 $("#custom-bootstrap-menu").addClass('navbar-static-top').removeClass('navbar-fixed-top'); 339 $("#custom-bootstrap-menu .nav").addClass('nav-justified').removeClass('navbar-nav'); 340 341 $("#custom-bootstrap-menu-new").addClass('navbar-static-top').removeClass('navbar-fixed-top'); 342 $("#custom-bootstrap-menu-new").addClass('nav-justified').removeClass('navbar-nav'); 343 344 var floating_box_width = $('#sidebar-floating-box').outerWidth(true); 345 346 $('#sidebar-floating-box').affix({ 347 offset: { 348 top: function () { 349 return (this.top = $('.sidebar-floating-box-container').outerHeight(true) + $('.leaderboard-banner').outerHeight(true) + $('#topbar').outerHeight(true) + $('#searchbar').outerHeight(true) + $('.navbar-wrapper').outerHeight(true) - $('#sidebar-floating-box').outerHeight(true)) 350 }, 351 bottom: function () { 352 return (this.bottom = $('#footer').outerHeight(true)); 353 } 354 }, 355 }); 356 357 $('#sidebar-floating-box').on('affix.bs.affix', function () { 358 $('#sidebar-floating-box').css('width', floating_box_width); 359 }); 360 } 361 if( width < 768 ){ 362 $("#custom-bootstrap-menu").addClass('navbar-fixed-top').removeClass('navbar-static-top'); 363 $("#custom-bootstrap-menu .nav").addClass('navbar-nav').removeClass('nav-justified'); 364 365 $("#custom-bootstrap-menu-new").addClass('navbar-static-top').removeClass('navbar-fixed-top'); 366 $("#custom-bootstrap-menu-new").addClass('nav-justified').removeClass('navbar-nav'); 367 } 368 /* var zoomNew = document.documentElement.clientWidth / window.innerWidth; 369 if (zoom != zoomNew) { 370 // zoom has changed 371 // adjust your fixed element 372 zoom = zoomNew 373 }*/ 374} 375 376function getQueryVariable(variable) 377{ 378 var query = window.location.search.substring(1); 379 var vars = query.split("&"); 380 for (var i=0;i<vars.length;i++) { 381 var pair = vars[i].split("="); 382 if(pair[0] == variable){return pair[1];} 383 } 384 return(false); 385} 386 387 388$(window).resize(function() { 389 onBrowserResize(); 390}); 391 392$(document).on('click', '.panel-heading span.clickable', function(e){ 393 var $this = $(this); 394 if(!$this.hasClass('panel-collapsed')) {
395 $this.parents('.panel').find('.panel-body').slideUp(); 396 $this.addClass('panel-collapsed'); 397 $this.find('i').removeClass('glyphicon-chevron-up').addClass('glyphicon-chevron-down'); 398 } else { 399 $this.parents('.panel').find('.panel-body').slideDown(); 400 $this.removeClass('panel-collapsed'); 401 $this.find('i').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up'); 402 } 403}); 404 405// $(document).on('click', '.shortlist-btn',function(e) { 406// e.stopPropagation(); 407// }); 408 409 410$( ".shortlist-btn" ).click(function( event ) { 411 event.stopPropagation(); 412 413 $thisbtn = $( this ); 414 $aid = $thisbtn.data( "val" ); 415 $.ajax ({ 416 type: "post", 417 data: {aid: $aid}, 418 url: url_root + "/marketplace/ajax_addtobasket_new.php", 419 dataType: "json", 420 cache: false, 421 success: function(data) { 422 if(data.result == "added"){ 423 $thisbtn.addClass('btn-danger'); 424 $thisbtn.removeClass('btn-warning'); 425 $('.shortlist-number2').removeClass('hidden'); 426 $('.shortlist-number2').text(parseInt($('.shortlist-number2').text()) + 1) ; 427 console.log("SA"); 428 }else if(data.result == "removed"){ 429 $thisbtn.addClass('btn-warning'); 430 $thisbtn.removeClass('btn-danger'); 431 $('.shortlist-number2').text(parseInt($('.shortlist-number2').text()) - 1) ; 432 if(parseInt($('.shortlist-number2').text()) == 0) { 433 $('.empty-list').removeClass('hidden'); 434 $('.shortlist-number2').addClass('hidden'); 435 } 436 } 437 else if(data.result == "login"){ 438 $url = url_root + "/members/login.php?cb=" + encodeURIComponent($(location).attr('href')); 439 modalAlert('<div>Not Logged in! You need to log in to shortlist ad. <a href="'+ $url +'" class="btn btn-warning btn-xs">Login</a></div>',false); 440 441 console.log('ersj'); 442 443 } 444 else if(data.result == "error" && data.msg != "" ){ 445 modalAlert(data.msg,false); 446 447 console.log('error j'); 448 } 449 }, 450 error: function(XMLHttpRequest, textStatus, errorThrown) { 451 console.log('error found'); 452 } 453 }); 454}); 455 456$( ".shortlist-btn2" ).click(function( event ) { 457// console.log('clicked'); 458 event.stopPropagation(); 459 $thisbtn = $( this ); 460 var mBL = $(this).attr('data-wbvd'); 461 var inSession = $(this).attr('data-inSession'); 462 if(inSession == 'ol'){ 463 $aid = $thisbtn.data( "val" ); 464 var aid = $(this).data("val"); 465 $.ajax ({ 466 type: "post", 467 data: {aid: $aid}, 468 url: url_root + "/marketplace/ajax_addtobasket_new.php", 469 dataType: "json", 470 cache: false, 471 success: function(data) { 472 console.log(data); 473 if(data.result == "added"){ 474 var nMLke = $("#NumshrtLke_"+aid).text(); 475 if(nMLke==0){ 476 $("#NumshrtLke_"+aid).css("display",""); 477 } 478 $("#NumshrtLke_"+aid).text(parseInt(nMLke) + 1); 479 $("#shrtLke_"+aid + " path").css("fill","#c00"); 480 //$thisbtn.addClass('btn-danger'); 481 //$thisbtn.removeClass('btn-default'); 482 $thisbtn.addClass('shortlist-added'); 483 $('.shortlist-number2').removeClass('hidden'); 484 $('.shortlist-number').removeClass('hidden'); 485 $('.shortlist-number2').text(parseInt($('.shortlist-number2').text()) + 1); 486 $('.shortlist-number').text(parseInt($('.shortlist-number').text()) + 1); 487 // $(this).children('i.fa').removeClass('fa-heart-o').removeClass('colorwhite').addClass('fa-heart'); 488 } else if(data.result == "removed"){ 489 var nMLke = $("#NumshrtLke_"+aid).text(); 490 $("#NumshrtLke_"+aid).css("display",parseInt(nMLke)-1==0?"none":""); 491 $("#NumshrtLke_"+aid).text(parseInt(nMLke) - 1); 492 $("#shrtLke_"+aid + " path").css("fill","#fff"); 493 //$thisbtn.addClass('btn-default'); 494 //$thisbtn.removeClass('btn-danger'); 495 $thisbtn.removeClass('shortlist-added'); 496 $('.shortlist-number2').text(parseInt($('.shortlist-number2').text()) - 1); 497 $('.shortlist-number').text(parseInt($('.shortlist-number').text()) - 1); 498 if(parseInt($('.shortlist-number2').text()) == 0) { 499 $('.empty-list').removeClass('hidden'); 500 $('.shortlist-number2').addClass('hidden'); 501 } 502 if(parseInt($('.shortlist-number').text()) == 0) { 503 $('.empty-list').removeClass('hidden'); 504 $('.shortlist-number').addClass('hidden'); 505 } 506 $(".shortListedItemsCtr #shrtAd_" + aid).fadeOut('slow',function(){ 507 $(this).remove(); 508 }); 509 // $(this).children('i.fa').removeClass('fa-heart').addClass('colorwhite').addClass('fa-heart-o'); 510 } 511 else if(data.result == "login"){ 512 // $url = url_root + "/members/login.php?cb=" + encodeURIComponent($(location).attr('href')); 513 // modalAlert('<div>Not Logged in! You need to log in to shortlist ad. <a href="'+ $url +'" class="btn btn-warning btn-xs">Login</a></div>',false); 514 $("#login-modal").modal('show'); 515 console.log("showFlutterLogin"); 516 } 517 else if(data.result == "error" && data.msg != "" ){ 518 modalAlert(data.msg,false); 519 } 520 }, 521 error: function(XMLHttpRequest, textStatus, errorThrown) { 522 // 523 console.log("showFlutterLogin"); 524 } 525 }); 526 }else{ 527 console.log("showFlutterLogin"); 528 } 529}); 530 531 532 533// $(document).on('click', '.shortlist-btn2', function(e) { 534// e.stopPropagation(); 535// }); 536 537$(document).on('click', '.slistBtnDet',function() { 538 $thisbtn = $( this ); 539 var mBL = $(this).attr('data-wbvd'); 540 var inSession = $(this).attr('data-inSession'); 541 $aid = $(this).attr('data-val'); 542 if(inSession == 'ol'){ 543 $.ajax ({ 544 type: "post", 545 data: {aid: $aid}, 546 url: url_root + "/marketplace/ajax_addtobasket_new.php", 547 dataType: "json", 548 cache: false, 549 success: function(data) { 550 if(data.result == "added"){ 551 //$thisbtn.addClass('btn-danger'); 552 //$thisbtn.removeClass('btn-default'); 553 $thisbtn.addClass('shortlist-added'); 554 $thisbtn.html('<i class="fa fa-heart" style="color:#fff;"></i> Saved'); 555 } 556 else if(data.result == "removed"){ 557 //$thisbtn.addClass('btn-default'); 558 //$thisbtn.removeClass('btn-danger'); 559 $thisbtn.removeClass('shortlist-added'); 560 $thisbtn.html('<i class="fa fa-heart" style="color:#000;"></i> Save'); 561 // $(this).children('i.fa').removeClass('fa-heart').addClass('colorwhite').addClass('fa-heart-o'); 562 } 563 else if(data.result == "login"){ 564 $url = url_root + "/members/login.php?cb=" + encodeURIComponent($(location).attr('href')); 565 modalAlert('<div>Not Logged in! You need to log in to shortlist ad. <a href="'+ $url +'" class="btn btn-warning btn-xs">Login</a></div>',false); 566 console.log("showFlutterLogin"); 567 568 } 569 else if(data.result == "error" && data.msg != "" ){ 570 modalAlert(data.msg,false); 571 console.log("Not Login"); 572 } 573 }, 574 error: function(XMLHttpRequest, textStatus, errorThrown) { 575 console.log("showFlutterLogin"); 576 } 577 }); 578 }else{ 579 console.log("showFlutterLogin"); 580 } 581}); 582 583$(document).ready(function() { 584 onBrowserResize(); 585 586 $('[data-toggle=offcanvas]').click(function() { 587 $('.row-offcanvas').toggleClass('active'); 588 if($( ".row-offcanvas" ).hasClass( "active" )){ 589 $('body').css("overflow", "hidden"); 590 } 591 else{ 592 $('body').css("overflow", ""); 593 } 594 }); 595 $('body').on("click",".rate-user",function(e) { 596 e.preventDefault(); 597 var _url = $(this).prop('href'); 598 openRateModal(_url); 599 }); 600 $('.caret1').click(function(){}); /* Require for the dropdown to work in iOS Safari*/ 601 $('.search-toggle').click(function() { 602 $('#searchbar').toggleClass('active'); 603 }); 604 $("#custom-bootstrap-menu.navbar-static-top").affix({offset: { top: 252 }}); 605 $("#custom-bootstrap-menu-new.navbar-static-top").affix({offset: { top: 252 }}); 606 607 608 $('.btn-manage-action').click(function() { 609 _this = $(this); 610 var _data = _this.data("val"); 611 _question = _data.question; 612 613 confirmAction("Confirm Action", _question, "Cancel", "Yes", manageAdsCommand,_data ); 614 }); 615}); 616 617/* start of legacy JS in menubar_long */ 618function linkedImageMaxSize() { 619 var img; 620 var imgRatio; 621 var maxWidth = 450; 622 var maxHeight = 450; 623 for (i = 0; i < document.images.length; i++) { 624 if(document.images[i].name == "linkedImage"){ 625 img = document.images[i]; 626 imgRatio = img.width / img.height; 627 if (img.width > maxWidth) { 628 img.width = maxWidth; 629 img.height = maxWidth / imgRatio; 630 } 631 if (img.height > maxHeight) { 632 img.height = maxHeight; 633 img.width = maxHeight * imgRatio; 634 } 635 } 636 } 637} 638function popUpWin_pm(addy) { 639 newWindow = window.open(addy,"pm","width=760,height=580,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=0,copyhistory=0,resizable=0"); 640} 641 642function popUpWin_pm_quickcontact(addy) { 643 newWindow = window.open(addy,"pm_quickcontact","width=160,height=580,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=1,copyhistory=0,resizable=0"); 644} 645 646function popUpWin(addy) { 647 newWindow = window.open(addy,"UserInfo","width=550,height=600,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=1,copyhistory=0,resizable=0"); 648} 649 650function popUpWinFMA(addy, width, height) { 651 newWindow = window.open(addy,"ItemImage","width="+width+",height="+height+",toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=0,copyhistory=0,resizable=0"); 652} 653 654function popUpWin_usersonline(addy) { 655 newWindow = window.open(addy,"usersonline","width=160,height=500,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=1,copyhistory=0,resizable=0"); 656} 657 658$.fn.hoverClass = function(c) { 659 return this.each(function(){ 660 $(this).hover( function() { 661 $(this).addClass(c); 662 }, 663 function() { 664 $(this).removeClass(c); 665 }); 666 }); 667}; 668$(document).ready(function(){ 669 $("#van-one li").hover(function(){ 670 $("ul", this).fadeIn("slow"); 671 }, 672 function(){}); 673 if (document.all) { 674 $("#van-one li").hoverClass("sfHover"); 675 } 676}); 677/* end of legacy JS */ 678 679/*$('.btn-follow').on('click', function(){ 680 var btn = $(this); 681 var fid = $(this).data('fid'); 682 var ufid = $(this).data('ufid'); 683 var ftcount = $(this).data('fcount'); 684 var fcount = parseInt($(this).attr('data-fcount')); 685 var fpcount = fcount + 1; 686 var fmcount = fcount - 1; 687 688 $.ajax({ 689 method: 'POST', 690 url: url_root + '/common/ajax-follow.php', 691 data: { follow_id: fid, ufid: ufid }, 692 success: function(response){ 693 if(response == 'Unfollow') { 694 if(ftcount > 0) { 695 btn.html('<i class="icon2-useradd" aria-hidden="true"></i> Follow <span class="badge msg-badge">'+ fmcount + '</span>'); 696 } else { 697 btn.html('<i class="icon2-useradd" aria-hidden="true"></i> Follow'); 698 } 699 btn.attr('data-fcount', fmcount); 700 btn.data('ufid', 0); 701 btn.removeClass('followed'); 702 } else if(response > 0) { 703 btn.html('<i class="icon2-users" aria-hidden="true"></i>
703 Following <span class="badge msg-badge">'+ fpcount + '</span>'); 704 btn.data('ufid', response); 705 btn.attr('data-fcount', fpcount); 706 btn.addClass('followed'); 707 } 708 } 709 }); 710}); 711*/ 712 713$(document).on('click', '.btn-follow', function(){ 714 console.log("click"); 715 var btn = $(this); 716 var fid = $(this).data('fid');//bikeshop unique id: sid table 717 var ufid = $(this).data('ufid'); 718 var ftcount = $(this).data('fcount'); 719 var fcount = parseInt($(this).attr('data-fcount')); 720 var fpcount = fcount + 1; 721 var fmcount = fcount - 1; 722 // console.log("Merchant-ID:"+fid,"Follow UserF:"+ufid); 723 $.ajax({ 724 method: 'POST', 725 url: url_root + '/common/ajax-follow.php', 726 data: { follow_id: fid, ufid: ufid }, 727 success: function(response){ 728 if(response == 'Unfollow') { 729 if(ftcount > 0) { 730 // <span class="badge msg-badge">'+ fmcount + '</span> 731 btn.html('<i class="icon2-useradd" aria-hidden="true"></i> Follow'); 732 } else { 733 btn.html('<i class="icon2-useradd" aria-hidden="true"></i> Follow'); 734 } 735 btn.attr('data-fcount', fmcount); 736 btn.data('ufid', 0); 737 btn.removeClass('followed'); 738 } else if(response > 0) { 739 // <span class="badge msg-badge">'+ fpcount + '</span> 740 btn.html('<i class="icon2-users" aria-hidden="true"></i> Following'); 741 btn.data('ufid', response); 742 btn.attr('data-fcount', fpcount); 743 btn.addClass('followed'); 744 } 745 } 746 }); 747}); 748 749$(document).on('click', '.ushpFollowBtn', function(){ 750 var btn = $(this); 751 var fid = $(this).data('fid');//bikeshop unique id: sid table 752 var ufid = $(this).data('ufid'); 753 var inSession = $(this).attr('data-inSession'); 754 if(inSession == 'nl'){ 755 console.log("showFlutterLogin"); 756 }else{ 757 $.ajax({ 758 method: 'POST', 759 url: url_root + '/common/ajax-follow.php', 760 data: { follow_id: fid, ufid: ufid }, 761 success: function(response){ 762 if(response == 'Unfollow') { 763 btn.text('Follow'); 764 btn.data('ufid', 0); 765 btn.removeClass('followed'); 766 } else if(response > 0) { 767 btn.text('Following'); 768 btn.data('ufid', response); 769 btn.addClass('followed'); 770 } else if(response == 0){ 771 console.log("showFlutterLogin"); 772 } 773 }, 774 error: function(){ 775 console.log("Not"); 776 } 777 }); 778 } 779}); 780 781 782$('.btn-follow-user').on('click', function(){ 783 var btn = $(this); 784 var fid = $(this).data('fid'); 785 var ufid = $(this).data('ufid'); 786 var sname = $(this).data('sname'); 787 console.log("clisssck"); 788 789 $.ajax({ 790 method: 'POST', 791 url: url_root + '/common/ajax-follow.php', 792 data: { follow_id: fid, ufid: ufid }, 793 success: function(response){ 794 if(response == 'Unfollow') { 795 btn.html('<i class="icon2-useradd" aria-hidden="true"></i> Follow' + ' ' + sname ); 796 btn.data('ufid', 0); 797 btn.removeClass('followed'); 798 } else if(response > 0) { 799 btn.html('<i class="icon2-users" aria-hidden="true"></i> Following' + ' ' + sname); 800 btn.data('ufid', response); 801 btn.addClass('followed'); 802 } 803 } 804 }); 805}); 806 807$('.btn-follow-noicon').on('click', function(){ 808 var btn = $(this); 809 var fid = $(this).data('fid'); 810 var ufid = $(this).data('ufid'); 811 812 $.ajax({ 813 method: 'POST', 814 url: url_root + '/common/ajax-follow.php', 815 data: { follow_id: fid, ufid: ufid }, 816 success: function(response){ 817 if(response == 'Unfollow') { 818 btn.html(' Follow'); 819 btn.data('ufid', 0); 820 btn.removeClass('followed'); 821 } else if(response > 0) { 822 btn.html(' Following'); 823 btn.data('ufid', response); 824 btn.addClass('followed'); 825 } 826 } 827 }); 828}); 829 830$('.btn-follow-new').on('click', function(){ 831 var btn = $(this); 832 var fid = $(this).data('fid'); 833 var ufid = $(this).data('ufid'); 834 var ftcount = $(this).data('fcount'); 835 var fcount = parseInt($(this).attr('data-fcount')); 836 var fpcount = fcount + 1; 837 var fmcount = fcount - 1; 838 839 $.ajax({ 840 method: 'POST', 841 url: url_root + '/common/ajax-follow.php', 842 data: { follow_id: fid, ufid: ufid }, 843 success: function(response){ 844 if(response == 'Unfollow') { 845 if(ftcount > 0) { 846 btn.html('<i class="icon2-useradd" aria-hidden="true"></i> Follow <span class="badge msg-badge">'+ fmcount + '</span>'); 847 } else { 848 btn.html('<i class="icon2-useradd" aria-hidden="true"></i> Follow'); 849 } 850 btn.attr('data-fcount', fmcount); 851 btn.data('ufid', 0); 852 btn.removeClass('followed'); 853 } else if(response > 0) { 854 btn.html('<i class="icon2-users" aria-hidden="true"></i>
854 Following <span class="badge msg-badge">'+ fpcount + '</span>'); 855 btn.data('ufid', response); 856 btn.attr('data-fcount', fpcount); 857 btn.addClass('followed'); 858 } 859 } 860 }); 861}); 862 863$('.btn-follow-new2').on('click', function(){ 864 var btn = $(this); 865 var fid = $(this).data('fid'); 866 var ufid = $(this).data('ufid'); 867 var ftcount = $(this).data('fcount'); 868 var fcount = parseInt($(this).attr('data-fcount')); 869 var fpcount = fcount + 1; 870 var fmcount = fcount - 1; 871 872 $.ajax({ 873 method: 'POST', 874 url: url_root + '/common/ajax-follow.php', 875 data: { follow_id: fid, ufid: ufid }, 876 success: function(response){ 877 if(response == 'Unfollow') { 878 if(ftcount > 0) { 879 btn.html('<i class="icon2-useradd" aria-hidden="true"></i> Follow <span class="custom-badge">'+ fmcount + '</span>'); 880 } else { 881 btn.html('<i class="icon2-useradd" aria-hidden="true"></i> Follow'); 882 } 883 btn.attr('data-fcount', fmcount); 884 btn.data('ufid', 0); 885 btn.removeClass('followed'); 886 } else if(response > 0) { 887 btn.html('<i class="icon2-users" aria-hidden="true"></i>
887 Following <span class="custom-badge">'+ fpcount + '</span>'); 888 btn.data('ufid', response); 889 btn.attr('data-fcount', fpcount); 890 btn.addClass('followed'); 891 } 892 } 893 }); 894}); 895 896$(document).on('click', '.btn-activity-like', function(){ 897 console.log("click"); 898 var btn = $(this); 899 var lid = $(this).data('lid'); 900 var owner_userid = $(this).data('ownerid'); 901 var activity_id = $(this).data('activityid'); 902 var external_id = $(this).data('externalid'); 903 var cid = $(this).data('cid'); 904 var atcount = $(this).data('acount'); 905 var acount = parseInt($(this).attr('data-acount')); 906 var apcount = acount + 1; 907 var amcount = acount - 1; 908 909 if(external_id == 'undefined' || external_id == null){ 910 external_id = 0; 911 } 912 913 $.ajax({ 914 method: 'POST', 915 url: url_root + '/common/ajax-activity-like.php', 916 data: { lid: lid, owner_userid: owner_userid, activity_id: activity_id, cid: cid, external_id : external_id }, 917 success: function(response){ 918 if(response == 'Unlike') { 919 if(atcount > 0) { 920 btn.html('<i class="fa fa-thumbs-o-up" aria-hidden="true"></i> ' + amcount); 921 } else { 922 btn.html('<i class="fa fa-thumbs-o-up" aria-hidden="true"></i>'); 923 } 924 btn.attr('data-acount', amcount); 925 btn.data('lid', 0); 926 } else if(response > 0) { 927 btn.attr('data-acount', apcount); 928 btn.html('<i class="fa fa-thumbs-up" aria-hidden="true"></i> ' + apcount); 929 btn.data('lid', response); 930 console.log("showFlutterLogin"); 931 } 932 } 933 }); 934}); 935 936$(document).on('click', '.uRideModalLike', function(){ 937 var btn = $(this); 938 // console.log(btn); 939 var lid = $(this).data("lid"); 940 // console.log("lid", lid); 941 var owner_userid = $(this).data('ownerid'); 942 var activity_id = $(this).data('activityid'); 943 var external_id = $(this).data('externalid'); 944 var cid = $(this).data('cid'); 945 var atcount = $(this).data('acount'); 946 var acount = parseInt($(this).attr('data-acount')); 947 var apcount = acount + 1; 948 var amcount = acount - 1; 949 if(external_id == 'undefined' || external_id == null){ 950 external_id = 0; 951 } 952 $.ajax({ 953 method: 'POST', 954 url: url_root + '/common/ajax-activity-like.php', 955 data: { lid, owner_userid, activity_id, cid,external_id}, 956 success: function(response){ 957 console.log("Response: ", response); 958 btn = $(".uRideModalLike[data-activityid='"+activity_id+"']"); 959 var Listbtn = $(".uRideLike[data-activityid='"+activity_id+"']"); 960 if(response == 'Unlike') { 961 if(atcount > 0) { 962 btn.html('<i class="fa fa-thumbs-o-up mrgr5" aria-hidden="true"></i><span id="favProfile">'+ amcount+' </span> ' ); 963 // btn.html('<span class="fweightbold fsize14 " id="favProfile" style="padding-right: 3px;">'+amcount+'</span><i class="fas fa-heart" style="color:#34353c;margin-right:10px;"></i>'); 964 Listbtn.html('<i class="fa fa-thumbs-o-up mrgr5" aria-hidden="true"></i> ' + amcount); 965 } else { 966 btn.html('<i class="fa fa-thumbs-o-up mrgr5" aria-hidden="true"></i><span id="favProfile">'+ amcount+' </span> ' ); 967 // btn.html('<span class="fweightbold fsize14 " id="favProfile" style="padding-right: 3px;">'+amcount+'</span><i class="fas fa-heart" style="color:#34353c;margin-right:10px;"></i>'); 968 Listbtn.html('<i class="fa fa-thumbs-o-up mrgr5" aria-hidden="true"></i> ' + amcount); 969 } 970 btn.attr('data-acount', amcount); 971 btn.attr('data-lid', 0); 972 btn.data('lid', 0); 973 } else if(response > 0){ 974 975 btn.attr('data-acount', apcount); 976 btn.data('lid', response); 977 btn.html('<i class="fa fa-thumbs-up mrgr5" aria-hidden="true"></i><span id="favProfile">'+ apcount+' </span> ' ); 978 // btn.html('<span class="fweightbold fsize14 " id="favProfile" style="padding-right: 3px;">'+apcount+'</span><i class="fas fa-heart" style="color:#C00000;margin-right:10px;"></i>'); 979 Listbtn.html('<i class="fa fa-thumbs-up mrgr5" aria-hidden="true"></i> ' + apcount); 980 btn.data('lid', response); 981 } 982 } 983 }); 984}) 985 986$(document).on('click', '.uRideLike', function(){ 987 988 var btn = $(this); 989 var lid1 = $(this).data('lid'); 990 var owner_userid = $(this).data('ownerid'); 991 var activity_id = $(this).data('activityid'); 992 var external_id = $(this).data('externalid'); 993 var cid = $(this).data('cid'); 994 var atcount = $(this).data('acount'); 995 var acount = parseInt($(this).attr('data-acount'));
996 var lid = $(this).attr('data-lid'); 997 var apcount = acount + 1; 998 var amcount = acount - 1; 999 if(external_id == 'undefined' || external_id == null){ 1000 external_id = 0; 1001 } 1002 // console.log("From here Clicked!"); 1003 // console.log(lid); 1004 // console.log(lid1); 1005 $.ajax({ 1006 method: 'POST', 1007 url: url_root + '/common/ajax-activity-like.php', 1008 data: { lid: lid, owner_userid: owner_userid, activity_id: activity_id, cid: cid, external_id : external_id }, 1009 success: function(response){ 1010 console.log("Res: ", response); 1011 if(activity_id == 0 && external_id != ''){ 1012 btn = $(".uRideLike[data-externalid='"+external_id+"']"); 1013 }else{ 1014 btn = $(".uRideLike[data-activityid='"+activity_id+"']"); 1015 } 1016 1017 if(response == 'Unlike') { 1018 if(atcount > 0) { 1019 btn.html('<i class="fa fa-thumbs-o-up mrgr5" aria-hidden="true"></i> ' + amcount); 1020 } else { 1021 btn.html('<i class="fa fa-thumbs-o-up mrgr5" aria-hidden="true"></i>' + amcount); 1022 } 1023 btn.attr('data-acount', amcount); 1024 btn.attr('data-lid', response); 1025 btn.data('lid', 0); 1026 } else if(response > 0){ 1027 // console.log('like success'); 1028 btn.attr('data-acount', apcount); 1029 btn.html('<i class="fa fa-thumbs-up mrgr5" aria-hidden="true"></i> ' + apcount); 1030 btn.attr('data-acount', apcount); 1031 btn.attr('data-lid', response); 1032 1033 if(activity_id == 0 && external_id != ''){ 1034 activity_id = external_id; 1035 } 1036 if(viewType == 'activities'){ 1037 ga('send', 'event', { 1038 'eventCategory':'Activities', 1039 'eventAction':'Leaderboard Activity Like', 1040 'eventLabel':activity_id, 1041 }); 1042 }else if(viewType == 'list'){ 1043 ga('send', 'event', { 1044 'eventCategory':'Activities', 1045 'eventAction':'Profile List Activity Like', 1046 'eventLabel':activity_id, 1047 }); 1048 }else if(viewType == 'grid'){ 1049 ga('send', 'event', { 1050 'eventCategory':'Activities', 1051 'eventAction':'Profile Grid Activity Like', 1052 'eventLabel':activity_id, 1053 }); 1054 } 1055 } 1056 } 1057 }); 1058 return false; 1059}); 1060 1061$(document).on('click', '.btn-activity-flag', function(){ 1062 console.log("click"); 1063 var btn = $(this); 1064 var fid = $(this).data('fid'); 1065 var owner_userid = $(this).data('ownerid'); 1066 var activity_id = $(this).data('activityid'); 1067 var cid = $(this).data('cid'); 1068 //var comment = $(this).data('comment'); 1069 var comment = $('#flag-comment').val(); 1070 var atcount = $(this).data('acount'); 1071 var acount = parseInt($(this).attr('data-acount')); 1072 var apcount = acount + 1; 1073 var amcount = acount - 1; 1074 1075 $.ajax({ 1076 method: 'POST', 1077 url: url_root + '/common/ajax-activity-flag.php', 1078 data: { fid: fid, owner_userid: owner_userid, activity_id: activity_id, comment: comment }, 1079 success: function(response){ 1080 if(response == 'Unflag') { 1081 if(atcount > 0) { 1082 btn.html('<i class="fa fa-flag-o" aria-hidden="true"></i> Flag <span class="badge msg-badge">'+ amcount + '</span>'); 1083 } else { 1084 btn.html('<i class="fa fa-flag-o" aria-hidden="true"></i> Flag'); 1085 } 1086 btn.attr('data-acount', amcount); 1087 btn.data('fid', 0); 1088 } else if(response > 0) { 1089 btn.attr('data-acount', apcount); 1090 btn.html('<i class="fa fa-flag" aria-hidden="true"></i> Unflag <span class="badge msg-badge">'+ apcount + '</span>'); 1091 btn.data('fid', response); 1092 } 1093 } 1094 }); 1095}); 1096 1097$(document).on('click', '.uRideFlagqq', function(){ 1098 console.log("click"); 1099 var btn = $(this); 1100 var fid = $(this).data('fid'); 1101 var owner_userid = $(this).data('ownerid'); 1102 var activity_id = $(this).data('activityid'); 1103 var cid = $(this).data('cid'); 1104 //var comment = $(this).data('comment'); 1105 var comment = $('#flag-comment').val(); 1106 var atcount = $(this).data('acount'); 1107 var acount = parseInt($(this).attr('data-acount')); 1108 var apcount = acount + 1; 1109 var amcount = acount - 1; 1110 1111 $.ajax({ 1112 method: 'POST', 1113 url: url_root + '/common/ajax-activity-flag.php', 1114 data: { fid: fid, owner_userid: owner_userid, activity_id: activity_id, comment: comment }, 1115 success: function(response){ 1116 if(response == 'Unflag') { 1117 if(atcount > 0) { 1118 btn.html('<i class="fa fa-flag-o" aria-hidden="true"></i>
1118 Flag <span class="badge msg-badge">'+ amcount + '</span>'); 1119 } else { 1120 btn.html('<i class="fa fa-flag-o" aria-hidden="true"></i> Flag <span class="badge msg-badge">'+ amcount + '</span>'); 1121 } 1122 btn.attr('data-acount', amcount); 1123 btn.data('fid', 0); 1124 } else if(response > 0) { 1125 btn.attr('data-acount', apcount); 1126 btn.html('<i class="fa fa-flag" aria-hidden="true"></i> Unflag <span class="badge msg-badge">'+ apcount + '</span>'); 1127 btn.data('fid', response); 1128 } 1129 } 1130 }); 1131 return false; 1132}); 1133 1134$(document).on('click', '.btn-admin-activity-flag', function(){ 1135 console.log("click"); 1136 var btn = $(this); 1137 var afid = $(this).data('afid'); 1138 var activity_id = $(this).data('activityid'); 1139 1140 $.ajax({ 1141 method: 'POST', 1142 url: url_root + '/common/ajax-admin-activity-flag.php', 1143 data: { afid: afid, activity_id: activity_id }, 1144 success: function(response){ 1145 if(response == 'Unflag') { 1146 btn.html('<i class="fa fa-flag-o" aria-hidden="true"></i>'); 1147 btn.data('afid', 0); 1148 } else if(response > 0) { 1149 btn.html('<i class="fa fa-flag" aria-hidden="true"></i>'); 1150 btn.data('afid', response); 1151 } 1152 } 1153 }); 1154});
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.