Advertisement
Guest User

Untitled

a guest
May 2nd, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 1.06 KB | None | 0 0
  1. <script>
  2. jQuery(document).ready(function($) {
  3.     if (window.location.href.indexOf(/san-diego-property-management/) > -1) {
  4.         document.cookie = "dynamicnumber=true; path=/";
  5. }
  6.  
  7. function getCookie(name) {
  8.     var nameEQ = name + '=';
  9.     var ca = document.cookie.split(';');
  10.  
  11.     for (var i = 0; i < ca.length; i++) {
  12.         var c = ca[i];
  13.         while (c.charAt(0) == ' ') {
  14.             c = c.substring(1, c.length);
  15.         }
  16.  
  17.         if (c.indexOf(nameEQ) == 0) {
  18.             return unescape(c.substring(nameEQ.length, c.length));
  19.         }
  20.     }
  21.  
  22.     return "";
  23. }
  24.  
  25. var value = getCookie('dynamicnumber');
  26. if (value != '') {
  27.     alert('dynamic phone number cookie set - displaying phone number 858-876-0557');
  28.    
  29.     $('body :not(script)').contents().filter(function() {
  30.         return this.nodeType === 3;
  31.   }).replaceWith(function() {
  32.       //return this.nodeValue.replace('858-876-9455','858-876-0557');
  33.   });
  34.  
  35.    
  36. } else {
  37.     alert('no dynamic phone cookie set - displaying original phone number 858-876-9455');
  38. }
  39. });
  40. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement