Changeset 1472563
- Timestamp:
- 08/11/2016 07:51:32 PM (9 years ago)
- Location:
- simterm/trunk
- Files:
-
- 7 edited
-
CHANGELOG (modified) (1 diff)
-
js/show-your-terms.js (modified) (4 diffs)
-
js/show-your-terms.min.js (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
simterm-core.php (modified) (2 diffs)
-
simterm-settings.php (modified) (1 diff)
-
simterm.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
simterm/trunk/CHANGELOG
r1467684 r1472563 1 20160811 Gaspar Fernández <[email protected]> 2 * Main JS update, now supports pause on lines 3 * Ability to change theme in the shortcut [simterm theme="dark"]...[/simterm] 4 * Version tagged 0.2.4 5 1 6 20160804 Gaspar Fernández <[email protected]> 2 7 * < and > are now visible, not stripped. -
simterm/trunk/js/show-your-terms.js
r1465197 r1472563 65 65 }; 66 66 67 ShowYourTerms.prototype.addCommand = function(content, options) { 68 return this.content[0].push(["command", content, options]); 67 ShowYourTerms.prototype.addCommand = function(content, options, outputTerm) { 68 if (outputTerm == null) { 69 outputTerm = 0; 70 } 71 if (outputTerm < this.content.length) { 72 return this.content[outputTerm].push(["command", content, options]); 73 } 69 74 }; 70 75 71 ShowYourTerms.prototype.addLine = function(content, options) { 72 return this.content[0].push(["line", content, options]); 76 ShowYourTerms.prototype.addLine = function(content, options, outputTerm) { 77 if (outputTerm == null) { 78 outputTerm = 0; 79 } 80 if (outputTerm < this.content.length) { 81 return this.content[outputTerm].push(["line", content, options]); 82 } 73 83 }; 74 84 … … 123 133 124 134 ShowYourTerms.prototype.outputGenerator = function(output, outputTerm) { 125 var content, counter, currentLine, interval, options, speed, type;135 var content, counter, currentLine, interval, options, pauseInterval, speed, type; 126 136 type = output[0], content = output[1], options = output[2]; 127 137 currentLine = document.createElement("div"); … … 136 146 currentLine.classList.add('active'); 137 147 if (type === "command") { 148 if (!currentLine.classList.contains('type')) { 149 currentLine.classList.add('command'); 150 } 138 151 counter = 0; 139 152 return interval = setInterval(((function(_this) { … … 152 165 })(this)), speed); 153 166 } else { 154 currentLine.appendChild(document.createTextNode(content)); 155 this.container[outputTerm].appendChild(currentLine); 156 currentLine.classList.remove('active'); 157 return this.callNextOutput(options.delay, outputTerm); 167 if (!this.isPlaying(outputTerm)) { 168 return pauseInterval = setInterval(((function(_this) { 169 return function() { 170 if (_this.isPlaying(outputTerm)) { 171 clearInterval(pauseInterval); 172 return _this.callNextOutput(options.delay, outputTerm); 173 } 174 }; 175 })(this)), speed); 176 } else { 177 currentLine.appendChild(document.createTextNode(content)); 178 this.container[outputTerm].appendChild(currentLine); 179 currentLine.classList.remove('active'); 180 return this.callNextOutput(options.delay, outputTerm); 181 } 158 182 } 159 183 }; -
simterm/trunk/js/show-your-terms.min.js
r1465197 r1472563 1 /*! show-your-terms - Kande Bonfim <[email protected]> - 2016-0 7-27*/2 (function(){this.ShowYourTerms=function(){function a(a,b,c){var d,e,f,g,h,i,j;this.container=a,this.replay=null!=b?b:!0,this.termsOptions=null!=c?c:{},d={single:!1,pauseOnClick:!0};for(g in d)j=d[g],g in this.termsOptions||(this.termsOptions[g]=j);if(this.container.nodeType||(this.container=document.querySelectorAll(this.container)),this.content=[],this.sstatus=[],this.outputIndex=[],this.container.length>0)for(i=this.container.length-1,this.termsOptions.single&&(i=0),e=f=0,h=i;h>=0?h>=f:f>=h;e=h>=0?++f:--f)this.content[e]=[],this.sstatus[e]="ready",this.defineEvents(e),this.container[e].innerText.length>0&&this.declarativeBuilder(e)}return a.prototype.declarativeBuilder=function(a){var b,c,d,e;for(e=this.container[a].children,c=0,d=e.length;d>c;c++)b=e[c],this.content[a].push([b.getAttribute("data-action"),b.innerText,{styles:b.classList,delay:b.getAttribute("data-delay"),speed:b.getAttribute("data-speed")}]);return this.container[a].style.minHeight=window.getComputedStyle(this.container[a],null).getPropertyValue("height"),this.play(a)},a.prototype.defineEvents=function(a){return this.termsOptions.pauseOnClick?this.container[a].addEventListener("click",function(b){return function(){return b.togglePause(a)}}(this)):void 0},a.prototype.addCommand=function(a,b ){return this.content[0].push(["command",a,b])},a.prototype.addLine=function(a,b){return this.content[0].push(["line",a,b])},a.prototype.play=function(a){return null==a&&(a=0),"ready"===this.sstatus[a]?(this.sstatus[a]="playing",this.container[a].innerHTML="",this.outputIndex[a]=0,this.outputGenerator(this.content[a][this.outputIndex[a]],a)):void 0},a.prototype.playagain=function(a){return null==a&&(a=0),this.sstatus[a]="ready",this.play(a)},a.prototype.callNextOutput=function(a,b){return this.outputIndex[b]+=1,this.content[b][this.outputIndex[b]]?setTimeout(function(a){return function(){return a.outputGenerator(a.content[b][a.outputIndex[b]],b)}}(this),a):this.replay?setTimeout(function(a){return function(){return a.playagain(b)}}(this),a):void 0},a.prototype.isPlaying=function(a){return"playing"===this.sstatus[a]},a.prototype.togglePause=function(a){return"playing"===this.sstatus[a]?this.sstatus[a]="pause":"pause"===this.sstatus[a]?this.sstatus[a]="playing":void 0},a.prototype.outputGenerator=function(a,b){var c,d,e,f,g,h,i;return i=a[0],c=a[1],g=a[2],e=document.createElement("div"),g.styles&&e.setAttribute("class",g.styles),h=g.speed?g.speed:100,e.classList.add("active"),"command"===i?(d=0,f=setInterval(function(a){return function(){return a.isPlaying(b)&&(e.appendChild(document.createTextNode(c[d])),a.container[b].appendChild(e),d++,d===c.length)?(e.classList.remove("active"),a.callNextOutput(g.delay,b),clearInterval(f)):void 0}}(this),h)):(e.appendChild(document.createTextNode(c)),this.container[b].appendChild(e),e.classList.remove("active"),this.callNextOutput(g.delay,b))},a}()}).call(this);1 /*! show-your-terms - Kande Bonfim <[email protected]> - 2016-08-11 */ 2 (function(){this.ShowYourTerms=function(){function a(a,b,c){var d,e,f,g,h,i,j;this.container=a,this.replay=null!=b?b:!0,this.termsOptions=null!=c?c:{},d={single:!1,pauseOnClick:!0};for(g in d)j=d[g],g in this.termsOptions||(this.termsOptions[g]=j);if(this.container.nodeType||(this.container=document.querySelectorAll(this.container)),this.content=[],this.sstatus=[],this.outputIndex=[],this.container.length>0)for(i=this.container.length-1,this.termsOptions.single&&(i=0),e=f=0,h=i;h>=0?h>=f:f>=h;e=h>=0?++f:--f)this.content[e]=[],this.sstatus[e]="ready",this.defineEvents(e),this.container[e].innerText.length>0&&this.declarativeBuilder(e)}return a.prototype.declarativeBuilder=function(a){var b,c,d,e;for(e=this.container[a].children,c=0,d=e.length;d>c;c++)b=e[c],this.content[a].push([b.getAttribute("data-action"),b.innerText,{styles:b.classList,delay:b.getAttribute("data-delay"),speed:b.getAttribute("data-speed")}]);return this.container[a].style.minHeight=window.getComputedStyle(this.container[a],null).getPropertyValue("height"),this.play(a)},a.prototype.defineEvents=function(a){return this.termsOptions.pauseOnClick?this.container[a].addEventListener("click",function(b){return function(){return b.togglePause(a)}}(this)):void 0},a.prototype.addCommand=function(a,b,c){return null==c&&(c=0),c<this.content.length?this.content[c].push(["command",a,b]):void 0},a.prototype.addLine=function(a,b,c){return null==c&&(c=0),c<this.content.length?this.content[c].push(["line",a,b]):void 0},a.prototype.play=function(a){return null==a&&(a=0),"ready"===this.sstatus[a]?(this.sstatus[a]="playing",this.container[a].innerHTML="",this.outputIndex[a]=0,this.outputGenerator(this.content[a][this.outputIndex[a]],a)):void 0},a.prototype.playagain=function(a){return null==a&&(a=0),this.sstatus[a]="ready",this.play(a)},a.prototype.callNextOutput=function(a,b){return this.outputIndex[b]+=1,this.content[b][this.outputIndex[b]]?setTimeout(function(a){return function(){return a.outputGenerator(a.content[b][a.outputIndex[b]],b)}}(this),a):this.replay?setTimeout(function(a){return function(){return a.playagain(b)}}(this),a):void 0},a.prototype.isPlaying=function(a){return"playing"===this.sstatus[a]},a.prototype.togglePause=function(a){return"playing"===this.sstatus[a]?this.sstatus[a]="pause":"pause"===this.sstatus[a]?this.sstatus[a]="playing":void 0},a.prototype.outputGenerator=function(a,b){var c,d,e,f,g,h,i,j;return j=a[0],c=a[1],g=a[2],e=document.createElement("div"),g.styles&&e.setAttribute("class",g.styles),i=g.speed?g.speed:100,e.classList.add("active"),"command"===j?(e.classList.contains("type")||e.classList.add("command"),d=0,f=setInterval(function(a){return function(){return a.isPlaying(b)&&(e.appendChild(document.createTextNode(c[d])),a.container[b].appendChild(e),d++,d===c.length)?(e.classList.remove("active"),a.callNextOutput(g.delay,b),clearInterval(f)):void 0}}(this),i)):this.isPlaying(b)?(e.appendChild(document.createTextNode(c)),this.container[b].appendChild(e),e.classList.remove("active"),this.callNextOutput(g.delay,b)):h=setInterval(function(a){return function(){return a.isPlaying(b)?(clearInterval(h),a.callNextOutput(g.delay,b)):void 0}}(this),i)},a}()}).call(this); -
simterm/trunk/readme.txt
r1467684 r1472563 5 5 Requires at least: 4.2 6 6 Tested up to: 4.5 7 Stable tag: 0.2. 37 Stable tag: 0.2.4 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 44 44 == Changelog == 45 45 46 = 0.2.4 (2016-08-11) = 47 * Main JS update, now supports pause on lines 48 * Ability to change theme in the shortcut [simterm theme="dark"]...[/simterm] 49 46 50 = 0.2.3 (2016-08-04) = 47 51 * < and > are now visible. -
simterm/trunk/simterm-core.php
r1467684 r1472563 42 42 if (get_option('simterm-transform-chars')) 43 43 $filters[] = array($this, 'fixDashes'); 44 $data['theme'] = $defaultTheme;44 $data['theme'] = ( (isset($atts['theme'])) && ($this->settings()->validTheme($atts['theme'])) )?$atts['theme']:$defaultTheme; 45 45 $data['title'] = (isset($atts['title']))?$atts['title']:get_option('simterm-window-title'); 46 46 … … 83 83 return $content; 84 84 } 85 85 86 }; -
simterm/trunk/simterm-settings.php
r1466581 r1472563 223 223 } 224 224 225 function validTheme($theme) 226 { 227 static $validThemes = array('regular', 'light', 'dark', 'blue'); 228 return (in_array($theme, $validThemes)); 229 } 230 225 231 }; -
simterm/trunk/simterm.php
r1467684 r1472563 4 4 * Plugin URI: http://gaspar.totaki.com/en/php-project/simterm/ 5 5 * Description: Simulates terminal input/output for tutorials 6 * Version: 0.2. 36 * Version: 0.2.4 7 7 * Author: Gaspar Fernández 8 8 * Author URI: http://totaki.com/poesiabinaria/
Note: See TracChangeset
for help on using the changeset viewer.