Import initial site
This commit is contained in:
146
galleria/plugins/history/galleria.history.js
Normal file
146
galleria/plugins/history/galleria.history.js
Normal file
@ -0,0 +1,146 @@
|
||||
/**
|
||||
* Galleria History Plugin 2012-04-04
|
||||
* http://galleria.io
|
||||
*
|
||||
* Licensed under the MIT license
|
||||
* https://raw.github.com/aino/galleria/master/LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
(function( $, window ) {
|
||||
|
||||
/*global jQuery, Galleria, window */
|
||||
|
||||
Galleria.requires(1.25, 'The History Plugin requires Galleria version 1.2.5 or later.');
|
||||
|
||||
Galleria.History = (function() {
|
||||
|
||||
var onloads = [],
|
||||
|
||||
init = false,
|
||||
|
||||
loc = window.location,
|
||||
|
||||
doc = window.document,
|
||||
|
||||
ie = Galleria.IE,
|
||||
|
||||
support = 'onhashchange' in window && ( doc.mode === undefined || doc.mode > 7 ),
|
||||
|
||||
iframe,
|
||||
|
||||
get = function( winloc ) {
|
||||
if( iframe && !support && Galleria.IE ) {
|
||||
winloc = winloc || iframe.location;
|
||||
} else {
|
||||
winloc = loc;
|
||||
}
|
||||
return parseInt( winloc.hash.substr(2), 10 );
|
||||
},
|
||||
|
||||
saved = get( loc ),
|
||||
|
||||
callbacks = [],
|
||||
|
||||
onchange = function() {
|
||||
$.each( callbacks, function( i, fn ) {
|
||||
fn.call( window, get() );
|
||||
});
|
||||
},
|
||||
|
||||
ready = function() {
|
||||
$.each( onloads, function(i, fn) {
|
||||
fn();
|
||||
});
|
||||
|
||||
init = true;
|
||||
},
|
||||
|
||||
setHash = function( val ) {
|
||||
return '/' + val;
|
||||
};
|
||||
|
||||
// always remove support if IE < 8
|
||||
if ( support && ie < 8 ) {
|
||||
support = false;
|
||||
}
|
||||
|
||||
if ( !support ) {
|
||||
|
||||
$(function() {
|
||||
|
||||
var interval = window.setInterval(function() {
|
||||
|
||||
var hash = get();
|
||||
|
||||
if ( !isNaN( hash ) && hash != saved ) {
|
||||
saved = hash;
|
||||
loc.hash = setHash( hash );
|
||||
onchange();
|
||||
}
|
||||
|
||||
}, 50);
|
||||
|
||||
if ( ie ) {
|
||||
|
||||
$('<iframe tabindex="-1" title="empty">').hide().attr( 'src', 'about:blank' ).one('load', function() {
|
||||
|
||||
iframe = this.contentWindow;
|
||||
|
||||
ready();
|
||||
|
||||
}).insertAfter(doc.body);
|
||||
|
||||
} else {
|
||||
ready();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ready();
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
change: function( fn ) {
|
||||
|
||||
callbacks.push( fn );
|
||||
|
||||
if( support ) {
|
||||
window.onhashchange = onchange;
|
||||
}
|
||||
},
|
||||
|
||||
set: function( val ) {
|
||||
|
||||
if ( isNaN( val ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !support && ie ) {
|
||||
|
||||
this.ready(function() {
|
||||
|
||||
var idoc = iframe.document;
|
||||
idoc.open();
|
||||
idoc.close();
|
||||
|
||||
iframe.location.hash = setHash( val );
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
loc.hash = setHash( val );
|
||||
},
|
||||
|
||||
ready: function(fn) {
|
||||
if (!init) {
|
||||
onloads.push(fn);
|
||||
} else {
|
||||
fn();
|
||||
}
|
||||
}
|
||||
};
|
||||
}());
|
||||
|
||||
}( jQuery, this ));
|
||||
|
1
galleria/plugins/history/galleria.history.min.js
vendored
Normal file
1
galleria/plugins/history/galleria.history.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
!function(n,e){Galleria.requires(1.25,"The History Plugin requires Galleria version 1.2.5 or later.");Galleria.History=function(){var i=[],t=false,a=e.location,o=e.document,r=Galleria.IE,s="onhashchange"in e&&(o.mode===undefined||o.mode>7),u,c=function(n){if(u&&!s&&Galleria.IE){n=n||u.location}else{n=a}return parseInt(n.hash.substr(2),10)},f=c(a),l=[],h=function(){n.each(l,function(n,i){i.call(e,c())})},d=function(){n.each(i,function(n,e){e()});t=true},y=function(n){return"/"+n};if(s&&r<8){s=false}if(!s){n(function(){var i=e.setInterval(function(){var n=c();if(!isNaN(n)&&n!=f){f=n;a.hash=y(n);h()}},50);if(r){n('<iframe tabindex="-1" title="empty">').hide().attr("src","about:blank").one("load",function(){u=this.contentWindow;d()}).insertAfter(o.body)}else{d()}})}else{d()}return{change:function(n){l.push(n);if(s){e.onhashchange=h}},set:function(n){if(isNaN(n)){return}if(!s&&r){this.ready(function(){var e=u.document;e.open();e.close();u.location.hash=y(n)})}a.hash=y(n)},ready:function(n){if(!t){i.push(n)}else{n()}}}}()}(jQuery,this);
|
100
galleria/plugins/history/history-demo.html
Normal file
100
galleria/plugins/history/history-demo.html
Normal file
@ -0,0 +1,100 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Galleria History Plugin</title>
|
||||
<style>
|
||||
|
||||
/* Demo styles */
|
||||
html,body{background:#222;margin:0;}
|
||||
body{border-top:4px solid #000;}
|
||||
.content{color:#777;font:12px/1.4 "helvetica neue",arial,sans-serif;width:620px;margin:20px auto;}
|
||||
h1{font-size:12px;font-weight:normal;color:#ddd;margin:0;}
|
||||
p{margin:0 0 20px}
|
||||
a {color:#22BCB9;text-decoration:none;}
|
||||
.cred{margin-top:20px;font-size:11px;}
|
||||
|
||||
/* This rule is read by Galleria to define the gallery height: */
|
||||
#galleria{height:320px}
|
||||
|
||||
</style>
|
||||
|
||||
<!-- load jQuery -->
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
|
||||
|
||||
<!-- load Galleria -->
|
||||
<script src="../../galleria-1.4.2.min.js"></script>
|
||||
|
||||
<!-- load the History plugin, no need for further scripting -->
|
||||
<script src="galleria.history.min.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<h1>Galleria History Plugin</h1>
|
||||
<p>Demonstrating a basic history example. Supports most browsers, including FF 3.0+ and IE 7+</p>
|
||||
|
||||
<!-- Adding gallery images. We use resized thumbnails here for better performance, but it’s not necessary -->
|
||||
|
||||
<div id="galleria">
|
||||
<a href="http://upload.wikimedia.org/wikipedia/commons/thumb/3/34/Locomotives-Roundhouse2.jpg/800px-Locomotives-Roundhouse2.jpg">
|
||||
<img title="Locomotives Roundhouse"
|
||||
alt="Steam locomotives of the Chicago & North Western Railway."
|
||||
src="http://upload.wikimedia.org/wikipedia/commons/thumb/3/34/Locomotives-Roundhouse2.jpg/100px-Locomotives-Roundhouse2.jpg">
|
||||
</a>
|
||||
<a href="http://upload.wikimedia.org/wikipedia/commons/thumb/3/36/Icebergs_in_the_High_Arctic_-_20050907.jpg/1000px-Icebergs_in_the_High_Arctic_-_20050907.jpg">
|
||||
<img title="Icebergs in the High Arctic"
|
||||
alt="”The debris loading isn't particularly extensive, but the color is usual.”"
|
||||
src="http://upload.wikimedia.org/wikipedia/commons/thumb/3/36/Icebergs_in_the_High_Arctic_-_20050907.jpg/100px-Icebergs_in_the_High_Arctic_-_20050907.jpg">
|
||||
</a>
|
||||
<a href="http://upload.wikimedia.org/wikipedia/commons/thumb/f/fe/Ara%C3%B1a._A_Estrada%2C_Galiza._02.jpg/1000px-Ara%C3%B1a._A_Estrada%2C_Galiza._02.jpg">
|
||||
<img title="Araña"
|
||||
alt="Xysticus cristatus, A Estrada, Galicia, Spain"
|
||||
src="http://upload.wikimedia.org/wikipedia/commons/thumb/f/fe/Ara%C3%B1a._A_Estrada%2C_Galiza._02.jpg/100px-Ara%C3%B1a._A_Estrada%2C_Galiza._02.jpg">
|
||||
</a>
|
||||
<a href="http://upload.wikimedia.org/wikipedia/commons/thumb/2/2d/9104_-_Milano_-_Museo_storia_naturale_-_Fluorite_-_Foto_Giovanni_Dall%27Orto_22-Apr-2007.jpg/1000px-9104_-_Milano_-_Museo_storia_naturale_-_Fluorite_-_Foto_Giovanni_Dall%27Orto_22-Apr-2007.jpg">
|
||||
<img title="Museo storia naturale"
|
||||
src="http://upload.wikimedia.org/wikipedia/commons/thumb/2/2d/9104_-_Milano_-_Museo_storia_naturale_-_Fluorite_-_Foto_Giovanni_Dall%27Orto_22-Apr-2007.jpg/100px-9104_-_Milano_-_Museo_storia_naturale_-_Fluorite_-_Foto_Giovanni_Dall%27Orto_22-Apr-2007.jpg">
|
||||
</a>
|
||||
<a href="http://upload.wikimedia.org/wikipedia/commons/thumb/1/15/Grj%C3%B3tagj%C3%A1_caves_in_summer_2009_%282%29.jpg/1000px-Grj%C3%B3tagj%C3%A1_caves_in_summer_2009_%282%29.jpg">
|
||||
<img title="Grjótagjá caves in summer 2009"
|
||||
src="http://upload.wikimedia.org/wikipedia/commons/thumb/1/15/Grj%C3%B3tagj%C3%A1_caves_in_summer_2009_%282%29.jpg/100px-Grj%C3%B3tagj%C3%A1_caves_in_summer_2009_%282%29.jpg">
|
||||
</a>
|
||||
<a href="http://upload.wikimedia.org/wikipedia/commons/thumb/9/90/20091128_Loutra_Thermes_Xanthi_Thrace_Greece_2.jpg/1000px-20091128_Loutra_Thermes_Xanthi_Thrace_Greece_2.jpg">
|
||||
<img title="Thermes"
|
||||
alt="Xanthi hot-spa springs, Xanthi Prefecture, Greece"
|
||||
src="http://upload.wikimedia.org/wikipedia/commons/thumb/9/90/20091128_Loutra_Thermes_Xanthi_Thrace_Greece_2.jpg/100px-20091128_Loutra_Thermes_Xanthi_Thrace_Greece_2.jpg">
|
||||
</a>
|
||||
<a href="http://upload.wikimedia.org/wikipedia/commons/thumb/5/58/Polish_Army_Ko%C5%82obrzeg_077.JPG/1024px-Polish_Army_Ko%C5%82obrzeg_077.JPG">
|
||||
<img title="Polish Army Kołobrzeg"
|
||||
alt="A display of the Polish Army. Both the soldier, and the vehicle belong to the 7th Pomeranian Coastal Defence Brigade, a part of the Szczecin-based 12th Mechanized Division ”Bolesław Krzywousty”"
|
||||
src="http://upload.wikimedia.org/wikipedia/commons/thumb/5/58/Polish_Army_Ko%C5%82obrzeg_077.JPG/100px-Polish_Army_Ko%C5%82obrzeg_077.JPG">
|
||||
</a>
|
||||
<a href="http://upload.wikimedia.org/wikipedia/commons/thumb/2/2d/20100213_Zlatograd_Bulgaria_3.jpg/1024px-20100213_Zlatograd_Bulgaria_3.jpg">
|
||||
<img title="Zlatograd Bulgaria"
|
||||
src="http://upload.wikimedia.org/wikipedia/commons/thumb/2/2d/20100213_Zlatograd_Bulgaria_3.jpg/100px-20100213_Zlatograd_Bulgaria_3.jpg">
|
||||
</a>
|
||||
<a href="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b5/FEMA_-_5399_-_Photograph_by_Andrea_Booher_taken_on_09-28-2001_in_New_York.jpg/1024px-FEMA_-_5399_-_Photograph_by_Andrea_Booher_taken_on_09-28-2001_in_New_York.jpg">
|
||||
<img title="09-28-2001 in New York City"
|
||||
alt="New York, NY, September 28, 2001 -- Debris on surrounding roofs at the site of the World Trade Center. Photo by Andrea Booher/ FEMA News Photo"
|
||||
src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b5/FEMA_-_5399_-_Photograph_by_Andrea_Booher_taken_on_09-28-2001_in_New_York.jpg/100px-FEMA_-_5399_-_Photograph_by_Andrea_Booher_taken_on_09-28-2001_in_New_York.jpg">
|
||||
</a>
|
||||
<a href="http://upload.wikimedia.org/wikipedia/commons/thumb/e/e6/Antennae%2C_Hubble_images.jpg/1024px-Antennae%2C_Hubble_images.jpg">
|
||||
<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/e/e6/Antennae%2C_Hubble_images.jpg/100px-Antennae%2C_Hubble_images.jpg">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<p class="cred">Made by <a href="http://galleria.aino.se">Galleria</a>.</p>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
// Load the classic theme
|
||||
Galleria.loadTheme('../../themes/classic/galleria.classic.min.js');
|
||||
|
||||
// Initialize Galleria
|
||||
Galleria.run('#galleria');
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user