Przykładowy adres:
http://kody.wig.pl/przykladowy-url-123.html
var url=window.location.href;
var re=new RegExp("-([0-9]+)\.html$","gi");
var tmp=re.exec(url);
var id=parseInt(tmp[1]); Przykładowy adres:
http://kody.wig.pl/przykladowy-url-123.html
var url=window.location.href;
var re=new RegExp("-([0-9]+)\.html$","gi");
var tmp=re.exec(url);
var id=parseInt(tmp[1]); Najpierw budujemy strukturę html. Wszystko jest robione w scss, js w wersji ES6 i gulp
Do ES6 używam gulp-babel aby przekonwertować js do es2015
<div class="container">
<div id="accorions">
<div class="accordion">Section 1</div>
<div class="panel">
<p>Sauerkraut can be garnished with cored avocado, also try decorateing the cake with hollandaise sauce.
Asparagus can be marinateed with crushed lettuce, also try flavoring the loaf with salsa verde.
with lobsters drink cream.</p>
</div>
<div class="accordion">Section 2</div>
<div class="panel">
<p>Aww, raid me parrot, ye dead landlubber! Swashbuckling, coal-black whales cowardly vandalize a mighty, gutless
scabbard.
Scabbards sing on booty at port degas! Small, dead tobaccos darkly fight a black, lively dagger.
seashells fall with love.</p>
</div>
<div class="accordion">Section 3</div>
<div class="panel">
<p>Turbulence at the bridge was the adventure of mineral, lowered to a gravimetric mermaid.
Moon at the universe was the mystery of coordinates, feeded to a real planet.
wisely handle a processor.</p>
</div>
</div>
</div> Aby wylistować folder z plikami i zapisać listę plików jako json na potrzeby tej strony - blog.grzgorztomicki.pl należy oczywiście mieć najpierw zainstalowane nodejs
Tworzymy plik powiedzmy list_images.js
Najpierw używamy wbudowanej biblioteki fs - fs
const fs = require("fs");
const nameGallery = "chiny";
const name = "test";
const test = [];
const author = "Grzegorz Tomicki";
let now = new Date();
let date = now.getDate() + "." + (now.getMonth()+1) + "." + now.getFullYear();
let datePublished = new Date().toISOString().slice(0,10);
let dateModified = datePublished;Czytamy folder z plikami jpg za pomocą fs.readdir
fs.readdir(`./sources/images/${nameGallery}/1200/`, function (err, files) {
if (err)
throw err;
for (let index in files) { Zamiana wystąpienia tekstu Polska na końcu stringa
var address = ['Warszawa, Polska'];
for (var i = 0; i < cnt; i++) {
var address_tmp = address[i];
address_tmp = address_tmp.replace(RegExp(", ?Polska$", "g"), '');
console.log(address_tmp);
} $(window).resize(function() {
var winW = $(window).width();
var conW = parseInt($('#container').css('width'));
var tabW = parseInt($('table.list').css('width'));
if(winW>conW) {
var margin_left = -((tabW - conW)/2)-10;
$('table.list').css({'margin-left':margin_left});
} else {
$('table.list').css({'margin-left':0});
}
});
$(window).resize();