Advertisement
pbhj

files related to nsfwyoutube.com -- push notifications

Mar 13th, 2019
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. https://cdn.siteswithcontent.com/js/push/news-siteswithcontent-subscribe.js
  2. ---
  3. (function (document, tagName, url, element) {
  4.     element = document.createElement(tagName);
  5.     element.src = url;
  6.     document.head.appendChild(element);
  7. })(document, 'script', 'https://cdn.siteswithcontent.com/js/push/subscribe.js?t=1.2.5');
  8.  
  9. ===
  10.  
  11. https://cdn.siteswithcontent.com/js/push/subscribe.js?t=1.2.5%27
  12. ---
  13. (function (filename, callbackStorage, context) {
  14.     window[callbackStorage] = window[callbackStorage] || [];
  15.  
  16.     context.init = function (sw) {
  17.         Notification.requestPermission().then(function (permission) {
  18.             for (var i in window[callbackStorage]) {
  19.                 window[callbackStorage][i](permission);
  20.             }
  21.  
  22.             if ('granted' !== permission) {
  23.                 return;
  24.             }
  25.  
  26.             sw.getRegistrations().then(function (registrations) {
  27.                 for (var i in registrations) {
  28.                     if (registrations[i].active && registrations[i].active.scriptURL.indexOf(filename) !== -1) {
  29.                         registrations[i].active.postMessage(JSON.stringify(context.getParameters()));
  30.                         return;
  31.                     }
  32.                 }
  33.  
  34.                 sw.register(filename);
  35.  
  36.                 sw.ready.then(function (registration) {
  37.                     registration.active.postMessage(JSON.stringify(context.getParameters()));
  38.                 });
  39.             });
  40.         });
  41.     };
  42.  
  43.     context.getQueryParameter = function (name) {
  44.         var params = window.location.search.substring(1).split('&');
  45.  
  46.         for (var i = 0; i < params.length; i++) {
  47.             var part = params[i].split('=');
  48.  
  49.             if (part[0] === name) {
  50.                 return part[1];
  51.             }
  52.         }
  53.     };
  54.  
  55.     context.getParameters = function () {
  56.         var params = {
  57.             url: location.href,
  58.             event: 'activate',
  59.             utm_medium: localStorage.getItem('mg_utm_medium'),
  60.             utm_campaign: localStorage.getItem('mg_utm_campaign'),
  61.             cookie: document.cookie
  62.         };
  63.  
  64.         if (document.referrer) {
  65.             params.referrer = document.referrer;
  66.         }
  67.  
  68.         if (typeof helper === 'object') {
  69.             if (helper.userCountry) {
  70.                 params.country = helper.userCountry;
  71.             }
  72.  
  73.             if (helper.userSources) {
  74.                 params.sources = helper.userSources;
  75.             }
  76.  
  77.             if (helper.userCategories) {
  78.                 params.categories = helper.userCategories;
  79.             }
  80.         }
  81.  
  82.         return params;
  83.     };
  84.  
  85.     context.getCappingOrigin = function (url) {
  86.         url = url.match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i);
  87.         return url[0].replace('cdn', 'c');
  88.     };
  89.  
  90.     context.capping = function (permission, domain, img) {
  91.         if (localStorage.getItem('mg-old-permission') !== permission) {
  92.             domain = location.host.replace('www.', '');
  93.  
  94.             img = document.createElement('img');
  95.             img.src = context.cappingOrigin + 'push-event-counter?permission=' + permission + '&domain=' + domain;
  96.  
  97.             localStorage.setItem('mg-old-permission', permission);
  98.         }
  99.     };
  100.  
  101.     var scripts = document.getElementsByTagName('script');
  102.     context.cappingOrigin = context.getCappingOrigin((document.currentScript || scripts[scripts.length - 1]).src);
  103.  
  104.     window[callbackStorage].push(context.capping.bind(this));
  105.  
  106.     var utmMedium = context.getQueryParameter('utm_medium');
  107.     var utmCampaign = context.getQueryParameter('utm_campaign');
  108.  
  109.     if (utmMedium) {
  110.         localStorage.setItem('mg_utm_medium', utmMedium);
  111.     }
  112.  
  113.     if (utmCampaign) {
  114.         localStorage.setItem('mg_utm_campaign', utmCampaign);
  115.     }
  116.  
  117.     if ('serviceWorker' in navigator) {
  118.         window.addEventListener('load', function () {
  119.             context.init(navigator.serviceWorker);
  120.         });
  121.     }
  122.  
  123.     if (document.cookie.indexOf('muidn=') === -1) {
  124.         var script = document.createElement('script');
  125.         var cmhost = context.cappingOrigin.replace('siteswithcontent', 'mgid').replace('contentsitesrv', 'marketgid');
  126.  
  127.         script.src = cmhost + 'js-cookie-muidn';
  128.         document.head.appendChild(script);
  129.     }
  130. })('/firebase-messaging-sw.js?t=7', '_NotificationPermissionCallbacks', {});
  131.  
  132. ===
  133.  
  134. The above file mentions firebase and references this, https://github.com/firebase/quickstart-js/blob/50fb88abb0950a70799207d4da8eae45a4a66d02/messaging/firebase-messaging-sw.js#L15-L29, which is used for background handling of push notifications.
  135.  
  136. Note that at least https://github.com/PolishFiltersTeam/PolishAnnoyanceFilters/blob/master/PAF_push.txt lists this site for push notification "annoyance".
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement