jamescolin

Page GO Merci

Sep 23rd, 2021 (edited)
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. <script>
  2. function setCookie(cname, cvalue, exdays) {
  3. var d = new Date();
  4. d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
  5. var expires = "expires="+d.toUTCString();
  6. document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
  7. }
  8.  
  9. function getCookie(cname) {
  10. var name = cname + "=";
  11. var ca = document.cookie.split(';');
  12. for(var i = 0; i < ca.length; i++) {
  13. var c = ca[i];
  14. while (c.charAt(0) == ' ') {
  15. c = c.substring(1);
  16. }
  17. if (c.indexOf(name) == 0) {
  18. return c.substring(name.length, c.length);
  19. }
  20. }
  21. return "";
  22. }
  23.  
  24. setCookie("boutiquemerci","OUI",365);
  25. var mydestination = '';
  26. var mybutton = '';
  27.  
  28. if (getCookie("boutiquedestination") != "") {
  29. mydestination = decodeURIComponent(getCookie("boutiquedestination"));
  30. getAutotags();
  31. }
  32.  
  33. function getAutotags() {
  34. mybutton = document.querySelector("[data-tag='MONLIEN']");
  35.  
  36. if ( mybutton == null ) {
  37. setTimeout(getAutotags, 1000);
  38. console.log('nope ... ');
  39. } else {
  40. console.log('mybutton : '+mybutton);
  41. setDatas();
  42. }
  43. }
  44.  
  45. function setDatas() {
  46. el = document.querySelector("[data-tag='MONLIEN'] > div.mobile-element > a");
  47. el.href = mydestination;
  48. el = document.querySelector("[data-tag='MONLIEN'] > div.desktop-element > a");
  49. el.href = mydestination;
  50. }
  51.  
  52. </script>
Add Comment
Please, Sign In to add comment