⚡ NEW: Changeset/ - Complete Album!

Changeset 2756817


Ignore:
Timestamp:
07/15/2022 10:23:24 AM (3 years ago)
Author:
jasonny
Message:

0.1.3

Location:
headlineengine/trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • headlineengine/trunk/dist/headlineengine-admin.js

    r2755068 r2756817  
    1 !function(){"use strict";jQuery("#headlineengine_load_powerwords").click((async function(){const e=await(await fetch(headlineengine_powerwords_url)).text();jQuery("#headlineengine_powerwords_list").val(e)}))}();
     1(function () {
     2    'use strict';
     3
     4    jQuery("#headlineengine_load_powerwords").click(async function() {
     5        const powerword_list = await (await fetch(headlineengine_powerwords_url)).text();
     6        jQuery("#headlineengine_powerwords_list").val(powerword_list);
     7    });
     8
     9})();
    210//# sourceMappingURL=headlineengine-admin.js.map
  • headlineengine/trunk/dist/headlineengine-admin.js.map

    r2755068 r2756817  
    1 {"version":3,"file":"headlineengine-admin.js","sources":["../src/headlineengine-admin.js"],"sourcesContent":["jQuery(\"#headlineengine_load_powerwords\").click(async function() {\n    const powerword_list = await (await fetch(headlineengine_powerwords_url)).text();\n    jQuery(\"#headlineengine_powerwords_list\").val(powerword_list);\n});"],"names":["jQuery","click","async","powerword_list","fetch","headlineengine_powerwords_url","text","val"],"mappings":"yBAAAA,OAAO,mCAAmCC,OAAMC,iBAC5C,MAAMC,cAA8BC,MAAMC,gCAAgCC,OAC1EN,OAAO,mCAAmCO,IAAIJ"}
     1{"version":3,"file":"headlineengine-admin.js","sources":["../src/headlineengine-admin.js"],"sourcesContent":["jQuery(\"#headlineengine_load_powerwords\").click(async function() {\n    const powerword_list = await (await fetch(headlineengine_powerwords_url)).text();\n    jQuery(\"#headlineengine_powerwords_list\").val(powerword_list);\n});"],"names":[],"mappings":";;;IAAA,MAAM,CAAC,iCAAiC,CAAC,CAAC,KAAK,CAAC,iBAAiB;IACjE,IAAI,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,KAAK,CAAC,6BAA6B,CAAC,EAAE,IAAI,EAAE,CAAC;IACrF,IAAI,MAAM,CAAC,iCAAiC,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAClE,CAAC,CAAC;;;;;;"}
  • headlineengine/trunk/dist/headlineengine-gutenberg.css

    r2755068 r2756817  
    2424}
    2525#headlineengine-score-container .headlineengine-score-bad {
    26   background-color: rgba(255, 0, 0, 0.6);
    27   border-color: rgba(255, 0, 0, 0.6);
     26  background-color: rgb(179, 179, 179);
     27  border-color: rgba(109, 109, 109, 0.6);
    2828}
    2929#headlineengine-score-container .headlineengine-score-okay {
  • headlineengine/trunk/dist/headlineengine-gutenberg.js

    r2755068 r2756817  
    1 !function(){"use strict";function e(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}!function n(t,r,i){function o(s,l){if(!r[s]){if(!t[s]){if(!l&&e)return e(s,!0);if(a)return a(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[s]={exports:{}};t[s][0].call(c.exports,(function(e){var n=t[s][1][e];return o(n||e)}),c,c.exports,n,t,r,i)}return r[s].exports}for(var a=e,s=0;s<i.length;s++)o(i[s]);return o}({1:[function(e,n,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(n,t,r){return t&&e(n.prototype,t),r&&e(n,r),n}}(),i=function(){function e(){!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,null,[{key:"fleschKincaidGradeLevel",value:function(e){var n=this.wordCount(e);return n/this.sentenceCount(e)*.39+this.syllableCount(e)/n*11.8-15.59}},{key:"fleschReadingEaseScore",value:function(e){var n=this.wordCount(e);return 206.835-n/this.sentenceCount(e)*1.015-this.syllableCount(e)/n*84.6}},{key:"sentenceCount",value:function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:/[\.?!]/,t=[],r=e.split(n),i=r.length-1;i>=0;i--){var o=r[i].trim();""!=o&&t.push(o)}return t.length}},{key:"syllableCount",value:function(e){if("string"!=typeof e&&!(e instanceof Array))return null;e instanceof Array&&(e=e.join(" "));for(var n=this.getWords(e),t=0,r=n.length-1;r>=0;r--)t+=this.wordSyllableCount(n[r]);return t}},{key:"wordSyllableCount",value:function(e){var n=void 0;return(e=e.toLowerCase()).length<=3?1:(n=(e=(e=e.replace(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/,"")).replace(/^y/,"")).match(/[aeiouy]{1,2}/g))?n.length:0}},{key:"wordCount",value:function(e){return this.getWords(e).length}},{key:"getWords",value:function(e){for(var n=[],t=void 0,r=(e=this.removePunctuation(e)).split(" "),i=0;i<r.length;i++)""!=(t=r[i].trim())&&n.push(t);return n}},{key:"removePunctuation",value:function(e){return e.replace(/[^a-zA-z ]/g,"")}}]),e}();t.default=i},{}],2:[function(e,n,t){var r=function(e){return e&&e.__esModule?e:{default:e}}(e("./models/wordsmith"));window.Wordsmith=r.default},{"./models/wordsmith":1}]},{},[2]);var n,t,r={exports:{}};n=r,t=r.exports,function(e){function r(e,n){if(!(this instanceof r))return new r(e,n);this.domain=[],this.range=[],Array.isArray(e)&&(this.domain=e),Array.isArray(n)&&(this.range=n);var t=function(e){if("number"!=typeof e)return null;var n=this.domain[0],t=this.domain[1],r=this.range[0],i=this.range[1];"number"!==r&&"number"!=typeof i&&(r=n,i=t);const o=r+(i-r)/(t-n)*(e-n);return o===1/0?i:o===-1/0||isNaN(o)?r:o}.bind(this);return t.domain=function(e){return Array.isArray(e)&&(this.domain=e),t}.bind(this),t.range=function(e){return Array.isArray(e)&&(this.range=e),t}.bind(this),t}n.exports&&(t=n.exports=r),t.LinearScale=r}();var i=r.exports;let o=null;function a(e,n,t){const r=Math.min(t[0],t[1]),o=Math.max(t[0],t[1]);if(e<r||e>o)return 0;if(e===n)return 1;let a,s;e<n?(a=[0,n-r],s=e-r):(a=[0,o-n],s=e-n);return i(a,[0,1])(s)}async function s(e){o=await async function(){return o||(await jQuery.get(headlineengine_powerwords_api).catch((e=>(console.log("Could not load powerwords list"),[])))).map((e=>e.toLowerCase()))}();const n=[headlineengine_readability_range_min||45,headlineengine_readability_range_max||90],t=headlineengine_readability_target||55,r=n[0],i=n[1],s=["Good","Too Simple","Too Complex"],l=[headlineengine_length_range_min||40,headlineengine_length_range_max||90],u=headlineengine_length_target||82,c=["Good","Too Short","Too Long"];const d=function(e){if(!e)return;const n=e.length;let t=0;return n<l[0]?t=1:n>l[1]&&(t=2),{score:a(n,u,l),rating:t,length:n,message:c[t],pass:n>=l[0]&&n<=l[1]}}(e),h=function(e){if(!e)return;const o=Wordsmith.fleschReadingEaseScore(e);let l=0;return o<r?l=2:o>i&&(l=1),{ease_score:o,score:a(o,t,n),rating:l,ease_score:o,message:s[l],pass:o>=r&&o<=i}}(e),g=function(e){if(!e)return;const n=(e=e.toLowerCase().replace(/[^a-z]/g," ")).split(" ").filter((e=>e.length>3)).filter((e=>o.includes(e)));return{score:n.length?1:0,rating:n.length,words:n,pass:n.length>0}}(e),f=d.pass+h.pass+g.pass,y=f>=3?"good":f>=1?"okay":"bad";return{length:d,readability:h,powerwords:g,total_score:(d.score+h.score+g.score)/3,rating:y}}const l=".editor-post-title__input";!async function(){async function e(e){const n=jQuery(l).first().text();if(!n||!n.trim().length)return e.html(""),!1;const t=await s(n),r=jQuery(`\n        <div class='headlineengine-score headlineengine-score-${t.rating}'>\n            <div class='headlineengine-score-value headlineengine-score-value-${t.rating}'>${Math.floor(100*t.total_score)}</div>\n            <div class='headlineengine-score-title'>HeadlineEngine<br>Score</div>\n        </div>`),i=jQuery(`<div class="headlineengine-analysis">\n            <div class="headlineengine-analysis-readability">Readability: ${t.readability.message} (${Math.round(t.readability.ease_score)})</div>\n            <div class="headlineengine-analysis-length">Length: ${t.length.message} (${t.length.length})</div>\n            <div class="headlineengine-analysis-powerwords">Powerwords: ${t.powerwords.words.length?t.powerwords.words.map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join(", "):"None"}</div>\n        </div>`);return e.html(r),e.append(i),!0}jQuery((async()=>{let n=jQuery(l);for(;!n.length;)await new Promise((e=>setTimeout(e,200))),n=jQuery(l);const t=jQuery(".edit-post-visual-editor__post-title-wrapper"),r=jQuery("<div id='headlineengine-score-container'></div>");t.after(r),r.hide(),e(r)&&r.slideDown(),n.on("keyup",(function(n){e(r)})),n.on("focus",(function(n){r.stop().stop(),e(r),r.slideDown()})),n.on("blur",(function(e){r.delay(1e3).slideUp()}))}))}()}();
     1(function () {
     2    'use strict';
     3
     4    var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
     5
     6    var linearScale = {exports: {}};
     7
     8    (function (module, exports) {
     9        (function(root) {
     10
     11          function LinearScale(domain, range) {
     12            if (!(this instanceof LinearScale)) {
     13              return new LinearScale(domain, range);
     14            }
     15            this.domain = [];
     16            this.range = [];
     17
     18            if (Array.isArray(domain)) {
     19              this.domain = domain;
     20            }
     21            if (Array.isArray(range)) {
     22              this.range = range;
     23            }
     24
     25            var scale = function(value) {
     26              if (typeof value !== 'number') {
     27                return null;
     28              }
     29
     30              var minValue = this.domain[0];
     31              var maxValue = this.domain[1];
     32
     33              var minScale = this.range[0];
     34              var maxScale = this.range[1];
     35
     36              if (minScale !== 'number' && typeof maxScale !== 'number') {
     37                minScale = minValue;
     38                maxScale = maxValue;
     39              }
     40
     41              var ratio = (maxScale - minScale) / (maxValue - minValue);
     42              const result = minScale + ratio * (value - minValue);
     43
     44              if (result === Infinity) return maxScale;
     45              else if (result === -Infinity) return minScale;
     46              else if (isNaN(result)) return minScale;
     47
     48              return result
     49            }.bind(this);
     50
     51            scale.domain = function(value) {
     52              if (Array.isArray(value)) {
     53                this.domain = value;
     54              }
     55              return scale;
     56            }.bind(this);
     57
     58            scale.range = function(value) {
     59              if (Array.isArray(value)) {
     60                this.range = value;
     61              }
     62              return scale;
     63            }.bind(this);
     64
     65            return scale;
     66          }
     67
     68          {
     69            if (module.exports) {
     70              exports = module.exports = LinearScale;
     71            }
     72            exports.LinearScale = LinearScale;
     73          }
     74
     75        })();
     76    } (linearScale, linearScale.exports));
     77
     78    var LinearScale = linearScale.exports;
     79
     80    function commonjsRequire(path) {
     81        throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
     82    }
     83
     84    var pluralize$1 = {exports: {}};
     85
     86    /* global define */
     87
     88    (function (module, exports) {
     89        (function (root, pluralize) {
     90          /* istanbul ignore else */
     91          if (typeof commonjsRequire === 'function' && 'object' === 'object' && 'object' === 'object') {
     92            // Node.
     93            module.exports = pluralize();
     94          } else {
     95            // Browser global.
     96            root.pluralize = pluralize();
     97          }
     98        })(commonjsGlobal, function () {
     99          // Rule storage - pluralize and singularize need to be run sequentially,
     100          // while other rules can be optimized using an object for instant lookups.
     101          var pluralRules = [];
     102          var singularRules = [];
     103          var uncountables = {};
     104          var irregularPlurals = {};
     105          var irregularSingles = {};
     106
     107          /**
     108           * Sanitize a pluralization rule to a usable regular expression.
     109           *
     110           * @param  {(RegExp|string)} rule
     111           * @return {RegExp}
     112           */
     113          function sanitizeRule (rule) {
     114            if (typeof rule === 'string') {
     115              return new RegExp('^' + rule + '$', 'i');
     116            }
     117
     118            return rule;
     119          }
     120
     121          /**
     122           * Pass in a word token to produce a function that can replicate the case on
     123           * another word.
     124           *
     125           * @param  {string}   word
     126           * @param  {string}   token
     127           * @return {Function}
     128           */
     129          function restoreCase (word, token) {
     130            // Tokens are an exact match.
     131            if (word === token) return token;
     132
     133            // Lower cased words. E.g. "hello".
     134            if (word === word.toLowerCase()) return token.toLowerCase();
     135
     136            // Upper cased words. E.g. "WHISKY".