import QtQml 2.0 import QOwnNotesTypes 1.0 Script { property string charSpaceName property string charSpaceLeftName property int charSpaceLeftTarget property string charNoSpaceName property string charNoSpaceLeftName property int charNoSpaceLeftTarget property string wordsName property string wordsLeftName property int wordsLeftTarget property string paragraphsName property string paragraphsLeftName property int paragraphsLeftTarget property string readTimeName property int readTimeRate property variant settingsVariables: [ { "identifier": "charSpaceName", "name": "Characters including spaces counter name", "description": "Put a counter name here or leave empty to disable", "type": "string", "default": "Chars", }, { "identifier": "charSpaceLeftName", "name": "Characters including spaces left until target counter name", "description": "Put a counter name here or leave empty to disable", "type": "string", "default": "", }, { "identifier": "charSpaceLeftTarget", "name": "Target number of characters including spaces", "description": "Put number of characters including spaces to count down to", "type": "integer", "default": "0", }, { "identifier": "charNoSpaceName", "name": "Characters without spaces counter name", "description": "Put a counter name here or leave empty to disable", "type": "string", "default": "", }, { "identifier": "charNoSpaceLeftName", "name": "Characters without spaces left until target counter name", "description": "Put a counter name here or leave empty to disable", "type": "string", "default": "", }, { "identifier": "charNoSpaceLeftTarget", "name": "Target number of characters without spaces", "description": "Put number of characters without spaces to count down to", "type": "integer", "default": "0", }, { "identifier": "wordsName", "name": "Words counter name", "description": "Put a counter name here or leave empty to disable", "type": "string", "default": "Words", }, { "identifier": "wordsLeftName", "name": "Words left until target counter name", "description": "Put a counter name here or leave empty to disable", "type": "string", "default": "", }, { "identifier": "wordsLeftTarget", "name": "Target number of words", "description": "Put number of words to count down to", "type": "integer", "default": "0", }, { "identifier": "paragraphsName", "name": "Paragraphs counter name", "description": "Put a counter name here or leave empty to disable", "type": "string", "default": "", }, { "identifier": "paragraphsLeftName", "name": "Paragraphs left until target counter name", "description": "Put a counter name here or leave empty to disable", "type": "string", "default": "", }, { "identifier": "paragraphsLeftTarget", "name": "Target number of paragraphs", "description": "Put number of paragraphs to count down to", "type": "integer", "default": "0", }, { "identifier": "readTimeName", "name": "Expected time to read a note", "description": "Put a counter name here or leave empty to disable", "type": "string", "default": "Reading time", }, { "identifier": "readTimeRate", "name": "Reading speed rate in words per minute", "description": "Adjust reading time counter from declamation (120-180) to speed reading (>300)", "type": "integer", "default": "300", } ] function init() { script.registerLabel("note stats") } function sec2time(seconds) { var hours = Math.floor(seconds / 3600) var minutes = Math.floor((seconds - (hours * 3600)) / 60) var seconds = seconds - (hours * 3600) - (minutes * 60) var time = "" if (hours != 0) { time = hours + ":" } if (minutes != 0 || time !== "") { minutes = (minutes < 10 && time !== "") ? "0" + minutes : String(minutes) time += minutes + ":" } if (time === "") { time = seconds + "s" } else { time += (seconds < 10) ? "0" + seconds : String(seconds) } return time } function noteStats(note) { var entry = "