Diferencia entre revisiones de «Widget:Slides»

De Vitalinux
Saltar a: navegación, buscar
(show / mostrar)
 
(No se muestran 2 ediciones intermedias del mismo usuario)
Línea 1: Línea 1:
<noinclude>Infrastructure for wiki-based "slide" presentations, based on [http://code.google.com/p/html5slides/ html5slides].</noinclude><includeonly>
+
<noinclude>Infrastructure for wiki-based "slide" presentations, based on [http://code.google.com/p/html5slides/ html5slides]. Idea original de Jim Tittsler http://wikieducator.org/index.php?title=Widget:Slide</noinclude><includeonly>
<div id="WEslides"></div>
+
<div id="MIslides"></div>
 
<script type="text/javascript">/*<![CDATA[*/
 
<script type="text/javascript">/*<![CDATA[*/
$(function () {
+
Element.prototype.remove = function() {
  function weSlideShow() {
+
     this.parentElement.removeChild(this);
     $.getScript(wgServer + '/extensions/SlidesTemplates/slides/slides.js');
+
}
    $('#WEslides').remove();
+
NodeList.prototype.remove = HTMLCollection.prototype.remove = function() {
     $('.mw-editsection').remove();
+
     for(var i = this.length - 1; i >= 0; i--) {
     return false;
+
        if(this[i] && this[i].parentElement) {
  }
+
            this[i].parentElement.removeChild(this[i]);
 +
        }
 +
     }
 +
}
  
  var weAPI = wgServer + '/api.php';
+
function MIslideshow() {
  var narration;
+
        mw.loader.load(wgServer + '/extensions/WE/Slides/slides.js');
 
+
        document.getElementById("MIslides").remove();
  $.each($('div.slides').attr('class').split(/\s+/), function(i, v) {
+
         document.getElementsByClassName('mw-editsection').remove();
    if (v.indexOf('narration:') === 0) {
+
        return false;
      narration = v.substr('narration:'.length).replace(',', '|');
+
     };
    }
 
  });
 
  if (narration !== undefined) {
 
    $.ajax({
 
      url: weAPI,
 
      data: {
 
        action: 'query',
 
        format: 'json',
 
        prop: 'imageinfo',
 
        iiprop: 'url',
 
        titles: narration
 
      },
 
      async: true,
 
      dataType: 'json',
 
      type: 'POST',
 
      success: function(data) {
 
        var i, u;
 
        var audiotag = '<div id="narrationdiv" style="float: right;"><audio id="narration" controls>';
 
        if (data && 'query' in data && 'pages' in data.query) {
 
          for (i in data.query.pages) {
 
            u = data.query.pages[i].imageinfo[0].url;
 
            type = (u.substr(-3) === 'mp3') ? 'mpeg' : 'ogg';
 
            audiotag += '<source src="' + u + '" type="audio/' + type + '" />';
 
          }
 
         }
 
        audiotag += '</audio></div>';
 
        $('#WEslides').before(audiotag);
 
      }
 
     });
 
  }
 
  
  if (window.location.search.indexOf('present') >= 0) { weSlideShow(); } else {
+
function creaSlides() {
    $('#WEslides').html('<input type="submit" value="Mostrar presentación" href="#" /><br />');
+
    if (window.location.search.indexOf('present') >= 0) { MIslideshow(); } else {
    $('#WEslides > input').click(weSlideShow);
+
          var boton = document.createElement("input");
  }
+
          boton.setAttribute('type', 'submit');
 +
          boton.setAttribute('value', 'Ver presentación');  
 +
          boton.setAttribute('href', '#');
 +
          boton.onclick = MIslideshow;
 +
          document.getElementById("MIslides").appendChild(boton)
 +
    };
 +
}
 +
RLQ.push(function () {
 +
    creaSlides();
 
});
 
});
 
/*]]>*/</script></includeonly>
 
/*]]>*/</script></includeonly>

Revisión actual del 19:24 27 nov 2019

Infrastructure for wiki-based "slide" presentations, based on html5slides. Idea original de Jim Tittsler http://wikieducator.org/index.php?title=Widget:Slide