jamescolin

Page GO

Sep 23rd, 2021 (edited)
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. <script>
  2.  
  3. let params = (new URL(document.location)).searchParams;
  4.  
  5. var destination = params.get('url');
  6. if (destination!=null) {
  7. setCookie("boutiquedestination", destination, 0.1);
  8. }
  9.  
  10. if ( (getCookie("boutiquemerci") != "") && (destination!=null) ) {
  11. window.location.replace(destination);
  12. }
  13. var myimage = '';
  14. if (destination!=null) {
  15. getAutotags();
  16. }
  17.  
  18. function getAutotags() {
  19. myimage = document.querySelector("[data-tag='MONIMAGE']");
  20.  
  21. if ( myimage == null ) {
  22. setTimeout(getAutotags, 1000);
  23. console.log('nope ... ');
  24. } else {
  25. console.log('myimage : '+myimage);
  26. setDatas();
  27. }
  28. }
  29.  
  30. function setDatas() {
  31. var mythumblink = 'https://s.wordpress.com/mshots/v1/'+encodeURIComponent(destination)+'?w=500';
  32. let el = document.querySelector("[data-tag='MONIMAGE'] > div > img");
  33. el.src = mythumblink;
  34. }
  35.  
  36. function getCookie(cname) {
  37. var name = cname + "=";
  38. var ca = document.cookie.split(';');
  39. for(var i = 0; i < ca.length; i++) {
  40. var c = ca[i];
  41. while (c.charAt(0) == ' ') {
  42. c = c.substring(1);
  43. }
  44. if (c.indexOf(name) == 0) {
  45. return c.substring(name.length, c.length);
  46. }
  47. }
  48. return "";
  49. }
  50.  
  51. function setCookie(cname, cvalue, exdays) {
  52. var d = new Date();
  53. d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
  54. var expires = "expires="+d.toUTCString();
  55. document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
  56. }
  57. </script>
Add Comment
Please, Sign In to add comment