-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcore_downloads.min.js
More file actions
1 lines (1 loc) · 11.5 KB
/
Copy pathcore_downloads.min.js
File metadata and controls
1 lines (1 loc) · 11.5 KB
1
function GetLocationParameter(){var e=window.location;return"/br/free_video_converter/"==document.referrer.match("([a-z][a-z0-9+\\-.]*:(//[^/?#]+)?)?([a-z0-9\\-._~%!$&'()*+,;=:@/]*)")[3]&&(e=document.referrer),e}function InitializeLinksInternal(e,t,n,r,i,o){var a=CreateLinkProviders(t);InitializeLinks(),InitializeLinksWithDistributionSystem(a,new DistributionSystemApiUrlBuilder(n,r,i,e,o),!0),window.geoIpReady=!0}function UseAlternativeInstallersPath(){return!1}function InitializeLinks(){$(".fsp-download-link-patch").attr("href","https://services.freemake.com/wp_plugins/fm-slider-plugin.zip"),PatchLandingPages()}function InitializeLinksWithDistributionSystem(e,t,n){var r=new InstallerLinksPatcher("#downloadIdFAC .fac-download-link-patch_bd","#fac-offline-download-link-patch"),i=new EmbeddedUrlsStorage("FacEmbeddedUrls"),o=new AnalyticsSender("FAC");new UrlDistributionLinksPatcher("fac",t,e.FacProvider,r,window.productLinksPatchedDeterminator,i,o).patchLinks(n);var a=new InstallerLinksPatcher("#downloadIdFVD .fvd-download-link-patch_bd","#fvd-offline-download-link-patch"),d=new EmbeddedUrlsStorage("FvdEmbeddedUrls"),l=new AnalyticsSender("FVD");new UrlDistributionLinksPatcher("fvd",t,e.FvdProvider,a,window.productLinksPatchedDeterminator,d,l).patchLinks(n);var s=new InstallerLinksPatcher("#downloadIdFVC .fvc-download-link-patch_bd","#fvc-offline-download-link-patch"),c=new EmbeddedUrlsStorage("FvcEmbeddedUrls"),f=new AnalyticsSender("FVC");new UrlDistributionLinksPatcher("fvc",t,e.FvcProvider,s,window.productLinksPatchedDeterminator,c,f).patchLinks(n);var u=new InstallerLinksPatcher("#downloadIdFMB .fmb-download-link-patch_bd","#fmb-offline-download-link-patch"),m=new EmbeddedUrlsStorage("FmbEmbeddedUrls"),k=new AnalyticsSender("FMB");new UrlDistributionLinksPatcher("fmb",t,e.FmbProvider,u,window.productLinksPatchedDeterminator,m,k).patchLinks(n);var h=new InstallerLinksPatcher("#downloadIdFYB .fyb-download-link-patch_bd","#fyb-offline-download-link-patch"),p=new EmbeddedUrlsStorage("FybEmbeddedUrls"),w=new AnalyticsSender("FYB");new UrlDistributionLinksPatcher("fyb",t,e.FybProvider,h,window.productLinksPatchedDeterminator,p,w).patchLinks(n)}function AddNofollowIfNeed(e){0<e.length&&e.each(function(){void 0===$(this).attr("rel")&&$(this).attr("rel","nofollow"),-1===$(this).attr("rel").indexOf("nofollow")&&(""!==$(this).attr("rel")?$(this).attr("rel",$(this).attr("rel")+" nofollow"):$(this).attr("rel","nofollow"))})}function PatchLandingPages(){AddNofollowIfNeed($("#fvc-download-link-patch, .fvc-download-link-patch")),AddNofollowIfNeed($("#fvd-download-link-patch, .fvd-download-link-patch")),AddNofollowIfNeed($("#fyb-download-link-patch, .fyb-download-link-patch")),AddNofollowIfNeed($("#fmb-download-link-patch, .fmb-download-link-patch")),AddNofollowIfNeed($("#fac-download-link-patch, .fac-download-link-patch")),AddNofollowIfNeed($("#fvc-offline-download-link-patch")),AddNofollowIfNeed($("#fvd-offline-download-link-patch")),AddNofollowIfNeed($("#fyb-offline-download-link-patch")),AddNofollowIfNeed($("#fmb-offline-download-link-patch")),AddNofollowIfNeed($("#fac-offline-download-link-patch")),AddNofollowIfNeed($(".mp3jam-download-link"))}function UrlDistributionLinksPatcher(n,r,i,o,a,d,l){this.patchLinks=function(t){if(o.isSuitablePage())if(d.containsEmbeddedUrls()){var e=d.getEmbeddedUrls();o.patch(e.onlineInstallerUrl,e.offlineInstallerUrl),a.setProductLinksPatched(n)}else $.ajax({dataType:"json",type:"GET",url:r.buildUrl(n),timeout:3e3}).done(function(e){o.patch(e.onlineInstallerUrl,e.offlineInstallerUrl),t&&(a.setProductLinksPatched(n),d.saveEmbeddedUrls(e)),l.sendSuccessEvent()}).fail(function(e){o.patch(i.GetOnlineLink(),i.GetOfflineLink()),a.setProductLinksPatched(n),l.sendFailureEvent(e.status.toString())});else a.setProductLinksPatched(n)}}function DistributionSystemApiUrlBuilder(e,n,r,i,o){var a="freemake.com"==e||"www.freemake.com"==e?"https://releases.freemake.com/api/v1":"https://staging-releases.freemake.com/api/v1";this.buildUrl=function(e){var t=a+"/products/"+e+"/installers?referrer="+encodeURIComponent(n)+"&useragent="+encodeURIComponent(r);return null!=i&&(t+="&country="+i),t=PatchUrlWithExperimentsParameter(t+="&location="+encodeURIComponent(o))}}function PatchUrlWithExperimentsParameter(e){var t=GetOptimizeExperiments();if(0<t.length){var n=t.reduce(function(e,t){return e+(t.id+".")+t.variant},""),r=encodeURI(n);null!=r&&(e+="&experiments="+r)}return e}function GetOptimizeExperiments(){var e=[],t=GetCookie("_gaexp");if(t){var n=t.replace("GAX1.2.","").split("!");if(0<n.length)for(var r=0;r<n.length;r++){var i=n[r].split(".");if(3==i.length){var o=i[0],a=i[2];e.push({id:o,variant:a})}}}return e}function InstallerLinksPatcher(a,d){this.patch=function(e,t){var n=getPathname(document.referrer);"/how_to/how_to_convert_mov_to_avi_mp4"==n&&(e="https://download.freemake.net/products/F8A4408321C27E2410DEE7E4E260DCE9/FreemakeVideoConverterSetup.exe");var r=userIdProvider.GetUserId();if(~location.href.indexOf("?id=FreemakeDVDCopy.exe")&&(0<e.indexOf("FreemakeVideoConverterSetup")&&(e+="?customName=FreemakeDVDCopy_"+r+".exe"),0<t.indexOf("FreemakeVideoConverterFull")&&(t+="?customName=FreemakeDVDCopyFull_"+r+".exe")),~location.href.indexOf("?id=FreemakeDVDBurner.exe"))0<e.indexOf("FreemakeVideoConverterSetup")&&(e+="?customName=FreemakeDVDBurner_"+r+".exe"),0<t.indexOf("FreemakeVideoConverterFull")&&(t+="?customName=FreemakeDVDBurnerFull_"+r+".exe");else if(~location.href.indexOf("?id=FreemakeDVDRipper.exe"))0<e.indexOf("FreemakeVideoConverterSetup")&&(e+="?customName=FreemakeDVDRipper_"+r+".exe"),0<t.indexOf("FreemakeVideoConverterFull")&&(t+="?customName=FreemakeDVDRipperFull_"+r+".exe");else{var i=GetCookie("seamless_installation");if("/fr/free_video_downloader/"==n&&GetOptimizeExperimentVariant("otfu4QpbR0SgR5h8dZQhGA")&&i)setTimeout(function(){DeleteCookie("seamless_installation")},8e3),t=e="1"===GetOptimizeExperimentVariant("otfu4QpbR0SgR5h8dZQhGA")?"https://download.freemake.net/WS572/electron-fr-FreemakeVideoDownloaderSetup.exe":"https://download.freemake.net/products/A8992491127F31224A42FDB812585F26/FreemakeVideoDownloaderSetup.exe";else if("/es/free_video_downloader/"==n&&GetOptimizeExperimentVariant("JMmWf9ViTlKi8EtzktnLBw")&&i){setTimeout(function(){DeleteCookie("seamless_installation")},8e3),t=e="1"===GetOptimizeExperimentVariant("JMmWf9ViTlKi8EtzktnLBw")?"https://download.freemake.net/WS572/electron-es-FreemakeVideoDownloaderSetup.exe":"https://download.freemake.net/products/A12424794BE985DA872BF7C524883AE9/FreemakeVideoDownloaderSetup.exe"}if(0<e.indexOf("FreemakeVideoConverterSetup")&&(e+="?customName=FreemakeVideoConverterSetup_"+r+".exe"),0<t.indexOf("FreemakeVideoConverterFull")&&(t+="?customName=FreemakeVideoConverterFull_"+r+".exe"),0<e.indexOf("FreemakeVideoDownloaderSetup")&&(e+="?customName=FreemakeVideoDownloaderSetup_"+r+".exe"),0<t.indexOf("FreemakeVideoDownloaderFull")&&(t+="?customName=FreemakeVideoDownloaderFull_"+r+".exe"),n.startsWith("/free_video_downloader")&&void 0!==GetCookie("DownloadMacBuild")){var o="https://download.freemake.net/mac/FreemakeVideoDownloaderFull.pkg?customName=FreemakeVideoDownloaderFull_"+r+".pkg";t=e=o}}$(a).attr("href",e),$(d).attr("href",t)},this.isSuitablePage=function(){return 0<$(a).length||0<$(d).length}}function EmbeddedUrlsStorage(n){this.containsEmbeddedUrls=function(){return void 0!==GetCookie(n)},this.getEmbeddedUrls=function(){var e=GetCookie(n);return JSON.parse(decodeURIComponent(escape(window.atob(e))))},this.saveEmbeddedUrls=function(e){var t=(new Date).getTime()+864e5;SetCookieIfNeeded(n,window.btoa(unescape(encodeURIComponent(JSON.stringify(e)))),t)}}function ProductLinksPatchedDeterminator(){var t={fvc:!1,fvd:!1,fac:!1};this.setProductLinksPatched=function(e){t[e]=!0},this.allProductLinksPatched=function(){return t.fvc&&t.fvd&&t.fac}}function AnalyticsSender(t){this.sendSuccessEvent=function(){ga("frmTrackerOld.send","event","releaseRequests"+t,"getInstallerUrl","success"),gtag("event","getInstallerUrl",{eventCategory:"releaseRequests"+t,eventLabel:"success"})},this.sendFailureEvent=function(e){ga("frmTrackerOld.send","event","releaseRequests"+t,"getInstallerUrl","fail"),gtag("event","getInstallerUrl",{eventCategory:"releaseRequests"+t,eventLabel:"fail"})}}function CreateLinkProviders(e){return{FvcProvider:CreateLinkProvider("FreemakeVideoConverter",new FVCLinkPathCreatorFactory(e)),FvdProvider:CreateLinkProvider("FreemakeVideoDownloader",new FVDLinkPathCreatorFactory(e)),FacProvider:CreateLinkProvider("FreemakeAudioConverter",new StandardLinkPathCreatorFactory),FybProvider:CreateLinkProvider("FreemakeYouTubeToMP3Boom",new StandardLinkPathCreatorFactory),FmbProvider:CreateLinkProvider("FreemakeMusicBox",new StandardLinkPathCreatorFactory)}}function CreateLinkProvider(e,t){return new LinkProvider(t.GetLinkPathCreator(e))}function StandardLinkPathCreatorFactory(){this.GetLinkPathCreator=function(e){return new LinkPathCreator(e)}}function FVCLinkPathCreatorFactory(e){var t=this;t.operatingSystemChecker=e,t.GetLinkPathCreator=function(e){return t.operatingSystemChecker.IsXpClient()?new LinkPathCreatorForXP(e):new LinkPathCreatorForLogo(e)}}function FVDLinkPathCreatorFactory(e){var t=this;t.operatingSystemChecker=e,t.GetLinkPathCreator=function(e){return t.operatingSystemChecker.IsXpClient()?new LinkPathCreatorForXP(e):new LinkPathCreator(e)}}function LinkProvider(e){var t=this;t.linkPathCreator=e,t.GetOnlineLink=function(){return t.linkPathCreator.GetOnlineLink()},t.GetOfflineLink=function(){return t.linkPathCreator.GetOfflineLink()}}function OperatingSystemChecker(e){var t=this;t.userAgent=e||"",t.IsXpClient=function(){return-1!==t.userAgent.indexOf("Windows NT 5.1")||-1!==t.userAgent.indexOf("Windows XP")}}function LinkPathCreator(e){var t=this;t.fileName=e,t.domain="https://download.freemake.net",t.rootDirectory=UseAlternativeInstallersPath()?"/FreemakeOriginalsAlternative":"/Reserved",t.GetOnlineLink=function(){return t.domain+t.rootDirectory+"/"+t.fileName+"Setup.exe"},t.GetOfflineLink=function(){return t.domain+t.rootDirectory+"/"+t.fileName+"Full.exe"}}function LinkPathCreatorForLogo(e){var t=this;t.fileName=e,t.domain="https://download.freemake.net",t.rootDirectory=UseAlternativeInstallersPath()?"/FreemakeOriginalsAlternative":"/Reserved",t.GetOnlineLink=function(){return t.domain+t.rootDirectory+"/"+t.fileName+"Setup.exe"},t.GetOfflineLink=function(){return t.domain+t.rootDirectory+"/"+t.fileName+"Full.exe"}}function LinkPathCreatorForXP(e){var t=this;t.fileName=e,t.domain="https://download.freemake.net",t.rootDirectory="/FreemakeOriginals2",t.GetOnlineLink=function(){return t.domain+t.rootDirectory+"/XP/"+t.fileName+"Full.exe"},t.GetOfflineLink=function(){return t.domain+t.rootDirectory+"/XP/"+t.fileName+"Full.exe"}}$(document).ready(function(){!function(){window.productLinksPatchedDeterminator=new ProductLinksPatchedDeterminator;var e="Referrer",t=(new Date).getTime()+15552e6;SetSessionCookie(e,document.referrer,t);var r=GetLocationParameter(),i=window.location.hostname,o=GetCookie(e),a=navigator.userAgent,d=new OperatingSystemChecker(a),n=CreateLinkProviders(d);InitializeLinks(),InitializeLinksWithDistributionSystem(n,new DistributionSystemApiUrlBuilder(i,o,a,null,r),!1),$.ajax({type:"GET",url:"https://geoip.freemake.com/geoip.php",timeout:3e3}).done(function(e){InitializeLinksInternal(e,d,i,o,a,r)}).fail(function(){var t=(navigator.language||navigator.userLanguage).split("-")[0],e=[{key:"hi",value:"IN"},{key:"ur",value:"PK"},{key:"fl",value:"PH"},{key:"id",value:"ID"},{key:"ms",value:"ID"},{key:"tr",value:"TR"},{key:"ay",value:"PE"}],n=t.toUpperCase();e.some(function(e){return e.key==t})&&(n=e.find(function(e){return e.key==t}).value),InitializeLinksInternal(n,d,i,o,a,r)})}()});