123

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              
<div class="bloading"></div>
<div id="feed"></div>
            
          
!
            
              ul.bsitemap, ul.bsitemap ul, ul.bsitemap li {width: 100%;margin: 0;padding: 0 ;list-style:none;font-family: arial;}
ul.bsitemap li a {display: block;margin: 0 0 2px 0;padding:0 10px;background: #666;color: #fff;text-decoration: none;font-size: 20x;line-height: 28px;text-transform: uppercase;}
ul.bsitemap li li a {background: transparent;color:#333;line-height:22px;}
/* Símbolo elemento no desplegable */
ul.bsitemap li a:before {content: "\25CF\00A0";width: 28px;display: inline-block;vertical-align: top;}
/* Símbolo elemento desplegable cerrado */
ul.bsitemap li.desplegable a:before {content: "\25BA\00A0";}
/* Símbolo elemento desplegable abierto */
ul.bsitemap li.desplegable.activa a:before {content: "\25BC\00A0";}
ul.bsitemap li.desplegable ul li a:before, ul.bsitemap li.desplegable.activa ul li a:before {content: none}
ul.bsitemap ul {display: none;}
ul.bsitemap ul a {padding-left: 40px;text-transform: none;}
ul.bsitemap li li a:hover {background: transparent;text-decoration: underline;}
/* Estilo marca NUEVO (último mes) */
.bnuevo {color: red;font-style: italic;font-weight: bold;}
.bnuevo:after {content:" Nuevo";margin-left: 10px;padding: 2px 8px;color: white;background:red;font-style: italic;font-weight: bold;font-size: 80%;border-radius: 4px;}
/* Símbolo animado cargador */
.bloading {display: block;width: 80px;height: 80px;margin: 10px auto;font-size: 10px;text-align: center;border-width: 30px;border-radius: 50%;-webkit-animation: spin 1s linear infinite;animation: spin 1s linear infinite;border-style: double;border-color: #666 transparent;}
.bloading:before {content: "CARGANDO";font-weight: bold;line-height: 80px;color: #990000;}
@-webkit-keyframes spin {100% {-webkit-transform: rotate(359deg);}}
@keyframes spin {100% {transform: rotate(359deg);}}
            
          
!
            
                // Parámetros configurables
  var feed = 'https://inspiringy.blogspot.com/feeds/posts/default';
  // Etiquetas a  excluir del índice  
  var exclusion = ['BPT', 'CSS', 'X-Topic','etc'];
  var cajasalida = $('#feed'); // Nombre caja para insertar posts
$( document ).ready(function() { 
  var postsxfeed = 150; // Tope entradas que admite el feed
  // Parte ejecución
  var leermaximo = 10000; // Máximo de entradas a leer/mostrar
  var posts = new Array();
  $.getJSON(feed + '?alt=json&callback=?').done(function(data) {
    var longfeed = parseInt(data.feed.openSearch$totalResults.$t);
    if (leermaximo < longfeed) {
      longfeed = leermaximo;
    }
    if (Math.ceil(longfeed / postsxfeed) < 2) {postsxfeed = longfeed-1;}
    var peticiones = Math.ceil(longfeed / postsxfeed);
    var ajax = [];
    for (i = 0; i < peticiones; i++) {
        ajax.push(leerfeeds(i));
    }

    function leerfeeds(id) {
      var startindex = (i * postsxfeed) + 1;
      var maxresults = postsxfeed;
      if (i == (peticiones - 1)) {
        maxresults = leermaximo - (postsxfeed * i);
      }
      var url = feed + '?orderby=published&start-index=' + startindex + '&max-results=' + maxresults + '&alt=json&callback=?';
      return $.getJSON(url);
    }
    $.when.apply($, ajax).done(function(data) {
      var obj = [];
      var orden = 0;
      for (var i = 0; i < arguments.length; i++) {
        obj.push(arguments[i][0]);
      }
      for (i = 0; i < arguments.length; i++) {
        $.each(
          obj[i].feed.entry || [],
          function(i, e) {
            var etiquetas = [];
            if (e.category) {
              for (var k = 0; k < e.category.length; k++) {
                var incluir = true;
                for (var x = 0; x < exclusion.length; x++) {
                  if (e.category[k].term == exclusion[x]) {
                    incluir = false;
                    break;
                  }
                }
                if (incluir) {
                  posts[orden] = new Array();
                  // Etiquetas [x][0]
                  posts[orden][0] = e.category[k].term;
                  // Fecha [x][1]
                  posts[orden][1] = new Date(e.published.$t || Date.now());
                  // Titulo [x][2]
                  posts[orden][2] = (e.title.$t || '');
                  // Link [x][3]
                  posts[orden][3] = (e.link || []).slice(-1)[0].href;
                  orden++;
                }
              }
            } else {
                  posts[orden] = new Array();
              posts[orden][0] = 'Varios';
              posts[orden][1] = new Date(e.published.$t || Date.now());
              posts[orden][2] = (e.title.$t || '');
              posts[orden][3] = (e.link || []).slice(-1)[0].href;
              orden++;
            }
          });
      }
      posts.sort(function(a, b) {
        // Ordenar ETIQUETA A-Z
        if (a[0] > b[0]) return 1;
        if (a[0] < b[0]) return -1;
        // Ordenar ETIQUETA Z-A
        //if (a[0] > b[0]) return -1;
        //if (a[0] < b[0]) return 1;
        // Ordenar POST por titulo A-Z
        if (a[2] > b[2]) return 1;
        if (a[2] < b[2]) return -1;
        // Ordenar POST por titulo Z-A
        //if (a[2] > b[2]) return -1;
        //if (a[2] < b[2]) return 1;
        // Ordenar POST por fecha Reciente-Antigua
        //if (a[1] < b[1]) return 1;
        //if (a[1] > b[1]) return -1;
        return 0;
      });
      var actual = '';
      var anterior = '';
      var salida = '';
      var cierre = '';
      cajasalida.append('<ul class="bsitemap"></ul>');
      for (var j = 0; j < posts.length; j++) {
        actual = posts[j][0];
        if (j > 0) {
          anterior = posts[j - 1][0];
          cierre = '</ul></li>';
        }
        if (actual != anterior) {
          salida += cierre + '<li><a href="javascript:void();">' + posts[j][0] + '</a><ul>';
        }
        var timestamp = new Date().getTime() - (30 * 24 * 60 * 60 * 1000);
        if (timestamp <= posts[j][1]) {
          clase = 'bnuevo';
        } else {
          clase = 'bantiguo';
        }
        salida += '<li><a class="' + clase + '" href="' + posts[j][3] + '">' + posts[j][2] + '</a></li>';
      }
      salida += '</ul></li>';
      $('.bloading').remove();
      $('ul.bsitemap').append(salida);
      $('ul.bsitemap > li:has(ul)').addClass('desplegable');
      $('ul.bsitemap > li a').click(function() {
        var comprobar = $(this).next();
        $('ul.bsitemap li').removeClass('activa');
        $(this).closest('li').addClass('activa');
        if ((comprobar.is('ul')) && (comprobar.is(':visible'))) {
          $(this).closest('li').removeClass('activa');
          comprobar.slideUp('normal');
        }
        if ((comprobar.is('ul')) && (!comprobar.is(':visible'))) {
          $('ul.bsitemap ul:visible').slideUp('normal');
          comprobar.slideDown('normal')
        }
      });
    });
  });
    });
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console