Skip to content

Commit

Permalink
updates to template
Browse files Browse the repository at this point in the history
  • Loading branch information
chrishanel committed Sep 10, 2021
1 parent cef70f3 commit 37cd49a
Showing 1 changed file with 40 additions and 17 deletions.
57 changes: 40 additions & 17 deletions content.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ var scrapeEpisodeData=function(){
let linkCollect = new Array;
let descriptionCollect = new String;
let audioIntro = new String;
let audioIntroLink = new String;
let audioOutro = new String;
let audioOutroLink = new String;
let audioInter = new Array;
let audioInterLinks = new Array;
let episodeTitle = new String;
let episodeDate = new String;
let clipboardText = new String;
let directLink = new String;

//get episode Date
let dateDiv = $('.postmeta').find('div').last();
Expand All @@ -20,14 +24,14 @@ var scrapeEpisodeData=function(){
let epLinkText = "*[" + window.location.href + " " + episodeTitle + "]\n"
linkCollect.push(epLinkText);

//direct download to mp3
directLink = $('.powerpress_link_d').attr('href');

//cycle through post and grab data we care about
$('.fullpostentry').find('p').each(function( index ) {
let textChecker = $(this).text();
console.log(typeof textChecker);
console.log(textChecker);

if (index == 0 ) {
console.log("new description");
let descriptRaw = $(this).text();
if (descriptRaw.startsWith("\n", 0)) {
descriptRaw = descriptRaw.substring(1);
Expand All @@ -37,79 +41,98 @@ var scrapeEpisodeData=function(){

else if (textChecker.startsWith("Link", 1)) {
$(this).find('a').each(function() {
console.log("new link");
let linkHref = $(this).attr('href');
let linkText = $(this).text();

let newLink = "*[" + linkHref + " " + linkText + "]\n"

linkCollect.push(newLink);
console.log(newLink);
});
}

else if ( textChecker.startsWith("Audio", 0)) {
let lines = textChecker.split("\n");
jQuery.each(lines, function( index ) {
console.log(this);
if (index == 0) {
audioIntro = this.substring(13);
console.log('new intro');
}

//outro is always last one
else if (index == lines.length - 1) {
audioOutro = this.substring(13);
console.log('new outro');
}

// interstitial if there's only one
else if (lines.length < 4) {
audioInter.push(this.substring(20));
console.log('new interstitial');
}

//interstitials when there's multiple
else {
audioInter.push(this.substring(22));
console.log('new interstitial');
}
});
}
});

clipboardText = "==Date==\n" + episodeDate + "\n\n==Summary==\n\'\'";
$('.fullpostentry').find('strong').each(function( index ) {

let strongText = $(this).text();
let potentialLink = $(this).next('a');

console.log(strongText);

if (strongText.startsWith("intr", 6)) {
console.log('intro');
audioIntroLink = potentialLink.attr('href');
}

else if (strongText.startsWith("inte", 6)) {
audioInterLinks.push( potentialLink.attr('href'));
}

else if (strongText.startsWith("outro", 6)) {
console.log('outro');
audioOutroLink = potentialLink.attr('href');
}
});

clipboardText = "{{#vardefine:downloadlink|" + directLink + "}}\n\n";
clipboardText += "==Date==\n" + episodeDate + "\n\n==Summary==\n\'\'";
clipboardText += descriptionCollect + "\'\'\n\n";
clipboardText += "==Topics==\n* {List or summarize the main topics, noting " +
"prominently mentioned players or teams and making internal " +
"wiki links to them (even if those pages have not been created " +
"yet).} \n\n==Intro==\n";
clipboardText += audioIntro;
clipboardText += "[" + audioIntroLink + " ";
clipboardText += audioIntro + "]";

if (audioInter.length > 0) {
let interHeader = audioInter.length > 1 ?
"\n\n==Interstitials==\n" : "\n\n==Interstitial==\n";
clipboardText += interHeader;
jQuery.each(audioInter, function( index ) {
clipboardText += this + "\n";
clipboardText += "[" + audioInterLinks[index] + " ";
clipboardText += this + "]\n";
});
clipboardText += "\n";
} else {
clipboardText += "\n\n";
}

clipboardText += "==Outro==\n" + audioOutro + "\n\n";
clipboardText += "==Outro==\n[" + audioOutroLink + " " + audioOutro + "]\n\n";
clipboardText += "==Banter==\n{- If applicable.\n- For banter, note " +
"prominent teams and players, and make internal links for " +
"them.\n- Links and mentions do NOT have to be made for " +
"players and teams mentioned in passing.}\n\n" +
"==Email Questions==\n* {For EMAIL episodes: note the " +
"question asker, transcribe the question, and link " +
"prominent teams and players.}\n\n" +
"==Play Index or StatBlast==\n{For PLAY INDEX segment: " +
"transcribe the Play Index scenario that the host is trying " +
"==Stat Blast==\n{For STAT BLAST segment: " +
"transcribe the scenario that the host is trying " +
"to answer (you do NOT have to transcribe the method used " +
"within the PI)}\n\n" +
"within the Stat Blast, but note its findings and andy other " +
"pertinent info.)}\n\n" +
"==Notes==\n* {List noteworthy tangents, quotes, " +
"highlights, miscellany not covered above.}\n\n" +
"==Links==\n";
Expand Down

0 comments on commit 37cd49a

Please sign in to comment.