Skip to content

Instantly share code, notes, and snippets.

@dlferro
Created December 5, 2013 05:06
Show Gist options
  • Save dlferro/7800443 to your computer and use it in GitHub Desktop.
Save dlferro/7800443 to your computer and use it in GitHub Desktop.
<html>
<head>
</head>
<body>
<div id="post">
<p id="test" data-textannotation-id="3a850d8670a8255343a9451b42f53eb3">Derrick Rose underwent a successful repair of his medial meniscus today. That's the good news. The bad news is that the Bulls have announced that Rose is done for the season.</p>
<p data-textannotation-id="ca49ebe0a4b38a6785a22c3fe1343c84">The long return time for Rose likely means that he had the meniscus repaired, instead of removed, all together or partially. That it could be salvaged is a good sign for future recovery, but that procedure takes longer to recover.</p>
<aside data-ids="482818589">RELATED
<div>
<div>
<div>
<div><a href="http://regressing.deadspin.com/how-will-a-meniscus-tear-affect-russell-westbrook-482818589"><img alt="" src="http://img.gawkerassets.com/img/18lujjzim2tc1jpg/k-small.jpg" /></a></div>
<h6 data-textannotation-id="b89428ca074f2d2dd2db49ec39cfba18"><a href="http://regressing.deadspin.com/how-will-a-meniscus-tear-affect-russell-westbrook-482818589">How Will A Meniscus Tear Affect Russell Westbrook?</a></h6>
<p data-textannotation-id="2693cdb2b0217ad569d05f22ba2ff89f">We learned today that Oklahoma City's Russell Westbrook will undergo surgery for a torn lateral meniscus in his right knee. This is great news… <a href="http://regressing.deadspin.com/how-will-a-meniscus-tear-affect-russell-westbrook-482818589">Read…</a></p>
</div>
</div>
</div>
</aside>
<p data-textannotation-id="9517930a0b15ca824fd63074d8095978">The partial tear and repair of the meniscus is broadly similar to <a href="http://regressing.deadspin.com/how-will-a-meniscus-tear-affect-russell-westbrook-482818589" target="_blank">Russell Westbrook's injury</a> from last year's playoffs. Westbrook's tear was to his lateral meniscus, which is generally a rarer and more problematic injury, and despite some complications with his repair procedure, he has come back looking as strong and fast and Westbrooky as you could hope this year.</p>
<p data-textannotation-id="d452f1a769e3cd9de9bc04d204c58453">That doesn't mean that Rose's recovery will look anything like that, though. It's obvious, but the severity of the tear has a lot to do with what Rose's recovery will look like. With Westbrook, we knew that the tear could be as small as two percent; we don't have any information on Rose's. Further, where the tear happens on the meniscus, and which direction it's torn in, matter as well. Again, we don't know anything about all that for Rose.</p>
<p data-textannotation-id="307451c1e4c559f824021ecf76279c2e">What we do know is that the meniscus handles shock absorption and stabilization in the knee. That's a problem for Rose. While he never really looked completely back to his old self (his<a href="http://stats.nba.com/playerTrackingDrives.html?pageNo=1&amp;rowsPerPage=100&amp;sortField=DVS_TOT&amp;sortOrder=DES" target="_blank">driving numbers were fine</a>, but not what you'd expect from him at peak health), he showed flashes of at least attempting to play the attacking style. And to make that work, you need your knees' shock absorbers to be in good condition. The medial meniscus would become especially important if you exist along the right baseline, as Rose often does.</p>
<p data-textannotation-id="9076aaff6f03463a0f762b3db4317ebd">There is room to hope—that all the added time off will improve his comfort with the left knee, or that the meniscus repair goes improbably well and hardly limits him—but those are reaching. And you can just as easily surmise (with very little official information to work with) that injuries are not discrete events in a player's life, but interacting, cascading changes to the body's mechanics, and adding a new complication to an already unideal chain cannot end in anything but more bad results.</p>
<p data-textannotation-id="010389921d792d5d2851971885445b59">Regardless of how the recovery goes, this is a damn tragedy. We'll have lost two full seasons of Derrick Rose, and when he comes back, he will likely be a diminished form of the diminished form that had been floating around the league this season.</p>
</div>
<script type="text/javascript">
var fcn=function(node, rx, rx2, depth, fcn){
//console.log('scan depth: ' + depth);
//console.log(rx, rx.source);
switch(node.nodeType){
case 1:
// we have an element
// if it's not an anchor and it matches our regex, process it
for(var x = 0, length = node.childNodes.length; x < length; x++) {
if(node.childNodes[x].tagName !== 'A' && rx2.test(node.innerHTML)) {
fcn(node.childNodes[x], rx, rx2, depth + 1, fcn);
}
}
break;
case 3:
// we have a text node
// examine the text
if(!rx2.test(node.nodeValue)){
// no match, exit
return;
}
alert('Found match');
var ar = String(node.nodeValue).split(rx);
var df = document.createDocumentFragment();
for(var z=0; z<ar.length; z++){
if(rx.test(ar[z])){
console.log('found: ' + RegExp.$1);
// create the link node to your specification
var span=document.createElement('span');
span.innerHTML = RegExp.$1;
span.className = "highlight";
df.appendChild(span);
}
else{
df.appendChild(document.createTextNode(ar[z]));
}
}
// replace the text node with the document fragment
node.parentNode.replaceChild(df, node);
break;
}
};
var term = "Derrick Rose";
var regexText = '(' + term + ')';
var regex = new RegExp(regexText, 'igm');
var regex2 = new RegExp(regexText, 'im');
var post = document.getElementById('post');
fcn(post,regex, regex2, 0,fcn);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment