ep_readability
Advanced tools
Comparing version 0.0.19 to 0.0.20
{ "parts": [ | ||
{ "name": "pushbutton" | ||
, "hooks": { "eejsBlock_editbarMenuRight": "ep_readability/index" } | ||
, "hooks": { | ||
"eejsBlock_editbarMenuRight": "ep_readability/index" | ||
, "eejsBlock_scripts": "ep_readability/index" } | ||
, "client_hooks": { | ||
"documentReady": "ep_readability/static/js/readability_button.js" | ||
, "postAceInit": "ep_readability/static/js/readability_button.js" | ||
, "aceKeyEvent": "ep_readability/static/js/readability_button.js" } | ||
, "aceKeyEvent": "ep_readability/static/js/readability_button.js" | ||
, "aceEditorCSS": "ep_readability/static/js/readability_button.js" | ||
} | ||
} | ||
] | ||
} |
10
index.js
@@ -9,1 +9,11 @@ var eejs = require('ep_etherpad-lite/node/eejs') | ||
}; | ||
exports.eejsBlock_scripts = function (hook_name, args, cb) { | ||
args.content = args.content + "<script src='../static/plugins/ep_readability/static/js/jquery.highlight.js'></script>"; | ||
return cb(); | ||
} | ||
/*exports.eejsBlock_styles = function (hook_name, args, cb) { | ||
args.content = args.content + "<link href='../static/plugins/ep_readability/static/css/jquery.highlight.css' rel='stylesheet'>"; | ||
return cb(); | ||
}*/ |
{ | ||
"name": "ep_readability", | ||
"version": "0.0.19", | ||
"version": "0.0.20", | ||
"description": "Calculates the Flesch readability index in Etherpad, client based.", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -30,8 +30,2 @@ # Click button to calculate the Flesch readability index | ||
## Demo | ||
A demonstration can be found here: | ||
`http://palinode-langeweile.rhcloud.com` | ||
# Install | ||
@@ -45,2 +39,6 @@ | ||
# Code | ||
https://github.com/xErik/ep_readability | ||
# TODO | ||
@@ -47,0 +45,0 @@ |
@@ -49,3 +49,3 @@ // ---------------------------------------------------------------------------- | ||
console.log(text); | ||
//console.log(text); | ||
@@ -258,3 +258,3 @@ return text; | ||
// @TODO proper language detection | ||
exports.detectLangage = function(text) { | ||
/*exports.detectLangage = function(text) { | ||
var lang = 'en'; | ||
@@ -268,4 +268,23 @@ if(text != null) { | ||
return lang; | ||
} | ||
}*/ | ||
exports.doTest = function(text) { | ||
console.log(text); | ||
} | ||
// Puts the JS not in the right place | ||
/*exports.aceInitInnerdocbodyHead = function(hook, context) { | ||
//console.log(); | ||
//context.iframeHTML.push('<script src="http://github.com/bartaz/sandbox.js/raw/master/jquery.highlight.js"></script>'); | ||
context.iframeHTML.push('<script src="../static/plugins/ep_readability/static/js/jquery.highlight.js"></script>'); | ||
return context.iframeHTML; | ||
};*/ | ||
exports.aceEditorCSS = function(){ | ||
return ['ep_readability/static/css/editor.css']; | ||
}; | ||
exports.documentReady = function(hook_name, args, cb) { | ||
@@ -276,7 +295,7 @@ | ||
var text = $('iframe[name="ace_outer"]').contents().find('iframe').contents().find("#innerdocbody").html(); | ||
exports.doTest(text); | ||
var resultFlesch = window._('readability.noResultYet'); | ||
var myColor = 'transparent'; | ||
var myCategory = window._('readability.readability'); // not a category at this point | ||
var toolTip = window._('readability.readability.calculate') + "\n\n" | ||
+ window._('readability.info.advice'); | ||
var toolTip = window._('readability.readability.calculate') + "\n\n" + window._('readability.info.advice'); | ||
//var lang = exports.detectLangage(text); | ||
@@ -288,3 +307,2 @@ text = exports.cleanText(text); | ||
jQuery.each(colorOrder, function(index, item) { | ||
//alert(result.flesch +" - "+ item) | ||
if(result.flesch > item) { | ||
@@ -305,3 +323,3 @@ myColor = color[item].color; | ||
} | ||
$('iframe[name="ace_outer"]').contents().find('iframe').contents().find("#innerdocbody").highlight(/\bund\b/gi); | ||
// @TODO set a single style attribute, not all of them | ||
@@ -308,0 +326,0 @@ $('#calculateReadabilityButton').attr('title', toolTip); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34263
522
76