NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Emphasizer and Reformatter II // @namespace http://your.homepage/ // @version 2.5 // @description Used to make certain words and phrases pop out on Gatehouse Media internal pages // @author Jason Pasnikowski // @match file:///G:* // @grant none // ==/UserScript== //WISHLIST // Add "pop-out" and "close" and "refresh" options to sliders // Make opening new slider close any others // var myList = document.getElementsByClassName("abc"); // myList[0].style.color = "red"; // make the first one red // Make annotation links pop open slider //Sourcing Summary: aggregate number of times sourced to top. // Clean up Ad History page // Fix up annotation page and include annotation list\ //Difference between annotations for the sites and for adcenter: // sites: https://atol5.gatehouseads.com/viewproof.aspx?PDF=ST-0001029865-03.pdf&VIEWCODE=12035&AD=ST-0001029865-03 //adcenter: https://atol5.gatehouseads.com/viewnotes.aspx?a=ST-0001029865-03.INDD&edit=y&user=ST35-VERONIC //Order changes to ad: https://atol5.gatehouseads.com/adorder.aspx?ad=CA-JJ1996.INDD&stype=CR&link=T //Alternate proof location? https://atol5.gatehouseads.com/pdfs/ST-0001029865-03.pdf //Emphasize SOME, EXACT and ARTISTIC in summary //document.head.innerHTML='<link rel="stylesheet" type="text/css" href="https://googledrive.com/host/0B-dVKRMsZIATZDRIcTJPXzBiSzQ/adinfo.css">'; document.head.innerHTML='<link rel="stylesheet" type="text/css" href="file:///G:/GH/SCRIPTS/adinfo.css">'; isFrameChild=location.href.search(/framechild/i); isProofChild=location.href.search(/proofchild/i); if(isFrameChild<0 && isProofChild<0){ //PARSE URL //Divide the page location path_segments= location.href.split("/"); //path_segments.forEach(ShowResults); if(path_segments[6]=="RM"||path_segments[6]=="DA"){ adType="fla"; fileDir=path_segments[7]+'/'+path_segments[8]; proofPath=path_segments[6]; proofExtention=".html"; fileName=path_segments[9]; } else if (path_segments[6]=="TEXT"){ adType="indd"; proofPath="graphics"; //Changed from Graphics?? proofExtention=".pdf"; fileDir=path_segments[7]; fileName=path_segments[8]; } //Get page path filePath = location.href.match(/(.*)\//); filePath=filePath[0]; //Get site code siteCode=fileName.match(/\w*(?=\-)/g); siteCode=siteCode[0]; //Get ad number from file name adNumber=fileName.match(/(?=\-).*(?=\_)/g); adNumber=adNumber[0].replace('-',''); //document.head.appendChild('<script type="text/javascript" ></script>'); noder = document.createElement("script"); noder.type="text/javascript"; //noder.src="https://googledrive.com/host/0B-dVKRMsZIATZDRIcTJPXzBiSzQ/adinfo.js"; noder.src="file:///G:/GH/SCRIPTS/adinfo.js"; document.head.appendChild(noder); originalContents=document.body.innerHTML.replace(/<hr>/g,"</div><div class='segment_box' >"); //Links to files submitted // find list of files // search for tables allCells=document.getElementsByTagName('td'); matchFile=/.*\.[a-zA-Z]{3,4}/ // List of items to clean up replaceList=[]; replaceList[0]=/shortened.*/; replaceList[1]=/ \(renamed from.*/; replaceList[2]=/.*\.(fla|indd|com).*/i; replaceList[3]=/ \;/; fileList=[]; for (var i = 0, len = allCells.length; i < len; i++) { //see if file name, if so, add to list under proof currentFile=allCells[i].innerHTML; for(var x=0, lenx=replaceList.length; x < lenx; x++){ currentFile=currentFile.replace(replaceList[x],""); } testFile=matchFile.exec(currentFile); if (testFile>''){ fileList[fileList.length]=testFile; } } // modify path depending on file type // graphics: pdf, jpg, png, tif, bmp // text: everything else? // search locations for matching filenames //Ad Proof proofLocation="G:/"+siteCode+"/dps-ads/"+proofPath+"/"+fileDir+"/"+siteCode+"-"+adNumber+proofExtention; document.body.innerHTML='<div id="rightPanel"><iframe id="adProof" src="'+proofLocation+'?proofchild"></iframe><div id="fileList"></div></div>'; findSiteReg = new RegExp(siteCode+"-", "g"); var isImage=[]; for (var i=0, len=fileList.length; i<len; i++) { singleItem=fileList[i]+""; if (singleItem.search(findSiteReg)<0){ singleItem=siteCode+'-'+singleItem; } if (singleItem.search(/\.(doc|docx|xls)/i)>-1){ fileLocation='g:/'+siteCode+"/DPS-ADS/TEXT/"+fileDir+"/"+singleItem; fileItem='<div id="fileItem_'+i+'" class="fileItem"><a href="'+fileLocation+'" target="_blank">'+fileList[i]+'</a></div>'; isImage[i]=0; } else if (singleItem.search(/\.(pdf)/i)>-1){ fileLocation='g:/'+siteCode+"/DPS-ADS/"+proofPath+"/"+fileDir+"/"+singleItem; fileItem='<div id="fileItem_'+i+'" class="fileItem"><iframe class="fileThumbnail" src="'+fileLocation+'"></iframe><a href="'+fileLocation+'" target="_blank"><iframe class="peekabooFile" src="'+fileLocation+'"></iframe>'+fileList[i]+'</a></div>'; isImage[i]=0; } else { fileLocation='g:/'+siteCode+"/DPS-ADS/"+proofPath+"/"+fileDir+"/"+singleItem; //fileItem='<div id="fileItem_'+i+'" class="fileItem"><img onload="document.getElementById(\'fileItem_'+i+'\').innerHTML+=this.naturalheight+\"x\"+this.naturalHeight" id="image_'+i+'" class="fileThumbnail" src="'+fileLocation+'"/><a href="'+fileLocation+'" target="_blank"><img class="peekabooFile" src="'+fileLocation+'"/>'+fileList[i]+'</a><br/></div>'; fileItem='<div id="fileItem_'+i+'" class="fileItem"><img onload="alert(this.naturalheight+\"x\"+this.naturalHeight)" id="image_'+i+'" class="fileThumbnail" src="'+fileLocation+'"/><a href="'+fileLocation+'" target="_blank"><img class="peekabooFile" src="'+fileLocation+'"/>'+fileList[i]+'</a><br/></div>'; isImage[i]=1; } document.getElementById('fileList').innerHTML+=fileItem; if (isImage[i]==1){ //currentImage=document.getElementById('image_'+i); // document.getElementById('fileItem_'+i).innerHTML+=currentImage.style.naturalheight+"x"+currentImage.naturalHeight; } } //Web-based proof, alternative //proofLocation2="https://atol5.gatehouseads.com/pdfs/"+siteCode+"-"+adNumber+".pdf"; //document.body.innerHTML+='<iframe id="adProof2" src="'+proofLocation2+'?proofchild" style="position:absolute;top:500px;right:0px;"></iframe>'; //Site Notes document.body.innerHTML+='<div id="sitenotes">Notes on <b>'+siteCode+'</b><br/><hr/><iframe id="sitenotesframe" src="https://googledrive.com/host/0B-dVKRMsZIATfktrRmJ5RHJyZDF5QmVKLWpZN2xSelJoWFk0c2h5X190QWxsM0l5S0xLVjA/'+siteCode+'.html"></iframe></div>'; document.body.innerHTML+='<div id="headerContent"><div id="headerConsole"></div><div id="infoTabsContainer"></div></div>'; document.body.innerHTML+='<div id="mainContent"></div>'; document.body.innerHTML+='<div id="footerContent"></div>'; headerConsole=document.getElementById('headerConsole'); infoTabsContainer=document.getElementById('infoTabsContainer'); mainContent=document.getElementById('mainContent'); footerContent=document.getElementById('footerContent'); //Ad info to header console headerConsole.innerHTML+='<div id="adTimer"></div><div id="adNumber"></div><div id="adMedium"></div><div id="discretionLevel"></div><div id=""></div>'; adTimer="<span id='time_spent'><span id='minutes'></span>:<span id='seconds'></span></span>"; document.getElementById("adTimer").innerHTML=adTimer; document.getElementById("adNumber").innerHTML=siteCode+'-'+adNumber.replace("SPAD","<span style='color:red;'>SPAD</span>"); mainContent.innerHTML=originalContents; //ad medium if(adType=="indd") {document.getElementById("adMedium").innerHTML+="Print ad";} if(adType=="fla") {document.getElementById("adMedium").innerHTML="<b style='font-size:2em;color:red;'>ONLINE AD</b> (2AdPro)"; } if(originalContents.search(/animated/i)>0||window.find("animation")>0||window.find("dynamic")>0) { document.getElementById('adMedium').innerHTML+="Animated <img src='http://www.netanimations.net/cat-dance-4.GIF' height='20px'> ";} //document.getElementById("animated").innerHTML+="<marquee style='color:red'>animated</marquee>"; if(originalContents.search(/static/i)>0) {document.getElementById("adMedium").innerHTML+="<span style='color:GRAY;width:100%;'>STATIC</span>";} //artistic direction artisticDirection='NO ARTISTIC DIRECTION PROVIDED'; tempArtisticDirection=originalContents.match(/(someDiscretion|Use artistic expression|Some interpretation|Use layout exactly as provided|Follow layout exactly)/i); if(tempArtisticDirection){artisticDirection=tempArtisticDirection[0];} document.getElementById('discretionLevel').innerHTML+=artisticDirection+"<br/>"; //Ad tabs to tab row in header infoTabsContainer.innerHTML+="<span class='infoTab' onclick=togglePanel('historyPanel');>History</span>"; adHistoryPage='http://adcenter.dpscloud.dpsadtrackercloud.com/pihistory.asp?element='+siteCode+'-'+adNumber+"."+adType+'&s_user_name=&s_operation=&s_temp1=&Button_DoSearch=Search'; //Sourcing History /* have to check fileDir to see if number is greater than ten, and subtract 10 if necesseary it:c_15 to c_05*/ if(adType=="indd"){ historyLocationMod=fileDir.substr(0, 2) + "0" + fileDir.substr(3,fileDir.length); if(historyLocationMod[3]=="0"){historyLocationMod=historyLocationMod.substr(0, 3) + "1" + historyLocationMod.substr(4,fileDir.length); } historyUrlMod="text"; } else {historyLocationMod=fileDir; historyUrlMod="RM";} infoTabsContainer.innerHTML+="<span class='infoTab' onclick=togglePanel('sourcingHistory');>Sourcing History</span>"; sourceHistoryLocation="G:/"+siteCode+"/dps-ads/"+historyUrlMod+"/"+historyLocationMod+"/"+siteCode+"-"+adNumber+"_JOB.HTML?framechild"; infoTabsContainer.innerHTML+="<span class='infoTab' onclick=togglePanel('standardMessages');>Standard Messages</span>"; standardMessages="http://adcenter.dpscloud.dpsadtrackercloud.com/default.asp?page_id=552"; if(adType=='fla'){ infoTabsContainer.innerHTML+="<span class='infoTab' onclick=togglePanel('onlineAdInfo');>Online Ad info</span>"; onlineAdInfo="https://docs.google.com/a/gatehousemedia.com/spreadsheets/d/18e10p06vpqHMoF9-ojZxvMwfKenaX72OxtRfrAntOEo/edit?usp=sharing"; document.body.innerHTML+='<div class="footerHidden" id="onlineAdInfo"><iframe class="footerIframe" id="onlineAdInfo" src="'+onlineAdInfo+'"></div>'; } //annotations /* * <p class='welcomemessage' style='color:red;'><strong>* ANNOTATIONS HAVE BEEN ADDED TO THIS AD *</strong></p> <p class='welcomemessage' style='color:red;'><strong><a href='http://mcdonoughvoice.gatehouseads.com/viewnotes.aspx?a=MA-091181.INDD&edit=n&user=MA11' target='_blank'>Click here to view notations</a></strong></p> */ //pattern="/\<div class=\"welcomemessage\"\>This submission includes new annotations\. \<a href=\"(.*)?\" target=\"_blank\"\>Click here to view/g"; pattern=/<div class=\"welcomemessage\">This submission includes new annotations\. <a href=\"(.*)?\" target=\"_blank\">Click here to view/g; annotationURL=pattern.exec(originalContents); if(annotationURL){ infoTabsContainer.innerHTML+="<span class='infoTab' onclick=togglePanel('annotations');>Annotations</span>"; document.body.innerHTML+='<div class="footerHidden" id="annotations"><iframe class="footerIframe" id="annotationsIframe" src="'+annotationURL[1]+'"></div>'; }; //Popup Display Panels at bottom document.body.innerHTML+='<div class="footerHidden" id="sourcingHistory"><iframe class="footerIframe" src="'+sourceHistoryLocation+'" ></div>'; document.body.innerHTML+='<div class="footerHidden" id="standardMessages"><iframe class="footerIframe" class="footerHidden" id="standardMessagesIframe" src="'+standardMessages+'"></div>'; document.body.innerHTML+='<div class="footerHidden" id="historyPanel"><iframe class="footerIframe" id="historyPanelIframe" src="'+adHistoryPage+'" ></div>'; //Timer var minutesLabel = document.getElementById("minutes"); var secondsLabel = document.getElementById("seconds"); var totalSeconds = 0; setInterval(setTime, 1000); function setTime() { ++totalSeconds; secondsLabel.innerHTML = pad(totalSeconds%60); minutesLabel.innerHTML = pad(parseInt(totalSeconds/60)); } function pad(val) { var valString = val + ""; if(valString.length < 2) { return "0" + valString; } else { return valString; } } } else { //if processing a child iframe: document.body.innerHTML=document.body.innerHTML.replace(/<hr>/g,"</div><div class='segment_box' >"); } /* * headerContent headerConsole infoTabs mainContent footerContent https://drive.google.com/open?id=0B-dVKRMsZIATZDRIcTJPXzBiSzQ&authuser=0 */