nytimes / emphasis Goto Github PK
View Code? Open in Web Editor NEWDynamic Deep-Linking and Highlighting
Home Page: open.nytimes.com
Dynamic Deep-Linking and Highlighting
Home Page: open.nytimes.com
IE doesn't running addCSS() starting at line 67 in emphasis-src.js, and the reason is st.innerHTML. If you try opening any article on NYTimes (and any subsequent websites that have implemented this version of Emphasis) in IE, you will see an "Unknown runtime error."
I've recently added a jQuery fork of Emphasis onto my own site and ran into the same problem. Here's the fix I employed:
addCSS: function() {
/* Inject the minimum styles rules required */
var st = document.createElement('style');
// for xhtml validation goodness
st.setAttribute('type', 'text/css');
// placed all the css in a variable
var stStr = 'p.' + this.classActive + ' span { background-color:#f2f4f5; } p span.' + this.classHighlight + ' { background-color:#fff0b3; } span.' + this.classInfo + ' { position:absolute; margin:-1px 0px 0px -8px; padding:0; font-size:10px; background-color: transparent !important} span.' + this.classInfo + ' a { text-decoration: none; } a.' + this.classActiveAnchor + ' { color: #000; font-size: 11px; }';
// try it the current way, if it fails (and it will in IE) do it the way that works in IE.
try {
st.innerHTML = stStr;
} catch(e) {
st.styleSheet.cssText = stStr;
}
document.getElementsByTagName("head")[0].appendChild(st);
},
The handy paragraph symbol doesn't appear next to ol or ul. It also doesn't seem possible to highlight any text that appears in lists.
If you click to select a sentence that contains a quote, and that quote terminates the sentence, the highlighting process doesn't stop until it hits the end of a following "plain" sentence.
This case doesn't exist in the demo document, so we have to construct it.
Steps:
If we happen to have consecutive terminal quotes, the process repeats until a "plain" sentence is reached. Rearranging the demo document again:
I cloned, tested the demo with several web browsers, it doesn't do anything. What's wrong, is it me?
Just a heads-up...
Tested this against FF and Chrome. Works in FF, but double shift, paragraph selection and URL building don't seem to work in Chrome. Also, Chrome takes a built url and highlights the appropriate sentence, but does not seem to scroll/focus to the highlighted area.
Could you please create a gh-pages
branch so the demo can be viewed here at Github? I did it in my fork and it lets people play with the demo right away, which is nice. Instructions on how to do it are here.
Unfortunately I don't think pull requests can create branches, otherwise I'd submit one...
I am not trying to use the updated to .js with wp-emphasis plugin, I have replaced the js files but It seems doesn't work.
Removing the $ and $$ calls, of course. But what else?
Out-dated Twitter handlie in copyright and credits. @ravelrumba has been depreciated in favor of @robflaherty
I am working on integrating emphasis for use with iPhones and iPads. I can not seem to activate emphasis from my iPad.
Do I need to implement another event that will work on mobile devices? Has anyone already done this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.