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.

            
              <link href='https://fonts.googleapis.com/css?family=Abel' rel='stylesheet' type='text/css'>

<div id="total"></div>
<div class="loading"></div>
<div id="feed"></div>


            
          
!
            
              body {
  font-family: Abel, sans-serif;
  font-size: 16px;
  font-weight: bold;
  line-height: 18px;
  min-height: 1000px;
  background: #F6E7AE;
}

#total {
  display: block;
  font-size: 22px;
  line-height: 24px;
  margin-bottom: 10px;
  padding: 10px;
  border: 2px solid #000;
  box-sizing: border-box;
  text-align: center;
  color: #eee;
  background: #333;
}

.itempost {
  display: block;
  padding: 10px;
  clear: both;
  box-sizing: border-box;
  overflow: hidden;
}

.itempost:nth-of-type(odd) {
  background: #EFD689;
}

a.itemimagen {
  float: left;
  margin: 0 20px 0 0;
  overflow: hidden;
}

.itemimagen img {
  border: 1px solid #999;
  box-sizing: border-box;
}

.itemcontador {
  display: inline;
  margin: 0 10px 0 0;
  font-size: 80%;
}

.itemfecha {
  display: inline;
  margin: 0 10px 0 0;
  font-size: 80%;
}

.itemautor {
  position: relative;
  display: inline;
  margin: 0 10px 0 0;
  font-size: 80%;
}

.itemautorimg {
  display: none;
  position: absolute;
  top: 14px;
  left: 0;
}

.itemautorimg img {
  width: 32px;
  height: 32px;
}

.itemautor:hover .itemautorimg {
  display: block;
}

.itemnumcom {
  display: inline;
  margin: 0 10px 0 0;
  font-size: 80%;
}

.itemetiquetas {
  display: inline;
  font-size: 80%;
}

.itemetiquetas a {
  display: inline-block;
  margin: 0  5px 0 0;
  background: #eee;
  padding: 0 5px;
  box-sizing: border-box;
}
.itemautor a,
.itemnumcom a,
.itemetiquetas a {
  color: #B38D1C;
  text-decoration: none;
}
.itemnumcom a:hover {
  text-decoration: underline;
}

.itemtitulo a {
  display: block;
  margin: 10px 0;
  font-size: 20px;
  color: #B38D1C;
  text-decoration: none;
}

.itemsumario {}


/* Cargador CSS */

.loading {
  display: block;
  width: 80px;
  height: 80px;
  margin: 10px auto;
  border-width: 30px;
  border-radius: 50%;
  -webkit-animation: spin 1s linear infinite;
  animation: spin 1s linear infinite;
  border-style: double;
  border-color: #666 transparent;
}

.loading: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 vertotal = true; // Ver total entradas publicadas true/false
  var total = $('#total'); // Nombre caja para total entradas publicadas 
  var cajasalida = $('#feed'); // Nombre caja para insertar posts
  var web = 'https://althouse.blogspot.com'; // Evitar barra "/" al final
  var soloetiquetax = ''; // Incluir nombre etiqueta. Vacío para todas
  var postsxfeed = 150; // Tope entradas que admite el feed
  var leermaximo = 2000; // Máximo de entradas a leer/mostrar
  var verimagen = true; // Imagen true/false
  var anchoimagen = 100; // Ancho/alto de la miniatura
  var sinimagen = 'https://2.bp.blogspot.com/_0eC4K-qZ7AM/SEhilrttvvI/AAAAAAAADAo/h1birc8e7O0/s400/cooltext90744301.jpg'; // Miniatura por defecto
  var vercontador = true; // Ver Ordinal de los posts mostrados
  var verfecha = true; // Ver fecha true/false
  var veretiquetas = true; // Ver las etiquetas  true/false
  var separadoreti = '- '; // Símbolo de separación etiquetas
  var verautor = true; // Ver autor de la entrada
  var vernumcom = true // Ver número comentarios
  var vertitulo = true; // Ver título entrada true/false
  var vertexto = true; // Ver sumario true/false
  var maxcaracteres = 200; // Número caracteres por sumario
  // Parte ejecución
  //$.ajaxSetup({cache: false});
  if (soloetiquetax != '') {
    soloetiquetax = '/-/' + soloetiquetax;
  } 
  var feed = web + '/feeds/posts/default' + soloetiquetax;
  var contposts = -1;
  // URL con subcarpeta 's' o 'w'
  var reimg = /[\/=][sw][0123456789].+[\/o]/g;
  // URL en Google Fotos tras cambio, termina en /sxxx/
  var reimg2 = /\/s[012345679].+\/$/g;

  $.getJSON(feed + '?alt=json&callback=?').done(function(data) {
    var longfeed = data.feed.openSearch$totalResults.$t;
    if (vertotal) {
      $(total).append('Total entradas publicadas: ' + longfeed);
    }
    if (longfeed > leermaximo) {
      longfeed = leermaximo;
      $(total).append('. Mostrando ' + leermaximo);
    } else {
      $(total).append('. Mostrando ' + longfeed);

    }
    var peticiones = Math.ceil(longfeed / postsxfeed);
    var ajax = [];
    for (i = 0; i < peticiones; i++) {
      if (peticiones === 1) {
        ajax.push(leerfeeds(i), '');
        ajax.push('');
      } else {
        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 = [];
      for (var i = 0; i < arguments.length; i++) {
        obj.push(arguments[i][0]);
      }

      for (i = 0; i < arguments.length; i++) {
        contposts++;
        $.each(
          obj[i].feed.entry || [],
          function(i, e) {
            var salida = '<div class="itempost">';
            var url = (e.link || []).pop().href;
            if (verimagen) {
              var thumbnail;
              if (e.media$thumbnail) {
                thumbnail = (e.media$thumbnail.url || '');
              } else {
                thumbnail = sinimagen;
              }
              thumbnail = thumbnail.replace(reimg, '/s' + anchoimagen + '-c/');
              thumbnail = thumbnail.replace(reimg2, '=s' + anchoimagen);
              salida += '<a class="itemimagen" href="' + url + '"><img src="' + thumbnail + '"/></a>';
            }
            if (vercontador) {
              salida += '<div class="itemcontador">' + ((contposts * postsxfeed) + i + 1) + '</div>';
            }
            if (verfecha) {
              var fecha = new Date(e.published.$t || Date.now());
              fecha = (new Date(fecha)).toLocaleDateString('es-es', {
                month: '2-digit',
                day: '2-digit',
                year: '2-digit'
              });
              salida += '<div class="itemfecha">' + fecha + '</div>';
            }
            if (verautor) {
              var autor = (e.author[0].name.$t || '');
              salida += '<div class="itemautor"><a href="' + e.author[0].uri.$t + '">' + autor + '</a><div class="itemautorimg"><a href="' + e.author[0].uri.$t + '"><img src="' + e.author[0].gd$image.src + '"/></a></div></div>';
            }
            if (vernumcom) {
              var numcom = (e.thr$total.$t || '');
              salida += '<div class="itemnumcom"><a href="' + url + '#comments">' + numcom + ' comentarios</a></div>';
            }
            if (veretiquetas) {
              var etiquetas = [];
              if (e.category) {
                for (var k = 0; k < e.category.length; k++) {
                  etiquetas += '<a href="' + web + '/search/?q=label:' + e.category[k].term + '">' + e.category[k].term + '</a>';
                  if (k < e.category.length - 1) {
                    etiquetas += separadoreti;
                  }
                }
              } else {
                etiquetas += 'Sin etiquetas';
              }
              salida += '<div class="itemetiquetas">' + etiquetas + '</div>';
            }
            if (vertitulo) {
              var titulo = (e.title.$t || '');
              salida += '<div class="itemtitulo"><a href="' + url + '">' + titulo + '</a></div>';
            }
            if (vertexto) {
              var sumario;
              if ('content' in e) {
                sumario = e.content.$t;
                var reghtml = /<\S[^>]*>/g;
                sumario = sumario.replace(reghtml, '');
                if (sumario.length > maxcaracteres) {
                  sumario = sumario.substring(0, maxcaracteres) + '...';
                }
              } else if ('summary' in e) {
                sumario = e.summary.$t + '...';
              }
              salida += '<div class="itemsumario">' + sumario + '</div>';
            }
            salida += '</div>';
            $('.loading').remove();
            cajasalida.append(salida);
          }
        );
      }
    });
  });
            
          
!
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