The following is a simple fix to enable CodePress for Chrome/Safari/WebKit. For a short term fix, extract the contents of the zip into your CodePress root folder and allow it to overwrite codepress.html. The fix is really two lines of code to make CodePress aware of WebKit useragents and a duplicated version of the Firefox "engine" as a starting point for WebKit. As people find bugs that need WebKit specific implementations, we can update engines/webkit.js accordingly. Let me know if there are questions or problems.
Below is a diff/patch of codepress.html in case you're interested:
diff codepress.html codepress.html
15c15
< else if(ua.match('KHTML')) engine = 'khtml';
---
> else if(ua.match('AppleWebKit')) engine = 'webkit';
30c30
< if(engine == "msie" || engine == "gecko") document.write('<body><pre> </pre></body>');
---
> if(engine == "msie" || engine == "gecko" || engine == "webkit") document.write('<body><pre> </pre></body>');
32d31
< // else if(engine == "khtml") document.write('<body> </body>');
See attached zip file...
View and moderate all "patches Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Patches"
first: Thanks! i needed this :-)
second: at least in chrome 16 the webit.js will crash the javascript execution.
in webkit.js find:
// put code inside editor
setCode : function() {
then find:
editor.innerHTML = code;
replace:
self.innerHTML = code;
and everything works perfect! :D thank you jlewin, i needed this
Last edit: Anonymous 2015-06-27