1// JavaScript Document 2<!-- 3 4//App Group Element Check 5function appGroupsDivCheck(id,action) 6{ 7 if($('#'+id).length > 0) 8 { 9 var x = document.getElementById(id); 10 11 if (action === "show") 12 { 13 if(x.style.display != "block") 14 x.style.display = "block"; 15 } 16 else if (action === "hide") 17 { 18 if (x.style.display != "none") 19 x.style.display = "none"; 20 } 21 22 //console.log('appGroups Exist with action = '+action); 23 } 24} 25//toggles layer visibility on and off 26function show(id) { 27 document.getElementById(id).style.display = "block"; 28} 29 30function hide(id) { 31 document.getElementById(id).style.display = "none"; 32} 33 34function showInline(id) { 35 document.getElementById(id).style.display = "inline-block"; 36} 37function switchClass(myTarget,myClass) 38{ 39 myTarget.className=myClass; 40} 41 42function setStyleFocus(x) 43{ 44 document.getElementById(x).style.background="#FFFFFF url(/images/common/bg_input_focus.gif) top left no-repeat"; 45} 46 47function setStyleBlur(x) 48{ 49 document.getElementById(x).style.background="#FFFFFF url(/images/common/bg_input.gif) top left no-repeat"; 50} 51 52function checkAll(field) 53{ 54 for (i = 0; i < field.length; i++) 55 field[i].checked = true ; 56} 57 58function uncheckAll(field) 59{ 60 for (i = 0; i < field.length; i++) 61 field[i].checked = false ; 62} 63 64function clearInputValue(myInputName) { 65 var myInput = document.getElementById(myInputName); 66 if(myInput.value=="Search") 67 { 68 myInput.value = ''; 69 } 70} 71 72function setFocus(myField) 73{ 74 document.getElementById(myField).focus(); 75} 76 77function updateCommentFormParentID(id) 78{ 79 if (id!=''){ 80 document.getElementById("comment_parent").value = id; 81 document.location.href="#commentsFormContainer"; 82 document.getElementById("COMMENT_AUTHOR").focus(); 83 } 84} 85 86function showBlogCommentReplies(parent_id) 87{ 88 var container = document.getElementById("blogCommentReplyInnerContainer_" + parent_id); 89 if (container.style.display == "none") { 90 container.style.display = "block"; 91 } else { 92 container.style.display = "none"; 93 } 94} 95 96function updateBannerLink() 97{ 98 if($('#linkUrl').val()!='') 99 { 100 var href= document.getElementById("linkUrl").value; 101 if ($('#LINK').length) { 102 $('#LINK').val(href); 103 } else { 104 $('#BANNER_LINK').val(href); 105 } 106 } 107} 108 109function updateBanner() 110{ 111 var pageBanner = $('#PAGE_BANNER').val(); 112 var bannerID = $('#ID').val(); 113 var bannerName = $('#NAME').val(); 114 var bannerSubheading = $('#BANNER_SUBHEADING').val(); 115 var bannerStart = $('#START').val(); 116 var bannerEnd = $('#END').val(); 117 var bannerLink = $('#LINK').val(); 118 parent.$.fancybox.showActivity(); 119 $.ajax({ 120 url: '/ajax_update_banner.php', 121 type: "POST", 122 data: { bannerID:bannerID, bannerName:bannerName, bannerSubheading:bannerSubheading, bannerStart:bannerStart, bannerEnd:bannerEnd, bannerLink:bannerLink }, 123 success: function(result){ 124 parent.$.fancybox.hideActivity(); 125 if (result != "error") 126 { 127 //parent.$.fancybox.close(); 128 if (pageBanner != '') { 129 parent.window.location.href='/admin_editpage.php?id=' + pageBanner; 130 } else { 131 parent.window.location.href='/admin_list_banners.php'; 132 } 133 } 134 else 135 { 136 alert('An error has occurred while saving your changes, please try again!'); 137 } 138 } 139 }); 140} 141 142function ShowHideMetaData() 143{ 144 var $metadata_link = $('#MetaDataLink'); 145 var $metadata = $('#metadata'); 146 if($metadata_link.html()=='Show Meta Data'){ 147 $metadata.show(); 148 $metadata_link.html('Hide Meta Data') 149 } else { 150 $metadata.hide(); 151 $metadata_link.html('Show Meta Data'); 152 } 153} 154 155function checkAllPageBanners() 156{ 157 $('#adminListTable input:checkbox').each(function() { 158 $(this).attr('checked','checked'); 159 }); 160} 161 162function uncheckAllPageBanners() 163{ 164 $('#adminListTable input:checkbox').each(function() { 165 $(this).removeAttr('checked'); 166 }); 167} 168 169function updatePageBanners(action) 170{ 171 var list = []; 172 var order = []; 173 var PAGE_ID = $('#ID').val(); 174 // Create array from all checked input fields 175 if(action!='order') 176 { 177 $('#adminListTable input:checkbox').each(function() { 178 if($(this).is(':checked')){ 179 list.push($(this).val()); 180 } 181 }); 182 } 183 else 184 { 185 $('#adminListTable select').each(function() { 186 order.push($(this).val()); 187 list.push($(this).attr("name"));
188 }); 189 } 190 $.ajax({ 191 url: "/admin_actions_page_banners.php", 192 type: "POST", 193 data: { list:list, action:action, order:order, PAGE_ID:PAGE_ID }, 194 success: function(result){ 195 if(result!='fail'){ 196 parent.window.location.href=result; 197 } else { 198 alert('An error occurred while processing the banner update!'); 199 } 200 } 201 }); 202} 203 204function showAdminPageArea(type, id, src) 205{ 206 if(id == undefined) id = ''; 207 if(src == undefined) src = ''; 208 // Determine which area is currently showing 209 if ($('.containerPageContent').css('display') == 'block') { 210 var openContainer = $('.containerPageContent'); 211 var openType = 'content'; 212 } else if ($('#containerMetaData').css('display') == 'block') { 213 var openContainer = $('#containerMetaData'); 214 var openType = 'meta'; 215 } else if ($('#containerStaff').css('display') == 'block') { 216 var openContainer = $('#containerStaff'); 217 var openType = 'staff'; 218 } else if ($('#containerPageBanners').css('display') == 'block'){ 219 var openContainer = $('#containerPageBanners'); 220 var openType = 'banners'; 221 } else { 222 var openContainer = $('#containerViewPage'); 223 var openType = 'view'; 224 } 225 // If the type is already the visible area, we do nothing... 226 if (type == openType) { return; } 227 // Remove the activeClass from the openContainer 228 $('#adminNavUL li a.active').each(function(index, element) { $(element).removeClass('active'); }); 229 // Now switch on the type passed in to show and fade out our openContainer and fadeIn our type container 230 switch(type) 231 { 232 // META DATA 233 case 'meta': 234 $('#linkMetaData').addClass('active'); 235 $(openContainer).fadeOut('slow', function() { 236 $('#containerMetaData').fadeIn('slow'); 237 }); 238 break; 239 240 // STAFF 241 case 'staff': 242 $('#linkStaff').addClass('active'); 243 $(openContainer).fadeOut('slow', function() { 244 $('#containerStaff').fadeIn('slow'); 245 }); 246 break; 247 248 // PAGE BANNERS 249 case 'banners': 250 $('#linkPageBanners').addClass('active'); 251 $(openContainer).fadeOut('slow', function() { 252 $('#containerPageBanners').fadeIn('slow'); 253 }); 254 break; 255 256 // VIEW PAGE 257 case 'view':
258 $.post('/ajax_page_preview.php', { action: 'update-page-preview', id: id, section: $('#SECTION').val(), title: $('#TITLE').val(), content: tinymce.activeEditor.getContent() }) 259 .done(function(data){ 260 // update the src of the iframe with the returned link 261 $('#page_preview').attr('src', data+'&preview=yes'); 262 }); 263 264 $('#linkViewPage').addClass('active'); 265 $(openContainer).fadeOut('slow', function() { 266 $('#containerViewPage').fadeIn('slow'); 267 }); 268 break; 269 270 // VISIT PAGE 271 case 'visit': 272 $.post('/ajax_page_preview.php', { action: 'update-page-preview', id: id, section: $('#SECTION').val(), title: $('#TITLE').val(), content: tinymce.activeEditor.getContent() }) 273 .done(function(data){ 274 // Redirect to visit page 275 location.href = data+'&visit=yes'; 276 }); 277 break; 278 279 // PAGE CONTENT (DEFAULT) 280 default: 281 $('#linkPageContent').addClass('active') 282 $(openContainer).fadeOut('slow', function() { 283 $('.containerPageContent').fadeIn('slow'); 284 }); 285 break; 286 } 287} 288 289function showAdminSettingsArea(type, id, src) 290{ 291 if(id == undefined) id = ''; 292 if(src == undefined) src = ''; 293 // Determine which area is currently showing 294 if ($('.containerGlobalContent').css('display') == 'block') { 295 var openContainer = $('.containerGlobalContent'); 296 var openType = 'global'; 297 } else if ($('#containerFeatureContent').css('display') == 'block') { 298 var openContainer = $('#containerFeatureContent'); 299 var openType = 'feature'; 300 } else if ($('#containerFvIconsContent').css('display') == 'block') { 301 var openContainer = $('#containerFvIconsContent'); 302 var openType = 'fvicons'; 303 } else if ($('#containerChartContent').css('display') == 'block'){ 304 var openContainer = $('#containerChartContent'); 305 var openType = 'chart'; 306 } else if ($('#containerEmailContent').css('display') == 'block'){ 307 var openContainer = $('#containerEmailContent'); 308 var openType = 'email'; 309 } else if ($('#containerEcommerceContent').css('display') == 'block'){ 310 var openContainer = $('#containerEcommerceContent'); 311 var openType = 'ecommerce'; 312 } else { 313 var openContainer = $('#containerCompanyContent'); 314 var openType = 'company'; 315 } 316 // If the type is already the visible area, we do nothing... 317 if (type == openType) { return; } 318 // Remove the activeClass from the openContainer 319 $('#adminNavUL li a.active').each(function(index, element) { $(element).removeClass('active'); }); 320 // Now switch on the type passed in to show and fade out our openContainer and fadeIn our type container 321 switch(type) 322 { 323 // FEATURE SETTINGS 324 case 'feature': 325 $('#linkFeature').addClass('active'); 326 $(openContainer).fadeOut('slow', function() { 327 $('#containerFeatureContent').fadeIn('slow'); 328 }); 329 break; 330 331 // FAVORITE ICONS 332 case 'fvicons': 333 $('#linkFvicons').addClass('active'); 334 $(openContainer).fadeOut('slow', function() { 335 $('#containerFvIconsContent').fadeIn('slow'); 336 }); 337 break; 338 339 // CHART SETTINGS 340 case 'chart': 341 $('#linkChart').addClass('active'); 342 $(openContainer).fadeOut('slow', function() { 343 $('#containerChartContent').fadeIn('slow'); 344 }); 345 break; 346 347 // EMAIL SETTINGS 348 case 'email': 349 $('#linkEmail').addClass('active'); 350 $(openContainer).fadeOut('slow', function() { 351 $('#containerEmailContent').fadeIn('slow'); 352 }); 353 break; 354 355 // E-COMMERCE SETTINGS 356 case 'ecommerce': 357 $('#linkEcommerce').addClass('active'); 358 $(openContainer).fadeOut('slow', function() { 359 $('#containerEcommerceContent').fadeIn('slow'); 360 }); 361 break; 362 363 // Company SETTINGS 364 case 'company': 365 $('#linkCompany').addClass('active'); 366 $(openContainer).fadeOut('slow', function() { 367 $('#containerCompanyContent').fadeIn('slow'); 368 }); 369 break; 370 371 // GLOBAL CONTENT (DEFAULT) 372 default: 373 $('#linkGlobalContent').addClass('active') 374 $(openContainer).fadeOut('slow', function() { 375 $('.containerGlobalContent').fadeIn('slow'); 376 }); 377 break; 378 } 379} 380//Check inputfields for System Global settings 381function checkGlobalfields(){ 382 var globalCnt = 1; 383 $('.global_input').each(function(){ 384 var val = $(this).val().trim(); 385 //alert (val); 386 if (!val.length){ 387 globalCnt = val.length; 388 } 389 }); 390 return globalCnt; 391} 392 393//Check inputfields for Favorite Icons settings 394function checkFavIconsSettings(){ 395 var fieldChk = 0; 396 397 $('.favIconSet').each(function(){ 398 if($(this).is(":checked")){ 399 fieldChk++; 400 } 401 }); 402 403 return fieldChk; 404} 405 406//Check inputfields for Feature settings 407function checkFeaturefields(){ 408 var fieldChk = 0; 409 410 $('.collectSet').each(function(){ 411 if($(this).is(":checked")){ 412 fieldChk++; 413 } 414 }); 415 416 return fieldChk; 417} 418 419//Check chart settings exist 420function checkChartSettings(){ 421 422 //Update determine if all chart colors have been selected 423 var chartChk = 0; 424 425 $('.chartcheck').each(function(){ 426 var myval = $(this).data('check'); 427 428 //alert ('before value = ' + myval); 429 if (!myval){ 430 chartChk++; 431 //alert ('chartChk value = ' + chartChk); 432 } 433 434 }); //end of element check loop 435 436 if (chartChk != 0){ 437 return false; 438 //hide check box 439 //alert ('check value = ' + chartChk); 440 //$('#chartcheck').hide(); 441 } else { 442 //alert ( 'Else value = ' + chartChk); 443 //show check box 444 //$('#chartcheck').show(); 445 //$('#chartcompleted').html("<strong>Chart Settings Completed! </strong><i class='fa fa-check fa-3x' aria-hidden='true' style='color:#7cfc00'></i>"); 446 return true; 447 } 448 449} 450 451//Check email settings exist 452function checkEmailSettings(){ 453 454 //Do we have all the colors set 455 var emailChk = 0; 456 var emailFont = 0; 457 458 /*$('.emailBlast').each(function(){ 459 var myval = $(this).data('check'); 460 461 //alert ('before value = ' + myval); 462 if (!myval){ 463 emailChk++; 464 //alert ('chartChk value = ' + chartChk); 465 } 466 467 }); *///end of element check loop 468 469 470 $('.emailSet').each(function(){ 471 //alert ("Get Email setting value " + $(this).val() ); 472 var val = $(this).val().trim(); 473 if (!val.length){ 474 //emailFont = val.length; 475 emailFont++; 476 } 477 }); 478 //alert ('Email color check = ' + emailChk); 479 //alert ('Email Font field check = ' + emailFont); 480 if (emailFont != 0){ 481 return false; 482 } else { 483 return true; 484 } 485 486} 487 488//make sure at least one news letter is selected 489function checkSubscribeSelection(){ 490 491 var optInNews = []; 492 493 $("input[type=checkbox][name='newsSignUp[]']:checked").each(function() { 494 optInNews.push($(this).val()); 495 }); 496 497 return optInNews; 498 499} 500//Check inputfields for System Global settings 501function checkEcommercefields(){ 502 var ecommerceCnt = 1; 503 $('.ecommerce_input').each(function(){ 504 var val = $(this).val().trim(); 505 if (!val.length){ 506 ecommerceCnt = val.length; 507 } 508 }); 509 return ecommerceCnt; 510} 511 512//Check inputfields for System Global settings 513function checkCompanyfields(){ 514 var companyCnt = 1; 515 $('.company_input').each(function(){ 516 var val = $(this).val().trim(); 517 if (!val.length){
518 companyCnt = val.length; 519 } 520 }); 521 return companyCnt; 522} 523 524//Check validate emailaddress for subscription 525function validateSubscribeEmail(email) { 526 var filter = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/; 527 528 if (filter.test(email)) 529 { 530 return true; 531 } else { 532 return false; 533 } 534} 535 536//Logo eye dropper color picker 537// http://www.javascripter.net/faq/rgbtohex.htm 538function rgbToHex(R,G,B) {return toHex(R)+toHex(G)+toHex(B)} 539function toHex(n) { 540 n = parseInt(n,10); 541 if (isNaN(n)) return "00"; 542 n = Math.max(0,Math.min(n,255)); 543 return "0123456789ABCDEF".charAt((n-n%16)/16) + "0123456789ABCDEF".charAt(n%16); 544 } 545 546 547function hideShowAdminPageSidebar(tab) 548{ 549 var $sideBarContainer = $('#subnavLayeredContainer'); 550 var $pageOrderContainer = $('#subnavLayered.adminPageOrder'); 551 var $metaDataTrackingContainer = $('#subnavLayered.adminMetaDataTracking'); 552 // Depending on the tab they clicked, we show the correct content 553 if (tab == 'pageOrder') { 554 if ($pageOrderContainer.hasClass('shown')) { 555 animateSidebar(); 556 } else { 557 $pageOrderContainer.addClass('shown'); $metaDataTrackingContainer.removeClass('shown'); 558 $pageOrderContainer.show(); $metaDataTrackingContainer.hide(); 559 if (!$sideBarContainer.hasClass('shown')) { 560 animateSidebar(); 561 } 562 } 563 } else { 564 if ($metaDataTrackingContainer.hasClass('shown')) { 565 animateSidebar(); 566 } else { 567 $metaDataTrackingContainer.addClass('shown'); $pageOrderContainer.removeClass('shown'); 568 $metaDataTrackingContainer.show(); $pageOrderContainer.hide(); 569 if (!$sideBarContainer.hasClass('shown')) { 570 animateSidebar(); 571 } 572 } 573 } 574} 575 576function animateSidebar() 577{ 578 var $sideBarContainer = $('#subnavLayeredContainer'); 579 // Hide/show the sidebar depending on if it is already showing 580 if ($sideBarContainer.hasClass('shown')) { 581 $sideBarContainer.removeClass('shown'); 582 $sideBarContainer.animate({ "left": "-=290px" }, "slow" ); 583 } else { 584 $sideBarContainer.addClass('shown'); 585 $sideBarContainer.animate({ "left": "+=290px" }, "slow" ); 586 } 587} 588 589function getDoc(frame) 590{ 591 var doc = null; 592 // IE8 cascading access check 593 try { 594 if (frame.contentWindow) { 595 596 597 598 doc = frame.contentWindow.document; 599 600 601 602 } 603 } catch(err) { 604 } 605 if (doc) { // successful getting content 606 return doc; 607 } 608 try { // simply checking may throw in ie8 under ssl or mismatched protocol 609 doc = frame.contentDocument ? frame.contentDocument : frame.document; 610 } catch(err) { 611 // last attempt 612 doc = frame.document; 613 } 614 return doc; 615 } 616 617function hideShowMobileMenu() 618{ 619 var $myContainer = $('#mobileMenu'), 620 scrollTop = $(document).scrollTop(); 621 if ($myContainer.hasClass('shown')) { 622 animateMobileMenuOut(); 623 } else { 624 animateMobileMenuIn(); 625 } 626} 627 628function animateMobileMenuIn() 629{ 630 var $myContainer = $('#mobileMenu'); 631 $myContainer.addClass('shown'); 632 $myContainer.animate({ "left": "0px", 'opacity' : 1 }, "slow" ); 633} 634 635function animateMobileMenuOut() 636{ 637 var $myContainer = $('#mobileMenu'); 638 $myContainer.removeClass('shown'); 639 $myContainer.animate({ "left": "-=100%", 'opacity' : 0 }, "slow"); 640} 641 642/** START ADD EVENT FUNCTIONS **/ 643var count = 1; 644function updateEventFormDays(id){ 645 var month = $('#eventMonth'+id+' option:selected').val(); 646 var year = $('#eventYear'+id+' option:selected').val(); 647 var day = $('#eventDay'+id+' option:selected').val(); 648 649 $.post("ajax_update_event_date_select.php", { month: month, day: day, year: year } ) 650 .done(function(response){ 651 $('#eventDay'+id).html(response); 652 }); 653} 654 655function toggleEventSeries(elem){ 656 657 //var checked = $(elem).attr('checked'); 658 var checked = $('#toggleEvent').is(':checked'); 659 if(checked){ 660 //$('#addDateButton').show(); 661 //It is a series of events 662 $('#datesColumn').slideUp(300, 'swing', function(){ 663 $('#seriesColumn').slideDown(1200, 'swing') 664 }); 665 666 $('#time_of_event').removeAttr('required'); 667 $('#event_ampm').removeAttr('required'); 668 669 } else { 670 //Its not a series of events 671 //$('#addDateButton').hide();
672 $('#seriesColumn').slideUp(1000, 'swing', function(){ 673 $('#datesColumn').slideDown(400, 'swing') 674 }); 675 $('#time_of_event').prop('required', true); 676 $('#event_ampm').prop('required', true); 677 } 678} 679 680function toggleEventSeriesNew(elem){ 681 682 //var checked = $(elem).attr('checked'); 683 var checked = $('#toggleEvent').is(':checked'); 684 if(checked){ 685 //$('#addDateButton').show(); 686 //It is a series of events 687 $('#seriesColumn').slideDown(1200, 'swing') 688 689 //$('#time_of_event').removeAttr('required'); 690 //$('#event_ampm').removeAttr('required'); 691 692 } else { 693 //Its not a series of events 694 //$('#addDateButton').hide(); 695 $('#seriesColumn').slideUp(1000, 'swing', function(){ 696 //$('#datesColumn').slideDown(400, 'swing') 697 }); 698 //$('#time_of_event').prop('required', true); 699 //$('#event_ampm').prop('required', true); 700 } 701} 702 703function addEventRow(){ 704 count = count + 1; //Count starts at 2 705 706 if(count == 13){ //Limit of 12 per event 707 alert('Limit of 12 days reached'); 708 return false; 709 } 710 $.post("ajax_add_event_date_row.php", { id : count } ) 711 .done(function(response){ 712 $('#datesColumn').append('<br/><label><strong><span class="required">* </span>Event'+count+':</strong></label><br/>'+response); 713 }); 714} 715 716function submitShowProcessing(event, elem){ 717 $(elem).val("Processing.."); 718 event.preventDefault(); 719} 720 721//newsletter Popup 722function newsletterPopup() 723{ 724 725 var nwsPopup = $('#newsletterSubscribeDiv'); 726 $('#newsSignUpMSG').hide(); 727 728 729 //open the signup form 730 //nwsPopup.show(); 731 nwsPopup.fadeIn("slow"); 732 $('#newsletterForm').find('input').not(':checkbox').each(function(){ 733 var element = $(this); 734 element.val(''); 735 }); 736 737 //Reset newsletter signup choice 738 $('#newsletterForm').find('input').not(':text').each(function() { 739 $(this).attr('checked','checked'); 740 }); 741 742 $('#newsDivSubheading').show(); 743 $('#tab1').show(); 744 $('#tab2').hide(); 745 746 //close the nPopup once close element is clicked 747 $(".close").on('click', function(e) { 748 nwsPopup.hide(); 749 }); 750 751 //close the mPopup when user clicks outside of the box 752 $(window).on('click', function(e) { 753 if(e.target == nwsPopup[0]){ 754 nwsPopup.hide(); 755 } 756 }); 757} 758 759//newsletter Popup mobile 760function newsletterPopupMobile() 761{ 762 var nwsPopupMobile = $('.signupwrapper'); 763 var emailSubRemove = $('#emailSubscribeDiv'); 764 //open the signup form 765 //nwsPopup.show(); 766 //nwsPopupMobile.fadeIn("slow"); 767 emailSubRemove.hide(); 768 nwsPopupMobile.show(); 769 770 //close the nPopup once close element is clicked 771 $(".close").on('click', function(e) { 772 nwsPopupMobile.hide(); 773 }); 774 775 //close the mPopup when user clicks outside of the box 776 $(window).on('click', function(e) { 777 if(e.target == nwsPopupMobile[0]){ 778 nwsPopupMobile.hide(); 779 } 780 }); 781} 782 783$(document).on('click', function(e){ 784 var t = e.target; 785 var d = t.closest('div'); 786 var id = $(d).attr('id'); 787 var adminMenuRight = $('#adminMenu').css('right'); 788 var adminMenu = $('#adminMenu'); 789 var adminMenuContainerWidth = $('#adminMenuContainer').css('width'); 790 var adminMenuContainer = $('#adminMenuContainer'); 791 var tabImage = $('#adminMenutabImage'); 792 793 if(id === 'adminMenuTab'){ 794 //They clicked the tab -- is the menu already open? 795 if(adminMenuRight == '-200px'){ 796 //The menu is hidden, show it 797 adminMenu.animate({'right' : '0px'} , 300); 798 adminMenuContainer.animate({'width' : '250px'} , 200); 799 tabImage.attr('src', '/images/admin/close.png'); 800 } else { 801 //hide the menu 802 adminMenu.animate({'right' : '-200px'} , 300); 803 adminMenuContainer.animate({'width' : '45px'} , 400); 804 tabImage.attr('src', '/images/admin/TSG.png'); 805 } 806 } else { 807 //the click is outside of the admin menu 808 if(id !== 'adminMenuScroll' && id !== 'adminMenu'){ 809 adminMenu.animate({'right' : '-200px'} , 300); 810 adminMenuContainer.animate({'width' : '45px'} , 400); 811 tabImage.attr('src', '/images/admin/TSG.png'); 812 } 813 } 814 815}); 816 817/** END ADD EVENT FUNCTIONS **/ 818 819// showDialog and showConfirmDialog use jquery-ui dialog widget. 820// @param title = the dialog title 821// @param msg = the msg -- can be HTML 822function showDialog(title, msg){ 823 $('#dialog').dialog('option', 'title', title); 824 $('#dialog-text').html(msg); 825 $('#dialog').dialog("open"); 826} 827 828function showConfirmDialog(title, msg){ 829 $('#dialog-confirm').dialog('option', 'title', title); 830 $('#dialog-confirm-text').html(msg); 831 $('#dialog-confirm').dialog("open"); 832} 833 834//newsletter 835 836$(function(){ 837 //Initialize dialogs 838 $('#dialog').dialog({ 839 draggable: true, 840 minWidth: 300, 841 maxWidth: '80%', 842 minHeight: 150, 843 maxHeight: '80%', 844 autoOpen: false, 845 resizeable: false, 846 buttons: [ 847 { 848 text: "Close", 849 icons: { 850 primary: "ui-icon-closethick" 851 }, 852 click: function() { 853 $( this ).dialog( "close" ); 854 } 855 856 // Uncommenting the following line would hide the text, 857 // resulting in the label being used as a tooltip 858 //showText: false 859 } 860 ] 861 }); 862 $('#dialog-confirm').dialog({ 863 draggable: true, 864 minWidth: 300, 865 maxWidth: '80%', 866 minHeight: 150, 867 maxHeight: '80%', 868 autoOpen: false, 869 resizeable: false, 870 modal: true, 871 buttons: [ 872 { 873 text: "Close", 874 icons: { 875 primary: "ui-icon-closethick" 876 }, 877 click: function() { 878 $( this ).dialog( "close" ); 879 } 880 881 // Uncommenting the following line would hide the text, 882 // resulting in the label being used as a tooltip 883 //showText: false 884 } 885 ] 886 }); 887}); 888//--------------------------------------------------------- 889 890$(function() { 891 $('.character-count').each(function(i,e) { 892 $('<p class="character-count-limit">Characters Remaining:<span>' + $(this).prop('maxLength') + '</span><em>(Maximum: ' + $(this).prop('maxLength') + ' Characters)</em></p>') 893 .insertAfter($(this)); 894 var thisLimitLabel = $(this).next('.character-count-limit'); 895 var thisLimit = $(this).prop('maxLength'); 896 try {
897 thisLimitLabel.find('span').html((parseInt(thisLimit) - parseInt($(this).val().length))); 898 } catch (e) {} 899 }); 900}); 901$(document).on('keyup', '.character-count', function(e) { 902 var thisLimitLabel = $(this).next('.character-count-limit'); 903 var thisLimit = $(this).prop('maxLength'); 904 try { 905 thisLimitLabel.find('span').html((parseInt(thisLimit) - parseInt($(this).val().length))); 906 } catch (e) {} 907}); 908 909//--> 910function showAdminAppControlsArea(type, id, src) 911{ 912 if(id == undefined) id = ''; 913 if(src == undefined) src = ''; 914 // Determine which area is currently showing 915 if ($('#containerAppGroupsContent').css('display') == 'block') { 916 var openContainer = $('#containerAppGroupsContent'); 917 var openType = 'appGroups'; 918 } else if ($('#containerAppOtherContent').css('display') == 'block') { 919 var openContainer = $('#containerAppOtherContent'); 920 var openType = 'appOther'; 921 } 922 // If the type is already the visible area, we do nothing... 923 if (type == openType) { return; } 924 // Remove the activeClass from the openContainer 925 $('#adminNavULPageContent li a.active').each(function(index, element) { $(element).removeClass('active'); }); 926 // Now switch on the type passed in to show and fade out our openContainer and fadeIn our type container 927 switch(type) 928 { 929 // APP GROUPS 930 case 'appGroups': 931 $('#linkAppGroups').addClass('active'); 932 $(openContainer).fadeOut('slow', function() { 933 $('#containerAppGroupsContent').fadeIn('slow'); 934 }); 935 break; 936 937 // APP OTHER 938 case 'appOther': 939 $('#linkAppOthers').addClass('active'); 940 $(openContainer).fadeOut('slow', function() { 941 $('#containerAppOtherContent').fadeIn('slow'); 942 }); 943 break; 944 945 // APP GROUPS CONTENT (DEFAULT) 946 default: 947 $('#linkAppGroups').addClass('active') 948 $(openContainer).fadeOut('slow', function() { 949 $('#containerAppGroupsContent').fadeIn('slow'); 950 }); 951 break; 952 } 953} 954 955/** START PROMOTION ADS FUNCTION **/ 956function confirmDeletePromotion(id, photo){ 957 if(id){ 958 var c = confirm("Are You Sure?"); 959 if (c == true) { 960 $.post("ajax_delete_promo.php", { deleteid : id, photo : photo }) 961 .done(function(response){ 962 if(response){ 963 var tRow = $('#promoRow'+id); 964 tRow.fadeOut(300, 'linear', function(){ 965 tRow.remove(); 966 }); 967 } else { 968 alert('Unable to delete. Please Try Again.'); 969 } 970 }); 971 972 } 973 } 974} 975 976function updatePromoLink() 977{ 978 979 if($('#linkUrl').val()!='') 980 { 981 982 var href= document.getElementById("linkUrl").value; 983 984 985 if ($('#LINK').length) { 986 $('#LINK').val(href); 987 } else { 988 $('#PROMOTION_LINK').val(href); 989 } 990 } 991 992 993 994} 995 996 997/** END PROMOTION ADS FUNCTION **/ 998 999 1000function updateSocialMediaSessionToken(type,data) { 1001 1002 // Switch on type 1003 switch (type.toLowerCase()) { 1004 1005 // Process Facebook Token Refresh 1006 case "facebook": 1007 $.post("/ajax_functions.php", { method:"updateFacebookSessionToken", data:JSON.stringify(data) }, function(result) { 1008 // Update the DOM element values 1009 $('#social_facebook').find('option:gt(0)').remove(); 1010 $.each(result, function(key,value) { 1011 $('#social_facebook').append($("<option></option>").attr("value",key).text(value)); 1012 }); 1013 },"json"); 1014 break; 1015 1016 } 1017} 1018 1019/** START DRAG AND DROP **/ 1020$(document).on('dragover dragenter', '#dragDropFiles', function(){ 1021 $(this).css('box-shadow', '0px 0px 2px 2px #f88d28'); 1022 return false; 1023}); 1024 1025$(document).on('dragleave dragend drop', '#dragDropFiles', function(){ 1026 $(this).css('box-shadow', '0px 0px 0px 0px black'); 1027 return false; 1028}); 1029 1030$(document).on('drop', '#dragDropFiles', function(e){ 1031 var droppedFiles = e.originalEvent.dataTransfer.files; 1032 var numDroppedFiles = e.originalEvent.dataTransfer.files.length; 1033 $('#files').prop('files', droppedFiles); 1034 $('#selectedFiles').html(numDroppedFiles + ' files selected'); 1035 return false; 1036}); 1037 1038function toggleMultipleFileUpload($this){ 1039 if($this.prop('checked')){ 1040 show('multipleFiles'); 1041 hide('singleFile'); 1042 }else{ 1043 show('singleFile'); 1044 hide('multipleFiles'); 1045 } 1046} 1047/** END DRAG AND DROP **/ 1048 1049/* START ACCORDION EVENTS */ 1050 1051// Hover event for accordion 1052$(document).on('mouseenter', '.TSG-accordion .ui-accordion-header', function(){ 1053 $(this).addClass('ui-state-hover'); 1054}); 1055$(document).on('mouseleave', '.TSG-accordion .ui-accordion-header', function(){ 1056 $(this).removeClass('ui-state-hover'); 1057}); 1058// Click event for accordion 1059$(document).on('click', '.TSG-accordion .ui-accordion-header', function(){ 1060 toggleAccordion($(this)); 1061}); 1062 1063function toggleAccordion($this){ 1064 var content = $this.next('.ui-accordion-content'); 1065 // Are we closing the accordion? 1066 if($this.hasClass('ui-state-active')){ 1067 // Update the header styles 1068 $this.removeClass('ui-state-active').addClass('ui-state-default'); 1069 $this.find('.ui-icon').removeClass('ui-icon-triangle-1-s').addClass('ui-icon-triangle-1-e'); 1070 // Close the content 1071 content.animate({ 1072 height: 0 1073 }, 500, function(){ 1074 // Hide the content 1075 content.hide(); 1076 }); 1077 }else{ 1078 // Update the header styles 1079 $this.removeClass('ui-state-default').addClass('ui-state-active'); 1080 $this.find('.ui-icon').removeClass('ui-icon-triangle-1-e').addClass('ui-icon-triangle-1-s'); 1081 // Show the content 1082 content.css('display', 'block'); 1083 // Open the content 1084 content.animate({ 1085 height: content.find('tbody').height() 1086 }, 500); 1087 $this.addClass('clicked'); 1088 } 1089 // Close all other open accordions 1090 if($this.parent().children('.ui-state-active:not(.clicked)').length){ 1091 toggleAccordion($this.parent().children('.ui-state-active:not(.clicked)')); 1092 } 1093 $this.removeClass('clicked'); 1094} 1095 1096/* END ACCORDION EVENTS */
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.