Plugin Directory

Changeset 1472563


Ignore:
Timestamp:
08/11/2016 07:51:32 PM (9 years ago)
Author:
gasparfm
Message:

version 0.2.4

Location:
simterm/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • simterm/trunk/CHANGELOG

    r1467684 r1472563  
     120160811    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
    1620160804    Gaspar Fernández <[email protected]>
    27    * < and > are now visible, not stripped.
  • simterm/trunk/js/show-your-terms.js

    r1465197 r1472563  
    6565    };
    6666
    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      }
    6974    };
    7075
    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      }
    7383    };
    7484
     
    123133
    124134    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;
    126136      type = output[0], content = output[1], options = output[2];
    127137      currentLine = document.createElement("div");
     
    136146      currentLine.classList.add('active');
    137147      if (type === "command") {
     148        if (!currentLine.classList.contains('type')) {
     149          currentLine.classList.add('command');
     150        }
    138151        counter = 0;
    139152        return interval = setInterval(((function(_this) {
     
    152165        })(this)), speed);
    153166      } 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        }
    158182      }
    159183    };
  • simterm/trunk/js/show-your-terms.min.js

    r1465197 r1472563  
    1 /*! show-your-terms - Kande Bonfim <[email protected]> - 2016-07-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  
    55Requires at least: 4.2
    66Tested up to: 4.5
    7 Stable tag: 0.2.3
     7Stable tag: 0.2.4
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4444== Changelog ==
    4545
     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
    4650= 0.2.3 (2016-08-04) =
    4751* < and > are now visible.
  • simterm/trunk/simterm-core.php

    r1467684 r1472563  
    4242      if (get_option('simterm-transform-chars'))
    4343    $filters[] = array($this, 'fixDashes');
    44       $data['theme'] = $defaultTheme;
     44      $data['theme'] = ( (isset($atts['theme'])) && ($this->settings()->validTheme($atts['theme'])) )?$atts['theme']:$defaultTheme;
    4545      $data['title'] = (isset($atts['title']))?$atts['title']:get_option('simterm-window-title');
    4646
     
    8383      return $content;
    8484    }
     85
    8586};
  • simterm/trunk/simterm-settings.php

    r1466581 r1472563  
    223223    }
    224224
     225    function validTheme($theme)
     226    {
     227    static $validThemes = array('regular', 'light', 'dark', 'blue');
     228    return (in_array($theme, $validThemes));
     229    }
     230
    225231};
  • simterm/trunk/simterm.php

    r1467684 r1472563  
    44 * Plugin URI:  http://gaspar.totaki.com/en/php-project/simterm/
    55 * Description: Simulates terminal input/output for tutorials
    6  * Version: 0.2.3
     6 * Version: 0.2.4
    77 * Author: Gaspar Fernández
    88 * Author URI: http://totaki.com/poesiabinaria/
Note: See TracChangeset for help on using the changeset viewer.