PageSourceSearch

https://positionstack.com/js/shared/platinum_support.js

js positionstack.com collected 2026-10-03 21:38:06 UTC 5,800 bytes, 139 lines download raw bytes

1function toggleImage(element) {
2  if (element.src.endsWith("check_box.svg")) {
3    element.src = "../images/assets/check_box_outline.svg";
4    $('#is_platinum_support').val(1);
5  } else {
6    element.src = "../images/assets/check_box.svg";
7    $('#is_platinum_support').val(0);
8  }
9}
10
11function togglePlatinumCheckBox(element) {
12  if (element.src.endsWith("check_box_white.svg")) {
13    element.src = "../images/assets/check_box_outline_white.svg";
14    $('#is_platinum_support').val(1);
15  } else {
16    element.src = "../images/assets/check_box_white.svg";
17    $('#is_platinum_support').val(0);
18  }
19}
20
21document.addEventListener('DOMContentLoaded', (event) => {
22  var modal = document.getElementById("myModal");
23  var triggers = document.querySelectorAll('.modal_trigger');
24  var body = document.body;
25
26  triggers.forEach(function(trigger) {
27    trigger.addEventListener('click', function() {
28    body.classList.add("noScroll");
29    modal.style.display = "block";
30    });
31  });
32
33  window.onclick = function(event) {
34    if (event.target == modal) {
35      modal.style.display = "none";
36      body.classList.remove("noScroll");
37    }
38  }
39});
40
41function closeModel(){
42  var modal = document.getElementById("myModal");
43  var body = document.body;
44  modal.style.display = "none";
45  body.classList.remove("noScroll");
46}
47
48$(document).on('click', '.upgrade_icon', function (event) {
49  var checkbox_val = $(this).closest('.plan').find('[data-platinum-choosed]').attr('data-platinum-choosed');
50  if (checkbox_val == "1") {
51    $(this).closest('.plan').find('[data-platinum-choosed]').attr('data-platinum-choosed', '0');
52  } else {
53  $(this).closest('.plan').find('[data-platinum-choosed]').attr('data-platinum-choosed', '1');
54  }
55})
56
57$(document).on('click', '.common_sites_upgrade_icon', function (event) {
58  var current_plan = $(this).attr('data-current-plan');
59  var checkbox_val = $(current_plan).attr('data-platinum-choosed');
60  if (checkbox_val == "1") {
61    $(current_plan).attr('data-platinum-choosed', '0');
62  } else {
63    $(current_plan).attr('data-platinum-choosed', '1');
64  }
65})
66
67function toggleImageWithPopupCheckbobx(element, plan) {
68  if (element.src.endsWith("check_box.svg")) {
69    element.src = "../images/assets/check_box_outline.svg";
70    $('.'+plan+'_product_platinum').removeAttr('checked');
71    if ($('.free_plan_platinum_upgrade_'+plan).length > 0) {
72      new_val = $('.free_plan_platinum_upgrade_'+plan).attr('onClick').replace('is_platinum_support=1', 'is_platinum_support=0');
73      $('.free_plan_platinum_upgrade_'+plan).attr('onClick', new_val);
74    }
75    if ($('.platinum_upgrade_'+plan).length > 0) {
76      new_val = $('.platinum_upgrade_'+plan).attr('onClick').replace('is_platinum_support=1', 'is_platinum_support=0');
77      $('.platinum_upgrade_'+plan).attr('onClick', new_val);
78    }
79  } else {
80    element.src = "../images/assets/check_box.svg";
81    $('.'+plan+'_product_platinum').prop('checked', true);
82    if ($('.free_plan_platinum_upgrade_'+plan).length > 0) {
83      new_val = $('.free_plan_platinum_upgrade_'+plan).attr('onClick').replace('is_platinum_support=0', 'is_platinum_support=1');
84      $('.free_plan_platinum_upgrade_'+plan).attr('onClick', new_val);
85    }
86    if ($('.platinum_upgrade_'+plan).length > 0) {
87      new_val = $('.platinum_upgrade_'+plan).attr('onClick').replace('is_platinum_support=0', 'is_platinum_support=1');
88      $('.platinum_upgrade_'+plan).attr('onClick', new_val);
89    }
90  }
91}
92
93
94// $( "body" ).on( "click", ".signup_link", function(e) {
95//   if(!$(this).attr('href').endsWith("free")) {
96//       e.preventDefault();
97//       var is_platinum_support = $(this).closest('div.product_container').find('img').attr('src').indexOf("outline") > 0 ? 0 : 1;      
98//       $('<form/>', { action: $(this).attr('href'), method: 'POST' }).append(
99//           $('<input>', {type: 'hidden', id: 'is_platinum_support', name: 'is_platinum_support', value: is_platinum_support})
100//       ).appendTo('body').submit();
101//   }
102// });
103
104$( "body" ).on( "click", ".signup_link", function(e) {
105    // if (!$(this).attr('href').endsWith("free") ||  !$(this).attr('href').endsWith("starter")) {
106    //     e.preventDefault();
107    //     var img = $(this).closest('div.product_container').find('img');
108    //     var src = img.attr('src');
109    //     // Check if src is defined
110    //     var is_platinum_support = (src && src.indexOf("outline") > 0) ? 0 : 1;
111    //     $('<form/>', { action: $(this).attr('href'), method: 'POST' })
112    //         .append($('<input>', { type: 'hidden', id: 'is_platinum_support', name: 'is_platinum_support', value: is_platinum_support }))
113    //         .appendTo('body').submit();
114    // }
115
116    var href = $(this).attr('href');
117    // Check if href is defined and valid
118    if (href && (!href.endsWith("free") || !href.endsWith("starter"))) {
119        e.preventDefault();
120        var img = $(this).closest('div.product_container').find('img');
121        var src = img.attr('src');
122        // Check if src is defined
123        var is_platinum_support = (src && src.indexOf("outline") > 0) ? 0 : 1;
124        $('<form/>', { action: href, method: 'POST' })
125            .append($('<input>', { type: 'hidden', id: 'is_platinum_support', name: 'is_platinum_support', value: is_platinum_support }))
126            .appendTo('body').submit();
127    }
128});
129
130function upgradePlanFromPricingPage(planId, checkboxId, frequency = false) {
131  if(!frequency) {
132    var dropdown = document.getElementById('billing_frequency_' + planId);
133    var frequency = dropdown ? dropdown.value : 'monthly';
134  }
135  const checkbox = document.getElementById(checkboxId);
136  const isPlatinum = checkbox && checkbox.checked ? 1 : 0;
137  const url = `/change_plan?plan_id=${planId}&payment_frequency=${frequency}&is_platinum_support=${isPlatinum}`;
138  window.location.href = url;
139}

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.