diff --git a/autoload.js b/autoload.js new file mode 100644 index 0000000..7961f8d --- /dev/null +++ b/autoload.js @@ -0,0 +1,22 @@ +// AUTOLOAD CODE BLOCK (MAY BE CHANGED OR REMOVED) +addListener(window, 'load', function(){ + if (!/android|iphone|ipod|series60|symbian|windows ce|blackberry/i.test(navigator.userAgent)) { + var as = document.getElementsByTagName('A'); + var links = []; + var w = 100*Math.floor((document.documentElement.offsetWidth*0.8)/100); + var h = 100*Math.floor((document.documentElement.offsetHeight*0.8)/100); + var t; + for (var i = 0; i < as.length; i++) { + if (as[i].getAttribute('rel') == 'lightbox') { + t = as[i].title; + t += ' '+(t?'(с':'С')+'м. полный размер'+(t?')':'')+''; + links.push({ + element: as[i], + url: as[i].href + (as[i].href.indexOf('?') ? '&' : '?') + ('w='+w+'&h='+h), + title: t + }); + } + } + setSlimbox(links); + } +}); diff --git a/closelabel.gif b/closelabel.gif new file mode 100644 index 0000000..af0cab2 Binary files /dev/null and b/closelabel.gif differ diff --git a/loading.gif b/loading.gif new file mode 100644 index 0000000..6371884 Binary files /dev/null and b/loading.gif differ diff --git a/next.png b/next.png new file mode 100644 index 0000000..40b5884 Binary files /dev/null and b/next.png differ diff --git a/nextlabel.gif b/nextlabel.gif new file mode 100644 index 0000000..7c66121 Binary files /dev/null and b/nextlabel.gif differ diff --git a/prev.png b/prev.png new file mode 100644 index 0000000..6f50afd Binary files /dev/null and b/prev.png differ diff --git a/prevlabel.gif b/prevlabel.gif new file mode 100644 index 0000000..0641876 Binary files /dev/null and b/prevlabel.gif differ diff --git a/slimbox2-rtl.css b/slimbox2-rtl.css new file mode 100644 index 0000000..d59e371 --- /dev/null +++ b/slimbox2-rtl.css @@ -0,0 +1,84 @@ +/* SLIMBOX */ + +#lbOverlay { + position: fixed; + z-index: 9999; + left: 0; + top: 0; + width: 100%; + height: 100%; + background-color: #000; + cursor: pointer; +} + +#lbCenter, #lbBottomContainer { + position: absolute; + z-index: 9999; + overflow: hidden; + background-color: #fff; +} + +.lbLoading { + background: #fff url(loading.gif) no-repeat center; +} + +#lbImage { + position: absolute; + left: 0; + top: 0; + border: 10px solid #fff; + background-repeat: no-repeat; +} + +#lbPrevLink, #lbNextLink { + display: block; + position: absolute; + top: 0; + width: 50%; + outline: none; +} + +#lbPrevLink { + right: 0; +} + +#lbPrevLink:hover { + background: transparent url(prevlabel.gif) no-repeat 100% 15%; +} + +#lbNextLink { + left: 0; +} + +#lbNextLink:hover { + background: transparent url(nextlabel.gif) no-repeat 0 15%; +} + +#lbBottom { + font-family: Verdana, Arial, Geneva, Helvetica, sans-serif; + font-size: 10px; + color: #666; + line-height: 1.4em; + text-align: right; + border: 10px solid #fff; + border-top-style: none; + direction: rtl; +} + +#lbCloseLink { + display: block; + float: left; + width: 66px; + height: 22px; + background: transparent url(closelabel.gif) no-repeat center; + margin: 5px 0; + outline: none; +} + +#lbCaption, #lbNumber { + margin-left: 71px; +} + +#lbCaption { + font-weight: bold; +} diff --git a/slimbox2.css b/slimbox2.css new file mode 100644 index 0000000..9eed9bc --- /dev/null +++ b/slimbox2.css @@ -0,0 +1,83 @@ +/* SLIMBOX */ + +#lbOverlay { + position: fixed; + z-index: 9999; + left: 0; + top: 0; + width: 100%; + height: 100%; + background-color: #000; + cursor: pointer; +} + +#lbCenter, #lbBottomContainer { + position: absolute; + z-index: 9999; + overflow: hidden; + background-color: #fff; +} + +.lbLoading { + background: #fff url(loading.gif) no-repeat center; +} + +#lbImage { + position: absolute; + left: 0; + top: 0; + border: 10px solid #fff; + background-repeat: no-repeat; +} + +#lbPrevLink, #lbNextLink { + display: block; + position: absolute; + top: 0; + width: 50%; + outline: none; +} + +#lbPrevLink { + left: 0; +} + +#lbPrevLink:hover { + background: transparent url(prev.png) no-repeat 0 15%; +} + +#lbNextLink { + right: 0; +} + +#lbNextLink:hover { + background: transparent url(next.png) no-repeat 100% 15%; +} + +#lbBottom { + font-family: Verdana, Arial, Geneva, Helvetica, sans-serif; + font-size: 10px; + color: #666; + line-height: 1.4em; + text-align: left; + border: 10px solid #fff; + border-top-style: none; +} + +#lbCloseLink { + display: block; + float: right; + width: 66px; + height: 22px; + background: transparent url(closelabel.gif) no-repeat center; + margin: 5px 0; + outline: none; +} + +#lbCaption, #lbNumber { + margin-right: 71px; +} + +#lbCaption { + font-weight: bold; +} diff --git a/slimbox2.js b/slimbox2.js new file mode 100644 index 0000000..e3d51ba --- /dev/null +++ b/slimbox2.js @@ -0,0 +1,288 @@ +/* + Standalone (no jQuery) lightweight Lightbox implementation with minimal CSS3 animations + Based on and compatible with Slimbox2 + (c) 2012 Vitaliy Filippov + MIT-style license. +*/ + +window.addListener = (function() { + return window.addEventListener + ? function(el, type, fn) { el.addEventListener(type, fn, false); } + : function(el, type, fn) { el.attachEvent('on'+type, fn); }; +})(); + +window.removeListener = (function() { + return window.removeEventListener + ? function(el, type, fn) { el.removeEventListener(type, fn, false); } + : function(el, type, fn) { el.detachEvent('on'+type, fn); }; +})(); + +addListener(window, 'load', function() { + + // Global variables, accessible to Slimbox only + var options, images, activeImage = -1, activeURL, prevImage, nextImage, compatibleOverlay, middle, centerWidth, centerHeight, + ie6 = !window.XMLHttpRequest, hiddenElements = [], els = {}, css, keyActions, + // Preload images + preload = {}, preloadPrev = new Image(), preloadNext = new Image(); + + // Initialization + + // Append the Slimbox HTML code at the bottom of the document + var d = document.createElement('div'); + d.innerHTML = ''+ + '