├── pswp ├── .placeholder ├── default-skin │ ├── preloader.gif │ ├── default-skin.png │ ├── plugin.css │ ├── default-skin.svg │ └── default-skin.css ├── pswp.html ├── photoswipe.css ├── pswp.min.js ├── photoswipe-ui-default.min.js └── photoswipe.min.js ├── src ├── .placeholder └── pswp.js ├── custom ├── .placeholder └── default-skin │ └── .placeholder ├── .gitignore ├── plugin.json ├── README.md └── plugin.php /pswp/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /custom/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /custom/default-skin/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | custom/*.js 2 | custom/*.css 3 | custom/*.png 4 | custom/*.svg 5 | custom/*.gif 6 | -------------------------------------------------------------------------------- /pswp/default-skin/preloader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DanielMuller/koken-plugin-photoswipe/HEAD/pswp/default-skin/preloader.gif -------------------------------------------------------------------------------- /pswp/default-skin/default-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DanielMuller/koken-plugin-photoswipe/HEAD/pswp/default-skin/default-skin.png -------------------------------------------------------------------------------- /pswp/default-skin/plugin.css: -------------------------------------------------------------------------------- 1 | .pswp { 2 | text-align:left; 3 | } 4 | a.pswp__share--gplus:hover { 5 | background: #D73D32; 6 | color: #FFF; 7 | } 8 | a.pswp__share--tumblr:hover { 9 | background: #2c4762; 10 | color: #FFF; 11 | } 12 | .kicon-heart:before { 13 | content: '\e805'; 14 | font-family: 'kicons'; 15 | font-style: normal; 16 | font-weight: 400; 17 | } 18 | .icon-large:before { 19 | vertical-align:-10%; 20 | font-size:1.5em; 21 | } 22 | .pswp__button--rating, .pswp__button--rating:hover { 23 | background:none; 24 | color:#fff; 25 | } 26 | .koken-rating::after { 27 | content: attr(data-count); 28 | } 29 | -------------------------------------------------------------------------------- /pswp/default-skin/default-skin.svg: -------------------------------------------------------------------------------- 1 | default-skin 2 -------------------------------------------------------------------------------- /pswp/pswp.html: -------------------------------------------------------------------------------- 1 | 38 | -------------------------------------------------------------------------------- /plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "PhotoSwipe", 3 | "version": "1.7.10", 4 | "description": "Replaces default Lightbox with Photoswipe (http://photoswipe.com)", 5 | "author": { 6 | "name": "Daniel Muller", 7 | "link": "http://daniel.ctrlaltdel.ch" 8 | }, 9 | "data": { 10 | "share": { 11 | "label": "Sharing", 12 | "info": "Choose allowed sharing possibilites", 13 | "type": "placeholder" 14 | }, 15 | "share_facebook": { 16 | "label": "Facebook", 17 | "type": "boolean", 18 | "value": true 19 | }, 20 | "share_twitter": { 21 | "label": "Twitter", 22 | "type": "boolean", 23 | "value": true 24 | }, 25 | "share_pinterest": { 26 | "label": "Pinterest", 27 | "type": "boolean", 28 | "value": true 29 | }, 30 | "share_gplus": { 31 | "label": "Google+", 32 | "type": "boolean", 33 | "value": true 34 | }, 35 | "share_tumblr": { 36 | "label": "Tumblr", 37 | "type": "boolean", 38 | "value": false 39 | }, 40 | "share_download": { 41 | "label": "Download", 42 | "type": "boolean", 43 | "value": false 44 | }, 45 | "localization": { 46 | "label": "Localization settings", 47 | "info": "some localization strings", 48 | "type": "placeholder" 49 | }, 50 | "view_in_lightbox": { 51 | "label": "View in lightbox string", 52 | "info": "View in lightbox string", 53 | "type": "string" 54 | }, 55 | "behaviors": { 56 | "label": "Behaviors", 57 | "info": "Choose some behaviors", 58 | "type": "placeholder" 59 | }, 60 | "show_title": { 61 | "label": "Display caption", 62 | "type": "boolean", 63 | "value": false 64 | }, 65 | "download_full": { 66 | "label": "Download biggest size", 67 | "info": "Download current size or biggest size", 68 | "type": "boolean", 69 | "value": false 70 | }, 71 | "using_pjax_without_pillar": { 72 | "label": "Using pjax without pillar", 73 | "info": "Using pjax without pillar needs to disable the automatic pillar hacks (for example, list layout on Madison2 requires this flag enabled)", 74 | "type": "boolean", 75 | "value": false 76 | }, 77 | "trigger_el": { 78 | "label": "Trigger Element", 79 | "info": "jQuery Element that triggers Photoswipe. Needs to be the parent of the img tag. Leave empty to use the default based on current theme. Example for Axis: a.k-link-lightbox", 80 | "type": "string" 81 | }, 82 | "scroll_el": { 83 | "label": "Scroll Trigger Element", 84 | "info": "jQuery Element that triggers Koken's keyboard scroll. Leave empty to use the default based on current theme.", 85 | "type": "string" 86 | }, 87 | "max_size": { 88 | "label": "Max Image Size", 89 | "type": "slider", 90 | "min": 750, 91 | "max": 2050, 92 | "step": 50, 93 | "value": 2048, 94 | "suffix": "px" 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Koken Photoswipe Plugin 2 | ======================= 3 | Disclaimer 4 | ----------------- 5 | This repo is now archieved. 6 | 7 | I am no longer a user of [Koken](http://koken.me/) and have migrated my Gallery to [Yapawa](https://yapawa.net/), a gallery site that I developped. 8 | 9 | Thank you Koken Team for your awesome tool that allowed me to host my pictures during many years. 10 | 11 | --- 12 | 13 | Usage limitations 14 | ----------------- 15 | - This plugin is originally developped for the Axis Theme (version 1). On other Themes, the result can be totally unpredictable. 16 | It makes only sense on pages with a thumnail-grid layout and with the ability to link the images to Lightbox (lens templates using ``). 17 | - `` lens tags must not have a fixed preset. The plugin is expecting the *data-presets* attribute to get all avalaible sizes. 18 | - Support for Themes other than Axis was added in V1.2. 19 | - Since V1.3, the plugin now works on any page, as long as the DOM is structured as expected. 20 | - Major improvements since V1.5 to support Pillar based themes (V2 Themes). 21 | 22 | Demo 23 | ---- 24 | Check out http://daniel.mesphotos.ch to see it in action 25 | 26 | Installation 27 | ------------ 28 | [Photoswipe](https://github.com/dimsemenov/photoswipe) files are included as static inside the *vendor* folder. 29 | To install, execute on the server (or locally and copy to the server): 30 | ```bash 31 | git clone https://github.com/DanielMuller/koken-plugin-photoswipe.git path/to/koken/storage/plugins/photoswipe 32 | ``` 33 | 34 | Enable plugin in Settings/Plugins. 35 | 36 | Configuration 37 | ------------- 38 | You can choose which sharing services are available. 39 | 40 | You can define which DOM Elements will trigger Photoswipe. by leaving the option empty, the default element for the current Theme is used. 41 | 42 | It advised to clear *System Caches* after inabling it. 43 | 44 | Layout 45 | ------ 46 | By default, the default layout from Photoswipe is used: 47 | - pswp/photoswipe.css 48 | - pswp/default-skin/default-skin.css 49 | - pswp/photoswipe.min.js 50 | - pswp/photoswipe-ui-default.min.js 51 | - pswp.min.js 52 | 53 | You can replace any of this files, by creating a file with same name inside the `custom` folder: 54 | - custom/photoswipe.css 55 | - custom/default-skin/default-skin.css 56 | - custom/photoswipe.min.js 57 | - custom/photoswipe-ui-default.min.js 58 | - custom/pswp.min.js 59 | 60 | Uglifier 61 | -------- 62 | Javascript compression can be done using uglify-js, a node.js library. 63 | An easy way to install it under Debian/Ubuntu: 64 | `apt-get install node-uglify` 65 | 66 | And uglify the file by running: 67 | `uglifyjs src/pswp.js > pswp/pswp.min.js` 68 | 69 | Title/Caption 70 | ------------- 71 | 72 | You can enable/disable the usage of the image title/caption in the lightbox in 73 | the plugin setup. 74 | 75 | The image title will be used from the `alt` image attribute. 76 | 77 | If you want to add the caption or additional information to the image title 78 | you've to add a html element to the template. 79 | 80 | Simple caption: 81 | 82 | 83 | 84 | 85 | 86 | 87 | Complex caption using the timestamp and exif data: 88 | 89 | 90 | 91 | 115 | 116 | 117 | 118 | Todo 119 | ---- 120 | - Ajax/PHP calls for image details 121 | 122 | Credits 123 | ------- 124 | All the heavy lifting is done using [Photoswipe](http://photoswipe.com) by [Code computerlove](http://www.codecomputerlove.com/) and [Dmitry Semenov](http://dimsemenov.com/). 125 | This plugin just integrates the relevant code into [Koken](http://koken.me/). 126 | The version used in this plugin is [2572d...](https://github.com/dimsemenov/PhotoSwipe/tree/2572dbd4987938e9e71c64eaffd634aaf658082f) 127 | -------------------------------------------------------------------------------- /pswp/photoswipe.css: -------------------------------------------------------------------------------- 1 | /*! PhotoSwipe main CSS by Dmitry Semenov | photoswipe.com | MIT license */ 2 | /* 3 | Styles for basic PhotoSwipe functionality (sliding area, open/close transitions) 4 | */ 5 | /* pswp = photoswipe */ 6 | .pswp { 7 | display: none; 8 | position: absolute; 9 | width: 100%; 10 | height: 100%; 11 | left: 0; 12 | top: 0; 13 | overflow: hidden; 14 | -ms-touch-action: none; 15 | touch-action: none; 16 | z-index: 1500; 17 | -webkit-text-size-adjust: 100%; 18 | /* create separate layer, to avoid paint on window.onscroll in webkit/blink */ 19 | -webkit-backface-visibility: hidden; 20 | outline: none; } 21 | .pswp * { 22 | -webkit-box-sizing: border-box; 23 | box-sizing: border-box; } 24 | .pswp img { 25 | max-width: none; } 26 | 27 | /* style is added when JS option showHideOpacity is set to true */ 28 | .pswp--animate_opacity { 29 | /* 0.001, because opacity:0 doesn't trigger Paint action, which causes lag at start of transition */ 30 | opacity: 0.001; 31 | will-change: opacity; 32 | /* for open/close transition */ 33 | -webkit-transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1); 34 | transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1); } 35 | 36 | .pswp--open { 37 | display: block; } 38 | 39 | .pswp--zoom-allowed .pswp__img { 40 | /* autoprefixer: off */ 41 | cursor: -webkit-zoom-in; 42 | cursor: -moz-zoom-in; 43 | cursor: zoom-in; } 44 | 45 | .pswp--zoomed-in .pswp__img { 46 | /* autoprefixer: off */ 47 | cursor: -webkit-grab; 48 | cursor: -moz-grab; 49 | cursor: grab; } 50 | 51 | .pswp--dragging .pswp__img { 52 | /* autoprefixer: off */ 53 | cursor: -webkit-grabbing; 54 | cursor: -moz-grabbing; 55 | cursor: grabbing; } 56 | 57 | /* 58 | Background is added as a separate element. 59 | As animating opacity is much faster than animating rgba() background-color. 60 | */ 61 | .pswp__bg { 62 | position: absolute; 63 | left: 0; 64 | top: 0; 65 | width: 100%; 66 | height: 100%; 67 | background: #000; 68 | opacity: 0; 69 | -webkit-transform: translateZ(0); 70 | transform: translateZ(0); 71 | -webkit-backface-visibility: hidden; 72 | will-change: opacity; } 73 | 74 | .pswp__scroll-wrap { 75 | position: absolute; 76 | left: 0; 77 | top: 0; 78 | width: 100%; 79 | height: 100%; 80 | overflow: hidden; } 81 | 82 | .pswp__container, 83 | .pswp__zoom-wrap { 84 | -ms-touch-action: none; 85 | touch-action: none; 86 | position: absolute; 87 | left: 0; 88 | right: 0; 89 | top: 0; 90 | bottom: 0; } 91 | 92 | /* Prevent selection and tap highlights */ 93 | .pswp__container, 94 | .pswp__img { 95 | -webkit-user-select: none; 96 | -moz-user-select: none; 97 | -ms-user-select: none; 98 | user-select: none; 99 | -webkit-tap-highlight-color: transparent; 100 | -webkit-touch-callout: none; } 101 | 102 | .pswp__zoom-wrap { 103 | position: absolute; 104 | width: 100%; 105 | -webkit-transform-origin: left top; 106 | -ms-transform-origin: left top; 107 | transform-origin: left top; 108 | /* for open/close transition */ 109 | -webkit-transition: -webkit-transform 333ms cubic-bezier(0.4, 0, 0.22, 1); 110 | transition: transform 333ms cubic-bezier(0.4, 0, 0.22, 1); } 111 | 112 | .pswp__bg { 113 | will-change: opacity; 114 | /* for open/close transition */ 115 | -webkit-transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1); 116 | transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1); } 117 | 118 | .pswp--animated-in .pswp__bg, 119 | .pswp--animated-in .pswp__zoom-wrap { 120 | -webkit-transition: none; 121 | transition: none; } 122 | 123 | .pswp__container, 124 | .pswp__zoom-wrap { 125 | -webkit-backface-visibility: hidden; } 126 | 127 | .pswp__item { 128 | position: absolute; 129 | left: 0; 130 | right: 0; 131 | top: 0; 132 | bottom: 0; 133 | overflow: hidden; } 134 | 135 | .pswp__img { 136 | position: absolute; 137 | width: auto; 138 | height: auto; 139 | top: 0; 140 | left: 0; } 141 | 142 | /* 143 | stretched thumbnail or div placeholder element (see below) 144 | style is added to avoid flickering in webkit/blink when layers overlap 145 | */ 146 | .pswp__img--placeholder { 147 | -webkit-backface-visibility: hidden; } 148 | 149 | /* 150 | div element that matches size of large image 151 | large image loads on top of it 152 | */ 153 | .pswp__img--placeholder--blank { 154 | background: #222; } 155 | 156 | .pswp--ie .pswp__img { 157 | width: 100% !important; 158 | height: auto !important; 159 | left: 0; 160 | top: 0; } 161 | 162 | /* 163 | Error message appears when image is not loaded 164 | (JS option errorMsg controls markup) 165 | */ 166 | .pswp__error-msg { 167 | position: absolute; 168 | left: 0; 169 | top: 50%; 170 | width: 100%; 171 | text-align: center; 172 | font-size: 14px; 173 | line-height: 16px; 174 | margin-top: -8px; 175 | color: #CCC; } 176 | 177 | .pswp__error-msg a { 178 | color: #CCC; 179 | text-decoration: underline; } 180 | -------------------------------------------------------------------------------- /plugin.php: -------------------------------------------------------------------------------- 1 | pswp_folder = "pswp"; 8 | $this->custom_folder = "custom"; 9 | $this->dev_folder = "src"; 10 | 11 | $this->register_hook('before_closing_body', 'foot'); 12 | 13 | $this->env = "production"; 14 | # Define ENVIRONMENT in app/site/site.php 15 | if (defined('ENVIRONMENT')) { 16 | if (ENVIRONMENT!="production") { 17 | $this->env = "development"; 18 | } 19 | } 20 | } 21 | 22 | function foot($data) 23 | { 24 | 25 | $sharing = Array(); 26 | foreach ($this->data as $key => $val) { 27 | $matches = null; 28 | preg_match("/^share_(.+)$/",$key,$matches); 29 | if ($matches[1] && $val == 1) { 30 | $sharing[] = $matches[1]; 31 | } 32 | } 33 | 34 | $scrollEl = $this->get_scrollEl(); 35 | $css = "photoswipe.css"; 36 | $skin_css = "default-skin/default-skin.css"; 37 | $js = "photoswipe.min.js"; 38 | $ui_js = "photoswipe-ui-default.min.js"; 39 | $pswp_js = "pswp.min.js"; 40 | $plugin_css = "default-skin/plugin.css"; 41 | 42 | $pswp = Array(); 43 | $pswp[] = ''; 44 | $pswp[] = ''; 45 | $pswp[] = ''; 46 | $pswp[] = ''; 47 | $pswp[] = ''; 48 | $pswp[] = ''; 49 | $koken_options = Array( 50 | 'showTitle' => $this->data->show_title ? true : false, 51 | 'sharing' => $sharing, 52 | 'triggerEl' => $this->get_triggerEl(), 53 | 'view_in_lightbox' => $this->get_view_in_lightbox(), 54 | 'usingPillar' => $this->usingPillar(), 55 | 'usingPjaxWithoutPillar' => $this->data->using_pjax_without_pillar ? true : false, 56 | 'hidpi' => Koken::$site['hidpi'], 57 | 'max_size' => intval($this->data->max_size), 58 | 'download_full' => $this->data->download_full ? true : false 59 | ); 60 | $pswp[] = ''; 61 | 62 | if ($scrollEl) { 63 | $pswp[] = ''; 64 | } 65 | 66 | if (is_file($this->get_file_path().DIRECTORY_SEPARATOR.$this->custom_folder.DIRECTORY_SEPARATOR."pswp.html")) { 67 | include $this->get_file_path().DIRECTORY_SEPARATOR.$this->custom_folder.DIRECTORY_SEPARATOR."pswp.html"; 68 | } else { 69 | include $this->get_file_path().DIRECTORY_SEPARATOR.$this->pswp_folder.DIRECTORY_SEPARATOR."pswp.html"; 70 | } 71 | print join("\n",$pswp); 72 | } 73 | 74 | function get_url($file) { 75 | if ($this->env=="development") { 76 | $real_file = str_replace("min.","",$file); 77 | if (is_file($this->get_file_path().DIRECTORY_SEPARATOR.$this->dev_folder.DIRECTORY_SEPARATOR.$real_file)) { 78 | return Koken::$location['real_root_folder']."/storage/plugins/".$this->get_key()."/".$this->dev_folder."/".$real_file; 79 | } 80 | if (is_file($this->get_file_path().DIRECTORY_SEPARATOR.$this->dev_folder.DIRECTORY_SEPARATOR.$file)) { 81 | return Koken::$location['real_root_folder']."/storage/plugins/".$this->get_key()."/".$this->dev_folder."/".$file; 82 | } 83 | } 84 | if (is_file($this->get_file_path().DIRECTORY_SEPARATOR.$this->custom_folder.DIRECTORY_SEPARATOR.$file)) { 85 | return Koken::$location['real_root_folder']."/storage/plugins/".$this->get_key()."/".$this->custom_folder."/".$file; 86 | } 87 | else { 88 | return Koken::$location['real_root_folder']."/storage/plugins/".$this->get_key()."/".$this->pswp_folder."/".$file; 89 | } 90 | } 91 | 92 | function get_triggerEl() { 93 | if (trim($this->data->trigger_el)!="") { 94 | return trim($this->data->trigger_el); 95 | } 96 | 97 | $triggerEls = Array( 98 | 'axis' => 'a.k-link-lightbox', 99 | 'axis 2' => 'a.k-link-lightbox', 100 | 'boulevard' => 'div.content', 101 | 'chastain' => 'span.img-wrap a', 102 | 'elementary' => 'a.thumb', 103 | 'ensemble' => 'div.list-image a', 104 | 'madison' => 'a.k-link-lightbox', 105 | 'madison 2' => 'a.k-link-lightbox', 106 | 'regale' => 'div#grid:not(.albums) a.img-hover', 107 | 'regale 2' => 'a.k-link-lightbox', 108 | 'repertoire' => 'div.img-wrap a', 109 | 'oxygen' => 'a.k-link-lightbox' 110 | ); 111 | $myTheme = strtolower(Koken::$site['theme']['name']); 112 | return $triggerEls[$myTheme]; 113 | } 114 | 115 | function get_scrollEl() { 116 | if (trim($this->data->scroll_el)!="") { 117 | $element = trim($this->data->scroll_el); 118 | $info = pathinfo($element); 119 | return Array($element, $info['extension']); 120 | } 121 | 122 | $scrollEls = Array( 123 | 'ensemble' => 'div.list-image', 124 | 'repertoire' => '.scroll-me', 125 | 'chastain' => '.content-list', 126 | 'madison' => '.item' 127 | ); 128 | $myTheme = strtolower(Koken::$site['theme']['name']); 129 | 130 | $scrollEl = null; 131 | if (array_key_exists($myTheme,$scrollEls)) { 132 | $element = $scrollEls[$myTheme]; 133 | $info = pathinfo($element); 134 | $scrollEl = Array($element, $info['extension']); 135 | } 136 | return $scrollEl; 137 | } 138 | 139 | function usingPillar() { 140 | $myTheme = strtolower(Koken::$site['theme']['name']); 141 | $pillarThemes = Array('madison 2', 'regale 2', 'axis 2'); 142 | return (in_array($myTheme,$pillarThemes)) ? true : false; 143 | } 144 | 145 | function get_view_in_lightbox() { 146 | if (trim($this->data->view_in_lightbox)!="") { 147 | return trim($this->data->view_in_lightbox); 148 | } 149 | else return "View in lightbox"; 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /pswp/pswp.min.js: -------------------------------------------------------------------------------- 1 | var initPhotoSwipeFromDOM=function(options){var parseThumbnailElements=function(el){var items=[];el.children("img").each(function(){if(typeof $(this).attr("data-base")!="undefined"&&typeof $(this).attr("data-extension")!="undefined"&&typeof $(this).attr("data-presets")!="undefined"){var item={};var base=$(this).attr("data-base");var ext=$(this).attr("data-extension");item["_common"]={msrc:$(this).attr("data-src")||$(this).attr("src")};item["title"]=$(this).attr("data-alt")||$(this).attr("alt");item["caption"]=$(this).nextAll(".item-caption:first").html();item.pid=base.split("/").slice(-3).join("-").slice(0,-1).toLowerCase();var rating_el=$(this).parent().parent().children("figcaption").find("span.koken-rating");var rating=null;if(rating_el.length>0){rating={cid:rating_el.attr("data-cid"),average:rating_el.attr("data-average"),count:rating_el.attr("data-count")}}item["rating"]=rating;jQuery.each($(this).attr("data-presets").split(" "),function(i,val){var preset_info=val.split(",");var name=preset_info[0];var size_factor=isHighDensity()?2:1;var retina=isHighDensity()?".2x.":".";var w=parseInt(preset_info[1]);var h=parseInt(preset_info[2]);var src=base+name+retina+ext;item[name]={src:src,w:size_factor*w,h:size_factor*h};if(name=="huge"){item["huge.2x"]={src:base+name+".2x."+ext,w:2*w,h:2*h}}});itemExists=false;$.each(items,function(index,value){if(value.pid==item.pid){itemExists=true;return false}});if(!itemExists){items.push(item)}}});return items};var photoswipeParseHash=function(){var hash=window.location.hash.substring(1),params={};if(hash.length<5){return params}var vars=hash.split("&");for(var i=0;i0,getDoubleTapZoom:function(){if(window.devicePixelRatio>1){return.5}else{return 1}},galleryPIDs:true,addCaptionHTMLFn:function(item,captionEl,isFake){if(item["rating"]&&!isFake){$("button.pswp__button--rating span").attr("data-cid",item["rating"].cid).attr("data-average",item["rating"].average).attr("data-count",item["rating"].count)}if(!koken_options.showTitle||!item.title){captionEl.children[0].innerHTML="";return false}captionEl.children[0].innerHTML=item.title+(item.caption?"
"+item.caption+"":"");return true}};if(fromURL){if(options.galleryPIDs){for(var j=0;j=1600&&max_size>=1600&&"huge"in items[0]){neededSize="huge";if(realViewportWidth>=2048&&max_size>=2048&&koken_options.hidpi===true&&size_factor==1){neededSize="huge.2x"}}else if(realViewportWidth>=1024&&max_size>=1024&&"xlarge"in items[0]){neededSize="xlarge"}else if(realViewportWidth>=800&&max_size>=800&&"large"in items[0]){neededSize="large"}else{neededSize="medium_large"}if(useImageSize!=neededSize){useImageSize=neededSize;if(!firstResize){gallery.invalidateCurrItems()}}firstResize=false});gallery.listen("gettingData",function(index,item){item.src=item[useImageSize].src;item.msrc=item["_common"].msrc.replace(".crop.",".");item.w=item[useImageSize].w;item.h=item[useImageSize].h});var scroll_move=null;var bind_move=false;if(typeof $K=="object"){if(typeof $K.keyboard=="object"){if(typeof $K.keyboard.scroll=="object"){if(typeof $K.keyboard.scroll.move=="function"){scroll_move=$K.keyboard.scroll.move;$K.keyboard.scroll.move=function(){return true}}}$("[data-bind-to-key]").each(function(){bind_move=true;var t=$(this),e=t.attr("data-bind-to-key");key.unbind(e)})}}gallery.listen("destroy",function(){if(bind_move===true){$K.keyboard.bind()}if(scroll_move){$K.keyboard.scroll.move=scroll_move;scroll_move=null}pswp_open=false;$(".pswp")[0].className="pswp";if(pswp_open_orientation!=window.orientation){initPS()}if(pswp_open_width!=$(window).width()||pswp_open_height!=$(window).height()){initPS()}});gallery.init();pswp_open=true;pswp_open_orientation=window.orientation;pswp_open_width=$(window).width();pswp_open_height=$(window).height()};var isHighDensity=function(){if(koken_options.hidpi===false){return false}return window.matchMedia&&(window.matchMedia("only screen and (min-resolution: 144dpi), only screen and (min-resolution: 1.3dppx), only screen and (min-resolution: 48.8dpcm)").matches||window.matchMedia("only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3)").matches)||window.devicePixelRatio&&window.devicePixelRatio>1.3};var initPS=function(){if(koken_options.usingPillar||koken_options.usingPjaxWithoutPillar){setTimeout(runInitPS,500)}else{runInitPS()}};var runInitPS=function(){if(!pswp_open){$(".pswp")[0].className="pswp";$("a[data-pswp-uid]").removeAttr("data-pswp-upid")}var i=0;if(koken_options.usingPillar&&!koken_options.usingPjaxWithoutPillar){if(size_group=="size_0"&&typeof start_size_group=="undefined"){old_size_group=size_group;class_attr=$("div.pillar").attr("class");if(class_attr){start_size_group=$.grep(class_attr.split(" "),function(v){return v!="pillar"})[0]}}if(orientation_changed){if(size_group=="size_0"){size_group=start_size_group}old_size_group=size_group;class_attr=$("div.pillar:not(."+old_size_group+")").attr("class");if(class_attr){size_group=$.grep(class_attr.split(" "),function(v){return v!="pillar"})[0]}orientation_changed=false}galleryElements=$("div.pillar:not(."+old_size_group+") "+koken_options.triggerEl)}else{galleryElements=$(koken_options.triggerEl)}if(!pswp_open){galleryElements.each(function(){if($(this).children("img").length>0){set_link($(this),i);i++}});galleryElements.each(function(){if($(this).attr("title")==koken_options.view_in_lightbox){lb_url=$(this).attr("href");if(typeof lb_url!="undefined"&&lb_url.length>0){lb_element=$(this);$('a[href="'+lb_url+'"]').each(function(){if($(this).attr("data-pswp-uid")&&$(this).children("img").length>0){set_link(lb_element,$(this).attr("data-pswp-uid"))}})}}})}};var set_link=function(el,i){if(!el.parent().hasClass("type_video")){el.click(function(e){openPhotoSwipe(el.first().attr("data-pswp-uid"));return false})}el.attr("data-pswp-uid",i)};var koken_options=options;var pswp_open=false;var pswp_open_orientation;var orientation_changed=false;var orientation=window.orientation;var size_group="size_0",old_size_group,start_size_group;var galleryElements=$(koken_options.triggerEl);var last_resize=0;$(window).on("k-resize",function(){if(Date.now()-last_resize>1e3){last_resize=Date.now();initPS()}});if(koken_options.usingPillar||koken_options.usingPjaxWithoutPillar){$(document).on("pjax:end",function(){initPS()});$(window).on("orientationchange",function(){if(window.orientation!=orientation){orientation_changed=true;orientation=window.orientation;initPS()}else{orientation_changed=false}});$(window).on("k-infinite-loaded",function(){initPS()});initPS()}else{initPS()}var hashData=photoswipeParseHash();if(hashData.pid&&hashData.gid){openPhotoSwipe(hashData.pid,true,true)}}; 2 | -------------------------------------------------------------------------------- /pswp/photoswipe-ui-default.min.js: -------------------------------------------------------------------------------- 1 | /*! PhotoSwipe Default UI - 4.1.2 - 2017-04-05 2 | * http://photoswipe.com 3 | * Copyright (c) 2017 Dmitry Semenov; */ 4 | !function(a,b){"function"==typeof define&&define.amd?define(b):"object"==typeof exports?module.exports=b():a.PhotoSwipeUI_Default=b()}(this,function(){"use strict";var a=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v=this,w=!1,x=!0,y=!0,z={barsSize:{top:44,bottom:"auto"},closeElClasses:["item","caption","zoom-wrap","ui","top-bar"],timeToIdle:4e3,timeToIdleOutside:1e3,loadingIndicatorDelay:1e3,addCaptionHTMLFn:function(a,b){return a.title?(b.children[0].innerHTML=a.title,!0):(b.children[0].innerHTML="",!1)},closeEl:!0,captionEl:!0,fullscreenEl:!0,zoomEl:!0,shareEl:!0,counterEl:!0,arrowEl:!0,preloaderEl:!0,tapToClose:!1,tapToToggleControls:!0,clickToCloseNonZoomable:!0,shareButtons:[{id:"facebook",label:"Share on Facebook",url:"https://www.facebook.com/sharer/sharer.php?u={{url}}"},{id:"twitter",label:"Tweet",url:"https://twitter.com/intent/tweet?text={{text}}&url={{url}}"},{id:"pinterest",label:"Pin it",url:"http://www.pinterest.com/pin/create/button/?url={{url}}&media={{image_url}}&description={{text}}"},{id:"download",label:"Download image",url:"{{raw_image_url}}",download:!0}],getImageURLForShare:function(){return a.currItem.src||""},getPageURLForShare:function(){return window.location.href},getTextForShare:function(){return a.currItem.title||""},indexIndicatorSep:" / ",fitControlsWidth:1200},A=function(a){if(r)return!0;a=a||window.event,q.timeToIdle&&q.mouseUsed&&!k&&K();for(var c,d,e=a.target||a.srcElement,f=e.getAttribute("class")||"",g=0;g-1&&(c.onTap(),d=!0);if(d){a.stopPropagation&&a.stopPropagation(),r=!0;var h=b.features.isOldAndroid?600:30;s=setTimeout(function(){r=!1},h)}},B=function(){return!a.likelyTouchDevice||q.mouseUsed||screen.width>q.fitControlsWidth},C=function(a,c,d){b[(d?"add":"remove")+"Class"](a,"pswp__"+c)},D=function(){var a=1===q.getNumItemsFn();a!==p&&(C(d,"ui--one-slide",a),p=a)},E=function(){C(i,"share-modal--hidden",y)},F=function(){return y=!y,y?(b.removeClass(i,"pswp__share-modal--fade-in"),setTimeout(function(){y&&E()},300)):(E(),setTimeout(function(){y||b.addClass(i,"pswp__share-modal--fade-in")},30)),y||H(),!1},G=function(b){b=b||window.event;var c=b.target||b.srcElement;return a.shout("shareLinkClick",b,c),!!c.href&&(!!c.hasAttribute("download")||(window.open(c.href,"pswp_share","scrollbars=yes,resizable=yes,toolbar=no,location=yes,width=550,height=420,top=100,left="+(window.screen?Math.round(screen.width/2-275):100)),y||F(),!1))},H=function(){for(var a,b,c,d,e,f="",g=0;g