Initial commit: Photography portfolio based on rampatra/photography

- Jekyll-based photography portfolio template
- Added Brain.md (project knowledge base) and Skill.md (skill commands)
- Configured remote to Kroonk/Photography.git
- Added .claude/ to .gitignore

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Kroonk
2026-04-12 13:14:44 +02:00
commit 5434298c25
146 changed files with 22382 additions and 0 deletions

2
assets/js/breakpoints.min.js vendored Normal file
View File

@@ -0,0 +1,2 @@
/* breakpoints.js v1.0 | @ajlkn | MIT licensed */
var breakpoints=function(){"use strict";function e(e){t.init(e)}var t={list:null,media:{},events:[],init:function(e){t.list=e,window.addEventListener("resize",t.poll),window.addEventListener("orientationchange",t.poll),window.addEventListener("load",t.poll),window.addEventListener("fullscreenchange",t.poll)},active:function(e){var n,a,s,i,r,d,c;if(!(e in t.media)){if(">="==e.substr(0,2)?(a="gte",n=e.substr(2)):"<="==e.substr(0,2)?(a="lte",n=e.substr(2)):">"==e.substr(0,1)?(a="gt",n=e.substr(1)):"<"==e.substr(0,1)?(a="lt",n=e.substr(1)):"!"==e.substr(0,1)?(a="not",n=e.substr(1)):(a="eq",n=e),n&&n in t.list)if(i=t.list[n],Array.isArray(i)){if(r=parseInt(i[0]),d=parseInt(i[1]),isNaN(r)){if(isNaN(d))return;c=i[1].substr(String(d).length)}else c=i[0].substr(String(r).length);if(isNaN(r))switch(a){case"gte":s="screen";break;case"lte":s="screen and (max-width: "+d+c+")";break;case"gt":s="screen and (min-width: "+(d+1)+c+")";break;case"lt":s="screen and (max-width: -1px)";break;case"not":s="screen and (min-width: "+(d+1)+c+")";break;default:s="screen and (max-width: "+d+c+")"}else if(isNaN(d))switch(a){case"gte":s="screen and (min-width: "+r+c+")";break;case"lte":s="screen";break;case"gt":s="screen and (max-width: -1px)";break;case"lt":s="screen and (max-width: "+(r-1)+c+")";break;case"not":s="screen and (max-width: "+(r-1)+c+")";break;default:s="screen and (min-width: "+r+c+")"}else switch(a){case"gte":s="screen and (min-width: "+r+c+")";break;case"lte":s="screen and (max-width: "+d+c+")";break;case"gt":s="screen and (min-width: "+(d+1)+c+")";break;case"lt":s="screen and (max-width: "+(r-1)+c+")";break;case"not":s="screen and (max-width: "+(r-1)+c+"), screen and (min-width: "+(d+1)+c+")";break;default:s="screen and (min-width: "+r+c+") and (max-width: "+d+c+")"}}else s="("==i.charAt(0)?"screen and "+i:i;t.media[e]=!!s&&s}return t.media[e]!==!1&&window.matchMedia(t.media[e]).matches},on:function(e,n){t.events.push({query:e,handler:n,state:!1}),t.active(e)&&n()},poll:function(){var e,n;for(e=0;e<t.events.length;e++)n=t.events[e],t.active(n.query)?n.state||(n.state=!0,n.handler()):n.state&&(n.state=!1)}};return e._=t,e.on=function(e,n){t.on(e,n)},e.active=function(e){return t.active(e)},e}();!function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():e.breakpoints=t()}(this,function(){return breakpoints});

2
assets/js/browser.min.js vendored Normal file
View File

@@ -0,0 +1,2 @@
/* browser.js v1.0.1 | @ajlkn | MIT licensed */
var browser=function(){"use strict";var t={name:null,version:null,os:null,osVersion:null,touch:null,mobile:null,_canUse:null,canUse:function(e){t._canUse||(t._canUse=document.createElement("div"));var n=t._canUse.style,r=e.charAt(0).toUpperCase()+e.slice(1);return e in n||"Moz"+r in n||"Webkit"+r in n||"O"+r in n||"ms"+r in n},init:function(){for(var e=navigator.userAgent,n="other",r=0,i=[["firefox",/Firefox\/([0-9\.]+)/],["bb",/BlackBerry.+Version\/([0-9\.]+)/],["bb",/BB[0-9]+.+Version\/([0-9\.]+)/],["opera",/OPR\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)/],["edge",/Edge\/([0-9\.]+)/],["safari",/Version\/([0-9\.]+).+Safari/],["chrome",/Chrome\/([0-9\.]+)/],["ie",/MSIE ([0-9]+)/],["ie",/Trident\/.+rv:([0-9]+)/]],o=0;o<i.length;o++)if(e.match(i[o][1])){n=i[o][0],r=parseFloat(RegExp.$1);break}for(t.name=n,t.version=r,n="other",i=[["ios",/([0-9_]+) like Mac OS X/,function(e){return e.replace("_",".").replace("_","")}],["ios",/CPU like Mac OS X/,function(e){return 0}],["wp",/Windows Phone ([0-9\.]+)/,null],["android",/Android ([0-9\.]+)/,null],["mac",/Macintosh.+Mac OS X ([0-9_]+)/,function(e){return e.replace("_",".").replace("_","")}],["windows",/Windows NT ([0-9\.]+)/,null],["bb",/BlackBerry.+Version\/([0-9\.]+)/,null],["bb",/BB[0-9]+.+Version\/([0-9\.]+)/,null],["linux",/Linux/,null],["bsd",/BSD/,null],["unix",/X11/,null]],o=r=0;o<i.length;o++)if(e.match(i[o][1])){n=i[o][0],r=parseFloat(i[o][2]?i[o][2](RegExp.$1):RegExp.$1);break}"mac"==n&&"ontouchstart"in window&&(1024==screen.width&&1366==screen.height||834==screen.width&&1112==screen.height||810==screen.width&&1080==screen.height||768==screen.width&&1024==screen.height)&&(n="ios"),t.os=n,t.osVersion=r,t.touch="wp"==t.os?0<navigator.msMaxTouchPoints:!!("ontouchstart"in window),t.mobile="wp"==t.os||"android"==t.os||"ios"==t.os||"bb"==t.os}};return t.init(),t}();!function(e,n){"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?module.exports=n():e.browser=n()}(this,function(){return browser});

10
assets/js/exif.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
interface EXIFStatic {
getData(url: string, callback: any): any;
getTag(img: any, tag: any): any;
getAllTags(img: any): any;
pretty(img: any): string;
readFromBinaryFile(file: any): any;
}
declare var EXIF : EXIFStatic;
export = EXIF;

824
assets/js/exif.js Normal file
View File

@@ -0,0 +1,824 @@
(function() {
var debug = false;
var root = this;
var EXIF = function(obj) {
if (obj instanceof EXIF) return obj;
if (!(this instanceof EXIF)) return new EXIF(obj);
this.EXIFwrapped = obj;
};
if (typeof exports !== 'undefined') {
if (typeof module !== 'undefined' && module.exports) {
exports = module.exports = EXIF;
}
exports.EXIF = EXIF;
} else {
root.EXIF = EXIF;
}
var ExifTags = EXIF.Tags = {
// version tags
0x9000 : "ExifVersion", // EXIF version
0xA000 : "FlashpixVersion", // Flashpix format version
// colorspace tags
0xA001 : "ColorSpace", // Color space information tag
// image configuration
0xA002 : "PixelXDimension", // Valid width of meaningful image
0xA003 : "PixelYDimension", // Valid height of meaningful image
0x9101 : "ComponentsConfiguration", // Information about channels
0x9102 : "CompressedBitsPerPixel", // Compressed bits per pixel
// user information
0x927C : "MakerNote", // Any desired information written by the manufacturer
0x9286 : "UserComment", // Comments by user
// related file
0xA004 : "RelatedSoundFile", // Name of related sound file
// date and time
0x9003 : "DateTimeOriginal", // Date and time when the original image was generated
0x9004 : "DateTimeDigitized", // Date and time when the image was stored digitally
0x9290 : "SubsecTime", // Fractions of seconds for DateTime
0x9291 : "SubsecTimeOriginal", // Fractions of seconds for DateTimeOriginal
0x9292 : "SubsecTimeDigitized", // Fractions of seconds for DateTimeDigitized
// picture-taking conditions
0x829A : "ExposureTime", // Exposure time (in seconds)
0x829D : "FNumber", // F number
0x8822 : "ExposureProgram", // Exposure program
0x8824 : "SpectralSensitivity", // Spectral sensitivity
0x8827 : "ISOSpeedRatings", // ISO speed rating
0x8828 : "OECF", // Optoelectric conversion factor
0x9201 : "ShutterSpeedValue", // Shutter speed
0x9202 : "ApertureValue", // Lens aperture
0x9203 : "BrightnessValue", // Value of brightness
0x9204 : "ExposureBias", // Exposure bias
0x9205 : "MaxApertureValue", // Smallest F number of lens
0x9206 : "SubjectDistance", // Distance to subject in meters
0x9207 : "MeteringMode", // Metering mode
0x9208 : "LightSource", // Kind of light source
0x9209 : "Flash", // Flash status
0x9214 : "SubjectArea", // Location and area of main subject
0x920A : "FocalLength", // Focal length of the lens in mm
0xA20B : "FlashEnergy", // Strobe energy in BCPS
0xA20C : "SpatialFrequencyResponse", //
0xA20E : "FocalPlaneXResolution", // Number of pixels in width direction per FocalPlaneResolutionUnit
0xA20F : "FocalPlaneYResolution", // Number of pixels in height direction per FocalPlaneResolutionUnit
0xA210 : "FocalPlaneResolutionUnit", // Unit for measuring FocalPlaneXResolution and FocalPlaneYResolution
0xA214 : "SubjectLocation", // Location of subject in image
0xA215 : "ExposureIndex", // Exposure index selected on camera
0xA217 : "SensingMethod", // Image sensor type
0xA300 : "FileSource", // Image source (3 == DSC)
0xA301 : "SceneType", // Scene type (1 == directly photographed)
0xA302 : "CFAPattern", // Color filter array geometric pattern
0xA401 : "CustomRendered", // Special processing
0xA402 : "ExposureMode", // Exposure mode
0xA403 : "WhiteBalance", // 1 = auto white balance, 2 = manual
0xA404 : "DigitalZoomRation", // Digital zoom ratio
0xA405 : "FocalLengthIn35mmFilm", // Equivalent foacl length assuming 35mm film camera (in mm)
0xA406 : "SceneCaptureType", // Type of scene
0xA407 : "GainControl", // Degree of overall image gain adjustment
0xA408 : "Contrast", // Direction of contrast processing applied by camera
0xA409 : "Saturation", // Direction of saturation processing applied by camera
0xA40A : "Sharpness", // Direction of sharpness processing applied by camera
0xA40B : "DeviceSettingDescription", //
0xA40C : "SubjectDistanceRange", // Distance to subject
// other tags
0xA005 : "InteroperabilityIFDPointer",
0xA420 : "ImageUniqueID" // Identifier assigned uniquely to each image
};
var TiffTags = EXIF.TiffTags = {
0x0100 : "ImageWidth",
0x0101 : "ImageHeight",
0x8769 : "ExifIFDPointer",
0x8825 : "GPSInfoIFDPointer",
0xA005 : "InteroperabilityIFDPointer",
0x0102 : "BitsPerSample",
0x0103 : "Compression",
0x0106 : "PhotometricInterpretation",
0x0112 : "Orientation",
0x0115 : "SamplesPerPixel",
0x011C : "PlanarConfiguration",
0x0212 : "YCbCrSubSampling",
0x0213 : "YCbCrPositioning",
0x011A : "XResolution",
0x011B : "YResolution",
0x0128 : "ResolutionUnit",
0x0111 : "StripOffsets",
0x0116 : "RowsPerStrip",
0x0117 : "StripByteCounts",
0x0201 : "JPEGInterchangeFormat",
0x0202 : "JPEGInterchangeFormatLength",
0x012D : "TransferFunction",
0x013E : "WhitePoint",
0x013F : "PrimaryChromaticities",
0x0211 : "YCbCrCoefficients",
0x0214 : "ReferenceBlackWhite",
0x0132 : "DateTime",
0x010E : "ImageDescription",
0x010F : "Make",
0x0110 : "Model",
0x0131 : "Software",
0x013B : "Artist",
0x8298 : "Copyright"
};
var GPSTags = EXIF.GPSTags = {
0x0000 : "GPSVersionID",
0x0001 : "GPSLatitudeRef",
0x0002 : "GPSLatitude",
0x0003 : "GPSLongitudeRef",
0x0004 : "GPSLongitude",
0x0005 : "GPSAltitudeRef",
0x0006 : "GPSAltitude",
0x0007 : "GPSTimeStamp",
0x0008 : "GPSSatellites",
0x0009 : "GPSStatus",
0x000A : "GPSMeasureMode",
0x000B : "GPSDOP",
0x000C : "GPSSpeedRef",
0x000D : "GPSSpeed",
0x000E : "GPSTrackRef",
0x000F : "GPSTrack",
0x0010 : "GPSImgDirectionRef",
0x0011 : "GPSImgDirection",
0x0012 : "GPSMapDatum",
0x0013 : "GPSDestLatitudeRef",
0x0014 : "GPSDestLatitude",
0x0015 : "GPSDestLongitudeRef",
0x0016 : "GPSDestLongitude",
0x0017 : "GPSDestBearingRef",
0x0018 : "GPSDestBearing",
0x0019 : "GPSDestDistanceRef",
0x001A : "GPSDestDistance",
0x001B : "GPSProcessingMethod",
0x001C : "GPSAreaInformation",
0x001D : "GPSDateStamp",
0x001E : "GPSDifferential"
};
var StringValues = EXIF.StringValues = {
ExposureProgram : {
0 : "Not defined",
1 : "Manual",
2 : "Normal program",
3 : "Aperture priority",
4 : "Shutter priority",
5 : "Creative program",
6 : "Action program",
7 : "Portrait mode",
8 : "Landscape mode"
},
MeteringMode : {
0 : "Unknown",
1 : "Average",
2 : "CenterWeightedAverage",
3 : "Spot",
4 : "MultiSpot",
5 : "Pattern",
6 : "Partial",
255 : "Other"
},
LightSource : {
0 : "Unknown",
1 : "Daylight",
2 : "Fluorescent",
3 : "Tungsten (incandescent light)",
4 : "Flash",
9 : "Fine weather",
10 : "Cloudy weather",
11 : "Shade",
12 : "Daylight fluorescent (D 5700 - 7100K)",
13 : "Day white fluorescent (N 4600 - 5400K)",
14 : "Cool white fluorescent (W 3900 - 4500K)",
15 : "White fluorescent (WW 3200 - 3700K)",
17 : "Standard light A",
18 : "Standard light B",
19 : "Standard light C",
20 : "D55",
21 : "D65",
22 : "D75",
23 : "D50",
24 : "ISO studio tungsten",
255 : "Other"
},
Flash : {
0x0000 : "Flash did not fire",
0x0001 : "Flash fired",
0x0005 : "Strobe return light not detected",
0x0007 : "Strobe return light detected",
0x0009 : "Flash fired, compulsory flash mode",
0x000D : "Flash fired, compulsory flash mode, return light not detected",
0x000F : "Flash fired, compulsory flash mode, return light detected",
0x0010 : "Flash did not fire, compulsory flash mode",
0x0018 : "Flash did not fire, auto mode",
0x0019 : "Flash fired, auto mode",
0x001D : "Flash fired, auto mode, return light not detected",
0x001F : "Flash fired, auto mode, return light detected",
0x0020 : "No flash function",
0x0041 : "Flash fired, red-eye reduction mode",
0x0045 : "Flash fired, red-eye reduction mode, return light not detected",
0x0047 : "Flash fired, red-eye reduction mode, return light detected",
0x0049 : "Flash fired, compulsory flash mode, red-eye reduction mode",
0x004D : "Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",
0x004F : "Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",
0x0059 : "Flash fired, auto mode, red-eye reduction mode",
0x005D : "Flash fired, auto mode, return light not detected, red-eye reduction mode",
0x005F : "Flash fired, auto mode, return light detected, red-eye reduction mode"
},
SensingMethod : {
1 : "Not defined",
2 : "One-chip color area sensor",
3 : "Two-chip color area sensor",
4 : "Three-chip color area sensor",
5 : "Color sequential area sensor",
7 : "Trilinear sensor",
8 : "Color sequential linear sensor"
},
SceneCaptureType : {
0 : "Standard",
1 : "Landscape",
2 : "Portrait",
3 : "Night scene"
},
SceneType : {
1 : "Directly photographed"
},
CustomRendered : {
0 : "Normal process",
1 : "Custom process"
},
WhiteBalance : {
0 : "Auto white balance",
1 : "Manual white balance"
},
GainControl : {
0 : "None",
1 : "Low gain up",
2 : "High gain up",
3 : "Low gain down",
4 : "High gain down"
},
Contrast : {
0 : "Normal",
1 : "Soft",
2 : "Hard"
},
Saturation : {
0 : "Normal",
1 : "Low saturation",
2 : "High saturation"
},
Sharpness : {
0 : "Normal",
1 : "Soft",
2 : "Hard"
},
SubjectDistanceRange : {
0 : "Unknown",
1 : "Macro",
2 : "Close view",
3 : "Distant view"
},
FileSource : {
3 : "DSC"
},
Components : {
0 : "",
1 : "Y",
2 : "Cb",
3 : "Cr",
4 : "R",
5 : "G",
6 : "B"
}
};
function addEvent(element, event, handler) {
if (element.addEventListener) {
element.addEventListener(event, handler, false);
} else if (element.attachEvent) {
element.attachEvent("on" + event, handler);
}
}
function imageHasData(img) {
return !!(img.exifdata);
}
function base64ToArrayBuffer(base64, contentType) {
contentType = contentType || base64.match(/^data\:([^\;]+)\;base64,/mi)[1] || ''; // e.g. 'data:image/jpeg;base64,...' => 'image/jpeg'
base64 = base64.replace(/^data\:([^\;]+)\;base64,/gmi, '');
var binary = atob(base64);
var len = binary.length;
var buffer = new ArrayBuffer(len);
var view = new Uint8Array(buffer);
for (var i = 0; i < len; i++) {
view[i] = binary.charCodeAt(i);
}
return buffer;
}
function objectURLToBlob(url, callback) {
var http = new XMLHttpRequest();
http.open("GET", url, true);
http.responseType = "blob";
http.onload = function(e) {
if (this.status == 200 || this.status === 0) {
callback(this.response);
}
};
http.send();
}
function getImageData(img, callback) {
function handleBinaryFile(binFile) {
var data = findEXIFinJPEG(binFile);
var iptcdata = findIPTCinJPEG(binFile);
img.exifdata = data || {};
img.iptcdata = iptcdata || {};
if (callback) {
callback.call(img);
}
}
if (img.src) {
if (/^data\:/i.test(img.src)) { // Data URI
var arrayBuffer = base64ToArrayBuffer(img.src);
handleBinaryFile(arrayBuffer);
} else if (/^blob\:/i.test(img.src)) { // Object URL
var fileReader = new FileReader();
fileReader.onload = function(e) {
handleBinaryFile(e.target.result);
};
objectURLToBlob(img.src, function (blob) {
fileReader.readAsArrayBuffer(blob);
});
} else {
var http = new XMLHttpRequest();
http.onload = function() {
if (this.status == 200 || this.status === 0) {
handleBinaryFile(http.response);
} else {
throw "Could not load image";
}
http = null;
};
http.open("GET", img.src, true);
http.responseType = "arraybuffer";
http.send(null);
}
} else if (window.FileReader && (img instanceof window.Blob || img instanceof window.File)) {
var fileReader = new FileReader();
fileReader.onload = function(e) {
if (debug) console.log("Got file of length " + e.target.result.byteLength);
handleBinaryFile(e.target.result);
};
fileReader.readAsArrayBuffer(img);
}
}
function findEXIFinJPEG(file) {
var dataView = new DataView(file);
if (debug) console.log("Got file of length " + file.byteLength);
if ((dataView.getUint8(0) != 0xFF) || (dataView.getUint8(1) != 0xD8)) {
if (debug) console.log("Not a valid JPEG");
return false; // not a valid jpeg
}
var offset = 2,
length = file.byteLength,
marker;
while (offset < length) {
if (dataView.getUint8(offset) != 0xFF) {
if (debug) console.log("Not a valid marker at offset " + offset + ", found: " + dataView.getUint8(offset));
return false; // not a valid marker, something is wrong
}
marker = dataView.getUint8(offset + 1);
if (debug) console.log(marker);
// we could implement handling for other markers here,
// but we're only looking for 0xFFE1 for EXIF data
if (marker == 225) {
if (debug) console.log("Found 0xFFE1 marker");
return readEXIFData(dataView, offset + 4, dataView.getUint16(offset + 2) - 2);
// offset += 2 + file.getShortAt(offset+2, true);
} else {
offset += 2 + dataView.getUint16(offset+2);
}
}
}
function findIPTCinJPEG(file) {
var dataView = new DataView(file);
if (debug) console.log("Got file of length " + file.byteLength);
if ((dataView.getUint8(0) != 0xFF) || (dataView.getUint8(1) != 0xD8)) {
if (debug) console.log("Not a valid JPEG");
return false; // not a valid jpeg
}
var offset = 2,
length = file.byteLength;
var isFieldSegmentStart = function(dataView, offset){
return (
dataView.getUint8(offset) === 0x38 &&
dataView.getUint8(offset+1) === 0x42 &&
dataView.getUint8(offset+2) === 0x49 &&
dataView.getUint8(offset+3) === 0x4D &&
dataView.getUint8(offset+4) === 0x04 &&
dataView.getUint8(offset+5) === 0x04
);
};
while (offset < length) {
if ( isFieldSegmentStart(dataView, offset )){
// Get the length of the name header (which is padded to an even number of bytes)
var nameHeaderLength = dataView.getUint8(offset+7);
if(nameHeaderLength % 2 !== 0) nameHeaderLength += 1;
// Check for pre photoshop 6 format
if(nameHeaderLength === 0) {
// Always 4
nameHeaderLength = 4;
}
var startOffset = offset + 8 + nameHeaderLength;
var sectionLength = dataView.getUint16(offset + 6 + nameHeaderLength);
return readIPTCData(file, startOffset, sectionLength);
break;
}
// Not the marker, continue searching
offset++;
}
}
var IptcFieldMap = {
0x78 : 'caption',
0x6E : 'credit',
0x19 : 'keywords',
0x37 : 'dateCreated',
0x50 : 'byline',
0x55 : 'bylineTitle',
0x7A : 'captionWriter',
0x69 : 'headline',
0x74 : 'copyright',
0x0F : 'category'
};
function readIPTCData(file, startOffset, sectionLength){
var dataView = new DataView(file);
var data = {};
var fieldValue, fieldName, dataSize, segmentType, segmentSize;
var segmentStartPos = startOffset;
while(segmentStartPos < startOffset+sectionLength) {
if(dataView.getUint8(segmentStartPos) === 0x1C && dataView.getUint8(segmentStartPos+1) === 0x02){
segmentType = dataView.getUint8(segmentStartPos+2);
if(segmentType in IptcFieldMap) {
dataSize = dataView.getInt16(segmentStartPos+3);
segmentSize = dataSize + 5;
fieldName = IptcFieldMap[segmentType];
fieldValue = getStringFromDB(dataView, segmentStartPos+5, dataSize);
// Check if we already stored a value with this name
if(data.hasOwnProperty(fieldName)) {
// Value already stored with this name, create multivalue field
if(data[fieldName] instanceof Array) {
data[fieldName].push(fieldValue);
}
else {
data[fieldName] = [data[fieldName], fieldValue];
}
}
else {
data[fieldName] = fieldValue;
}
}
}
segmentStartPos++;
}
return data;
}
function readTags(file, tiffStart, dirStart, strings, bigEnd) {
var entries = file.getUint16(dirStart, !bigEnd),
tags = {},
entryOffset, tag,
i;
for (i=0;i<entries;i++) {
entryOffset = dirStart + i*12 + 2;
tag = strings[file.getUint16(entryOffset, !bigEnd)];
if (!tag && debug) console.log("Unknown tag: " + file.getUint16(entryOffset, !bigEnd));
tags[tag] = readTagValue(file, entryOffset, tiffStart, dirStart, bigEnd);
}
return tags;
}
function readTagValue(file, entryOffset, tiffStart, dirStart, bigEnd) {
var type = file.getUint16(entryOffset+2, !bigEnd),
numValues = file.getUint32(entryOffset+4, !bigEnd),
valueOffset = file.getUint32(entryOffset+8, !bigEnd) + tiffStart,
offset,
vals, val, n,
numerator, denominator;
switch (type) {
case 1: // byte, 8-bit unsigned int
case 7: // undefined, 8-bit byte, value depending on field
if (numValues == 1) {
return file.getUint8(entryOffset + 8, !bigEnd);
} else {
offset = numValues > 4 ? valueOffset : (entryOffset + 8);
vals = [];
for (n=0;n<numValues;n++) {
vals[n] = file.getUint8(offset + n);
}
return vals;
}
case 2: // ascii, 8-bit byte
offset = numValues > 4 ? valueOffset : (entryOffset + 8);
return getStringFromDB(file, offset, numValues-1);
case 3: // short, 16 bit int
if (numValues == 1) {
return file.getUint16(entryOffset + 8, !bigEnd);
} else {
offset = numValues > 2 ? valueOffset : (entryOffset + 8);
vals = [];
for (n=0;n<numValues;n++) {
vals[n] = file.getUint16(offset + 2*n, !bigEnd);
}
return vals;
}
case 4: // long, 32 bit int
if (numValues == 1) {
return file.getUint32(entryOffset + 8, !bigEnd);
} else {
vals = [];
for (n=0;n<numValues;n++) {
vals[n] = file.getUint32(valueOffset + 4*n, !bigEnd);
}
return vals;
}
case 5: // rational = two long values, first is numerator, second is denominator
if (numValues == 1) {
numerator = file.getUint32(valueOffset, !bigEnd);
denominator = file.getUint32(valueOffset+4, !bigEnd);
val = new Number(numerator / denominator);
val.numerator = numerator;
val.denominator = denominator;
return val;
} else {
vals = [];
for (n=0;n<numValues;n++) {
numerator = file.getUint32(valueOffset + 8*n, !bigEnd);
denominator = file.getUint32(valueOffset+4 + 8*n, !bigEnd);
vals[n] = new Number(numerator / denominator);
vals[n].numerator = numerator;
vals[n].denominator = denominator;
}
return vals;
}
case 9: // slong, 32 bit signed int
if (numValues == 1) {
return file.getInt32(entryOffset + 8, !bigEnd);
} else {
vals = [];
for (n=0;n<numValues;n++) {
vals[n] = file.getInt32(valueOffset + 4*n, !bigEnd);
}
return vals;
}
case 10: // signed rational, two slongs, first is numerator, second is denominator
if (numValues == 1) {
return file.getInt32(valueOffset, !bigEnd) / file.getInt32(valueOffset+4, !bigEnd);
} else {
vals = [];
for (n=0;n<numValues;n++) {
vals[n] = file.getInt32(valueOffset + 8*n, !bigEnd) / file.getInt32(valueOffset+4 + 8*n, !bigEnd);
}
return vals;
}
}
}
function getStringFromDB(buffer, start, length) {
var outstr = "";
for (n = start; n < start+length; n++) {
outstr += String.fromCharCode(buffer.getUint8(n));
}
return outstr;
}
function readEXIFData(file, start) {
if (getStringFromDB(file, start, 4) != "Exif") {
if (debug) console.log("Not valid EXIF data! " + getStringFromDB(file, start, 4));
return false;
}
var bigEnd,
tags, tag,
exifData, gpsData,
tiffOffset = start + 6;
// test for TIFF validity and endianness
if (file.getUint16(tiffOffset) == 0x4949) {
bigEnd = false;
} else if (file.getUint16(tiffOffset) == 0x4D4D) {
bigEnd = true;
} else {
if (debug) console.log("Not valid TIFF data! (no 0x4949 or 0x4D4D)");
return false;
}
if (file.getUint16(tiffOffset+2, !bigEnd) != 0x002A) {
if (debug) console.log("Not valid TIFF data! (no 0x002A)");
return false;
}
var firstIFDOffset = file.getUint32(tiffOffset+4, !bigEnd);
if (firstIFDOffset < 0x00000008) {
if (debug) console.log("Not valid TIFF data! (First offset less than 8)", file.getUint32(tiffOffset+4, !bigEnd));
return false;
}
tags = readTags(file, tiffOffset, tiffOffset + firstIFDOffset, TiffTags, bigEnd);
if (tags.ExifIFDPointer) {
exifData = readTags(file, tiffOffset, tiffOffset + tags.ExifIFDPointer, ExifTags, bigEnd);
for (tag in exifData) {
switch (tag) {
case "LightSource" :
case "Flash" :
case "MeteringMode" :
case "ExposureProgram" :
case "SensingMethod" :
case "SceneCaptureType" :
case "SceneType" :
case "CustomRendered" :
case "WhiteBalance" :
case "GainControl" :
case "Contrast" :
case "Saturation" :
case "Sharpness" :
case "SubjectDistanceRange" :
case "FileSource" :
exifData[tag] = StringValues[tag][exifData[tag]];
break;
case "ExposureTime" :
exifData[tag] = exifData[tag].numerator + "/" + exifData[tag].denominator;
break;
case "ExifVersion" :
case "FlashpixVersion" :
exifData[tag] = String.fromCharCode(exifData[tag][0], exifData[tag][1], exifData[tag][2], exifData[tag][3]);
break;
case "ComponentsConfiguration" :
exifData[tag] =
StringValues.Components[exifData[tag][0]] +
StringValues.Components[exifData[tag][1]] +
StringValues.Components[exifData[tag][2]] +
StringValues.Components[exifData[tag][3]];
break;
}
tags[tag] = exifData[tag];
}
}
if (tags.GPSInfoIFDPointer) {
gpsData = readTags(file, tiffOffset, tiffOffset + tags.GPSInfoIFDPointer, GPSTags, bigEnd);
for (tag in gpsData) {
switch (tag) {
case "GPSVersionID" :
gpsData[tag] = gpsData[tag][0] +
"." + gpsData[tag][1] +
"." + gpsData[tag][2] +
"." + gpsData[tag][3];
break;
}
tags[tag] = gpsData[tag];
}
}
return tags;
}
EXIF.getData = function(img, callback) {
if ((img instanceof Image || img instanceof HTMLImageElement) && !img.complete) return false;
if (!imageHasData(img)) {
getImageData(img, callback);
} else {
if (callback) {
callback.call(img);
}
}
return true;
}
EXIF.getTag = function(img, tag) {
if (!imageHasData(img)) return;
return img.exifdata[tag];
}
EXIF.getIptcTag = function(img, tag) {
if (!imageHasData(img)) return;
return img.iptcdata[tag];
}
EXIF.getAllTags = function(img) {
if (!imageHasData(img)) return {};
var a,
data = img.exifdata,
tags = {};
for (a in data) {
if (data.hasOwnProperty(a)) {
tags[a] = data[a];
}
}
return tags;
}
EXIF.getAllIptcTags = function(img) {
if (!imageHasData(img)) return {};
var a,
data = img.iptcdata,
tags = {};
for (a in data) {
if (data.hasOwnProperty(a)) {
tags[a] = data[a];
}
}
return tags;
}
EXIF.pretty = function(img) {
if (!imageHasData(img)) return "";
var a,
data = img.exifdata,
strPretty = "";
for (a in data) {
if (data.hasOwnProperty(a)) {
if (typeof data[a] == "object") {
if (data[a] instanceof Number) {
strPretty += a + " : " + data[a] + " [" + data[a].numerator + "/" + data[a].denominator + "]\r\n";
} else {
strPretty += a + " : [" + data[a].length + " values]\r\n";
}
} else {
strPretty += a + " : " + data[a] + "\r\n";
}
}
}
return strPretty;
}
EXIF.readFromBinaryFile = function(file) {
return findEXIFinJPEG(file);
}
if (typeof define === 'function' && define.amd) {
define('exif-js', [], function() {
return EXIF;
});
}
}.call(this));

1
assets/js/exif.min.js vendored Normal file

File diff suppressed because one or more lines are too long

2
assets/js/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

882
assets/js/jquery.poptrox.js Normal file
View File

@@ -0,0 +1,882 @@
/* jquery.poptrox.js v2.5.2-dev | (c) @ajlkn | github.com/ajlkn/jquery.poptrox | MIT licensed */
(function($) {
// Disables selection
$.fn.poptrox_disableSelection = function() { return $(this).css('user-select', 'none').css('-khtml-user-select', 'none').css('-moz-user-select', 'none').css('-o-user-select', 'none').css('-webkit-user-select', 'none'); }
// Poptrox prototype method
$.fn.poptrox = function(options) {
// Handle no elements.
if (this.length == 0)
return $(this);
// Handle multiple elements.
if (this.length > 1) {
for (var i=0; i < this.length; i++)
$(this[i]).poptrox(options);
return $(this);
}
// Settings
var settings = $.extend({
preload: false, // If true, preload fullsize images in the background
baseZIndex: 1000, // Base Z-Index
fadeSpeed: 300, // Global fade speed
overlayColor: '#000000', // Overlay color
overlayOpacity: 0.6, // Overlay opacity
overlayClass: 'poptrox-overlay', // Overlay class
windowMargin: 50, // Window margin size (in pixels; only comes into play when an image is larger than the viewport)
windowHeightPad: 0, // Window height pad
selector: 'a', // Anchor tag selector
caption: null, // Caption settings (see docs)
parent: 'body', // Parent selector (ie. where all the popup/overlay stuff gets added).
popupSpeed: 300, // Popup (resize) speed
popupWidth: 200, // Popup width
popupHeight: 100, // Popup height
popupIsFixed: false, // If true, popup won't resize to fit images
useBodyOverflow: false, // If true, the BODY tag is set to overflow: hidden when the popup is visible
usePopupEasyClose: true, // If true, popup can be closed by clicking on it anywhere
usePopupForceClose: false, // If true, popup can be closed even while content is loading
usePopupLoader: true, // If true, show the popup loader
usePopupCloser: true, // If true, show the popup closer button/link
usePopupCaption: false, // If true, show the popup image caption
usePopupNav: false, // If true, show (and use) popup navigation
usePopupDefaultStyling: true, // If true, default popup styling will be applied (background color, text color, etc)
popupBackgroundColor: '#FFFFFF', // (Default Style) Popup background color (when usePopupStyling = true)
popupTextColor: '#000000', // (Default Style) Popup text color (when usePopupStyling = true)
popupLoaderTextSize: '2em', // (Default Style) Popup loader text size
popupCloserBackgroundColor: '#000000', // (Default Style) Popup closer background color (when usePopupStyling = true)
popupCloserTextColor: '#FFFFFF', // (Default Style) Popup closer text color (when usePopupStyling = true)
popupCloserTextSize: '20px', // (Default Style) Popup closer text size
popupPadding: 10, // (Default Style) Popup padding (when usePopupStyling = true)
popupCaptionHeight: 60, // (Default Style) Popup height of caption area
popupCaptionTextSize: null, // (Default Style) Popup caption text size
popupBlankCaptionText: '(untitled)', // Applied to images that don't have captions (when captions are enabled)
popupCloserText: '&#215;', // Popup closer text
popupLoaderText: '&bull;&bull;&bull;&bull;', // Popup loader text
popupClass: 'poptrox-popup', // Popup class
popupSelector: null, // (Advanced) Popup selector (use this if you want to replace the built-in popup)
popupLoaderSelector: '.loader', // (Advanced) Popup Loader selector
popupCloserSelector: '.closer', // (Advanced) Popup Closer selector
popupCaptionSelector: '.caption', // (Advanced) Popup Caption selector
popupNavPreviousSelector: '.nav-previous', // (Advanced) Popup Nav Previous selector
popupNavNextSelector: '.nav-next', // (Advanced) Popup Nav Next selector
onPopupClose: null, // Called when popup closes
onPopupOpen: null // Called when popup opens
}, options);
// Variables
var $this = $(this),
$body = $('body'),
$overlay = $('<div class="' + settings.overlayClass + '"></div>'),
$window = $(window);
var windowWidth,
windowHeight,
queue = [],
navPos = 0,
isLocked = false,
cache = new Array();
var updateWH = function() {
windowWidth = $window.width();
windowHeight = $window.height() + settings.windowHeightPad;
var dw = Math.abs($popup.width() - $popup.outerWidth()), dh = Math.abs($popup.height() - $popup.outerHeight());
var maxw = windowWidth - (settings.windowMargin * 2) - dw, maxh = windowHeight - (settings.windowMargin * 2) - dh;
$popup
.css('min-width', settings.popupWidth)
.css('min-height', settings.popupHeight);
$pic.children()
.css('max-width', maxw)
.css('max-height', maxh);
};
// Disable unused features
if (!settings.usePopupLoader)
settings.popupLoaderSelector = null;
if (!settings.usePopupCloser)
settings.popupCloserSelector = null;
if (!settings.usePopupCaption)
settings.popupCaptionSelector = null;
if (!settings.usePopupNav) {
settings.popupNavPreviousSelector = null;
settings.popupNavNextSelector = null;
}
// Get popup
var $popup;
if (settings.popupSelector)
$popup = $(settings.popupSelector);
else
$popup = $('<div class="' + settings.popupClass + '">' + (settings.popupLoaderSelector ? '<div class="loader">' + settings.popupLoaderText + '</div>' : '') + '<div class="pic"></div>' + (settings.popupCaptionSelector ? '<div class="caption"></div>' : '') + (settings.popupCloserSelector ? '<span class="closer">' + settings.popupCloserText + '</span>' : '') + (settings.popupNavPreviousSelector ? '<div class="nav-previous"></div>' : '') + (settings.popupNavNextSelector ? '<div class="nav-next"></div>' : '') + '</div>');
// Get popup components
var $pic = $popup.find('.pic'),
$x = $(),
$loader = $popup.find(settings.popupLoaderSelector),
$caption = $popup.find(settings.popupCaptionSelector),
$closer = $popup.find(settings.popupCloserSelector),
$nav_next = $popup.find(settings.popupNavNextSelector),
$nav_previous = $popup.find(settings.popupNavPreviousSelector),
$nav = $nav_next.add($nav_previous);
// Apply default styling?
if (settings.usePopupDefaultStyling) {
$popup
.css('background', settings.popupBackgroundColor)
.css('color', settings.popupTextColor)
.css('padding', settings.popupPadding + 'px');
if ($caption.length > 0) {
$popup
.css('padding-bottom', settings.popupCaptionHeight + 'px');
$caption
.css('position', 'absolute')
.css('left', '0')
.css('bottom', '0')
.css('width', '100%')
.css('text-align', 'center')
.css('height', settings.popupCaptionHeight + 'px')
.css('line-height', settings.popupCaptionHeight + 'px');
if (settings.popupCaptionTextSize)
$caption.css('font-size', popupCaptionTextSize);
}
if ($closer.length > 0)
$closer
.html(settings.popupCloserText)
.css('font-size', settings.popupCloserTextSize)
.css('background', settings.popupCloserBackgroundColor)
.css('color', settings.popupCloserTextColor)
.css('display', 'block')
.css('width', '40px')
.css('height', '40px')
.css('line-height', '40px')
.css('text-align', 'center')
.css('position', 'absolute')
.css('text-decoration', 'none')
.css('outline', '0')
.css('top', '0')
.css('right', '-40px');
if ($loader.length > 0) {
$loader
.html('')
.css('position', 'relative')
.css('font-size', settings.popupLoaderTextSize)
.on('startSpinning', function(e) {
var x = $('<div>' + settings.popupLoaderText + '</div>');
x
.css('height', Math.floor(settings.popupHeight / 2) + 'px')
.css('overflow', 'hidden')
.css('line-height', Math.floor(settings.popupHeight / 2) + 'px')
.css('text-align', 'center')
.css('margin-top', Math.floor(($popup.height() - x.height() + ($caption.length > 0 ? $caption.height() : 0)) / 2))
.css('color', (settings.popupTextColor ? settings.popupTextColor : ''))
.on('xfin', function() { x.fadeTo(300, 0.5, function() { x.trigger('xfout'); }); })
.on('xfout', function() { x.fadeTo(300, 0.05, function() { x.trigger('xfin'); }); })
.trigger('xfin');
$loader.append(x);
})
.on('stopSpinning', function(e) {
var x = $loader.find('div');
x.remove();
});
}
if ($nav.length == 2) {
$nav
.css('font-size', '75px')
.css('text-align', 'center')
.css('color', '#fff')
.css('text-shadow', 'none')
.css('height', '100%')
.css('position', 'absolute')
.css('top', '0')
.css('opacity', '0.35')
.css('cursor', 'pointer')
.css('box-shadow', 'inset 0px 0px 10px 0px rgba(0,0,0,0)')
.poptrox_disableSelection();
var wn, wp;
if (settings.usePopupEasyClose) {
wn = '100px';
wp = '100px';
}
else {
wn = '75%';
wp = '25%';
}
$nav_next
.css('right', '0')
.css('width', wn)
.html('<div style="position: absolute; height: 100px; width: 125px; top: 50%; right: 0; margin-top: -50px;">&gt;</div>');
$nav_previous
.css('left', '0')
.css('width', wp)
.html('<div style="position: absolute; height: 100px; width: 125px; top: 50%; left: 0; margin-top: -50px;">&lt;</div>');
}
}
// Main
$window
.on('resize orientationchange', function() {
updateWH();
});
$caption
.on('update', function(e, s) {
if (!s || s.length == 0)
s = settings.popupBlankCaptionText;
$caption.html(s);
});
$closer
.css('cursor', 'pointer')
.on('click', function(e) {
e.preventDefault();
e.stopPropagation();
$popup.trigger('poptrox_close');
return true;
});
$nav_next
.on('click', function(e) {
e.stopPropagation();
e.preventDefault();
$popup.trigger('poptrox_next');
});
$nav_previous
.on('click', function(e) {
e.stopPropagation();
e.preventDefault();
$popup.trigger('poptrox_previous');
});
$overlay
.css('position', 'fixed')
.css('left', 0)
.css('top', 0)
.css('z-index', settings.baseZIndex)
.css('width', '100%')
.css('height', '100%')
.css('text-align', 'center')
.css('cursor', 'pointer')
.appendTo(settings.parent)
.prepend('<div style="display:inline-block;height:100%;vertical-align:middle;"></div>')
.append('<div style="position:absolute;left:0;top:0;width:100%;height:100%;background:' + settings.overlayColor + ';opacity:' + settings.overlayOpacity + ';filter:alpha(opacity=' + (settings.overlayOpacity * 100) + ');"></div>')
.hide()
.on('touchmove', function(e) {
return false;
})
.on('click', function(e) {
e.preventDefault();
e.stopPropagation();
$popup.trigger('poptrox_close');
});
$popup
.css('display', 'inline-block')
.css('vertical-align', 'middle')
.css('position', 'relative')
.css('z-index', 1)
.css('cursor', 'auto')
.appendTo($overlay)
.hide()
.on('poptrox_next', function() {
var x = navPos + 1;
if (x >= queue.length)
x = 0;
$popup.trigger('poptrox_switch', [x]);
})
.on('poptrox_previous', function() {
var x = navPos - 1;
if (x < 0)
x = queue.length - 1;
$popup.trigger('poptrox_switch', [x]);
})
.on('poptrox_reset', function() {
updateWH();
$popup
.data('width', settings.popupWidth)
.data('height', settings.popupHeight);
$loader.hide().trigger('stopSpinning');
$caption.hide();
$closer.hide();
$nav.hide();
$pic.hide();
$x
.attr('src', '')
.detach();
})
.on('poptrox_open', function(e, index) {
if (isLocked)
return true;
isLocked = true;
if (settings.useBodyOverflow)
$body.css('overflow', 'hidden');
if (settings.onPopupOpen)
(settings.onPopupOpen)();
$popup
.addClass('loading');
$overlay
.fadeTo(settings.fadeSpeed, 1.0, function() {
$popup.trigger('poptrox_switch', [index, true]);
});
})
.on('poptrox_switch', function(e, index, ignoreLock) {
var x, img;
if (!ignoreLock && isLocked)
return true;
isLocked = true;
$popup
.addClass('loading')
.css('width', $popup.data('width'))
.css('height', $popup.data('height'));
// Cleanup from previous
$caption.hide();
if ($x.attr('src'))
$x.attr('src', '');
$x.detach();
// Activate new object
x = queue[index];
$x = x.object;
$x.off('load');
$pic
.css('text-indent', '-9999px')
.show()
.append($x);
if (x.type == 'ajax')
$.get(x.src, function(data) {
$x.html(data);
$x.trigger('load');
});
else
$x.attr('src', x.src);
if (x.type != 'image') {
var xwidth, xheight;
xwidth = x.width;
xheight = x.height;
if (xwidth.slice(-1) == '%')
xwidth = (parseInt(xwidth.substring(0, xwidth.length - 1)) / 100.00) * $window.width();
if (xheight.slice(-1) == '%')
xheight = (parseInt(xheight.substring(0, xheight.length - 1)) / 100.00) * $window.height();
$x
.css('position', 'relative')
.css('outline', '0')
.css('z-index', settings.baseZIndex + 100)
.width(xwidth)
.height(xheight);
}
// Initialize
$loader.trigger('startSpinning').fadeIn(300);
$popup.show();
if (settings.popupIsFixed) {
$popup
.removeClass('loading')
.width(settings.popupWidth)
.height(settings.popupHeight);
$x.on('load', function() {
$x.off('load');
$loader.hide().trigger('stopSpinning');
$caption.trigger('update', [x.captionText]).fadeIn(settings.fadeSpeed);
$closer.fadeIn(settings.fadeSpeed);
$pic.css('text-indent', 0).hide().fadeIn(settings.fadeSpeed, function() { isLocked = false; });
navPos = index;
$nav.fadeIn(settings.fadeSpeed);
});
}
else {
$x.on('load', function() {
updateWH();
$x.off('load');
$loader.hide().trigger('stopSpinning');
var nw = $x.width(),
nh = $x.height(),
f = function() {
$caption.trigger('update', [x.captionText]).fadeIn(settings.fadeSpeed);
$closer.fadeIn(settings.fadeSpeed);
$pic.css('text-indent', 0).hide().fadeIn(settings.fadeSpeed, function() { isLocked = false; });
navPos = index;
$nav.fadeIn(settings.fadeSpeed);
$popup
.removeClass('loading')
.data('width', nw)
.data('height', nh)
.css('width', 'auto')
.css('height', 'auto');
};
if (nw == $popup.data('width')
&& nh == $popup.data('height'))
(f)();
else
$popup.animate({ width: nw, height: nh }, settings.popupSpeed, 'swing', f);
});
}
if (x.type != 'image')
$x.trigger('load');
})
.on('poptrox_close', function() {
if (isLocked
&& !settings.usePopupForceClose)
return true;
isLocked = true;
$popup
.hide()
.trigger('poptrox_reset');
if (settings.onPopupClose)
(settings.onPopupClose)();
$overlay
.fadeOut(settings.fadeSpeed, function() {
if (settings.useBodyOverflow)
$body.css('overflow', 'auto');
isLocked = false;
});
})
.trigger('poptrox_reset');
// Easy close.
if (settings.usePopupEasyClose) {
$caption.on('click', 'a', function(e) {
e.stopPropagation();
});
$popup
.css('cursor', 'pointer')
.on('click', function(e) {
e.stopPropagation();
e.preventDefault();
$popup.trigger('poptrox_close');
});
}
else
$popup
.on('click', function(e) {
e.stopPropagation();
});
$window
.keydown(function(e) {
if ($popup.is(':visible')) {
switch (e.keyCode) {
case 37:
case 32:
if (settings.usePopupNav) {
$popup.trigger('poptrox_previous');
return false;
}
break;
case 39:
if (settings.usePopupNav) {
$popup.trigger('poptrox_next');
return false;
}
break;
case 27:
$popup.trigger('poptrox_close');
return false;
break;
}
}
});
$this.find(settings.selector).each(function(index) {
var x, tmp, a = $(this), i = a.find('img'), data = a.data('poptrox');
// Ignore? Skip.
if (data == 'ignore')
return;
// No href? Bail.
if (!a.attr('href'))
return;
x = {
src: a.attr('href'),
captionText: i.attr('title'),
width: null,
height: null,
type: null,
object: null,
options: null
};
// Determine caption.
// No caption setting? Use default (title attribute of image).
if (!settings.caption)
c = i.attr('title');
// Function?
else if (typeof(settings.caption) == 'function')
c = (settings.caption)(a);
// Selector?
else if ('selector' in settings.caption) {
var s;
s = a.find(settings.caption.selector);
if ('attribute' in settings.caption)
c = s.attr(settings.caption.attribute);
else {
c = s.html();
if (settings.caption.remove === true)
s.remove();
}
}
x.captionText = c;
// If a data attribute exists, use it
if (data) {
var b = data.split(',');
// Type.
if (0 in b)
x.type = b[0];
// Size.
if (1 in b) {
tmp = b[1].match(/([0-9%]+)x([0-9%]+)/);
if (tmp && tmp.length == 3) {
x.width = tmp[1];
x.height = tmp[2];
}
}
// Options.
if (2 in b)
x.options = b[2];
}
// No type? Attempt to guess it based on the href's domain
if (!x.type) {
tmp = x.src.match(/\/\/([a-z0-9\.]+)\/.*/);
if (!tmp || tmp.length < 2)
tmp = [false];
switch (tmp[1]) {
case 'api.soundcloud.com':
x.type = 'soundcloud';
break;
case 'youtu.be':
x.type = 'youtube';
break;
case 'vimeo.com':
x.type = 'vimeo';
break;
case 'wistia.net':
x.type = 'wistia';
break;
case 'bcove.me':
x.type = 'bcove';
break;
default:
x.type = 'image';
break;
}
}
// Create object (based on type)
tmp = x.src.match(/\/\/[a-z0-9\.]+\/(.*)/);
switch (x.type) {
case 'iframe':
x.object = $('<iframe src="" frameborder="0"></iframe>');
x.object
.on('click', function(e) { e.stopPropagation(); })
.css('cursor', 'auto');
if (!x.width || !x.height) {
x.width = "600";
x.height = "400";
}
break;
case 'ajax':
x.object = $('<div class="poptrox-ajax"></div>');
x.object
.on('click', function(e) { e.stopPropagation(); })
.css('cursor', 'auto')
.css('overflow', 'auto');
if (!x.width || !x.height) {
x.width = "600";
x.height = "400";
}
break;
case 'soundcloud':
x.object = $('<iframe scrolling="no" frameborder="no" src=""></iframe>');
x.src = '//w.soundcloud.com/player/?url=' + escape(x.src) + (x.options ? '&' + x.options : '');
x.width = '600';
x.height = "166";
break;
case 'youtube':
x.object = $('<iframe src="" frameborder="0" allowfullscreen="1"></iframe>');
x.src = '//www.youtube.com/embed/' + tmp[1] + (x.options ? '?' + x.options : '');
if (!x.width || !x.height) {
x.width = "800";
x.height = "480";
}
break;
case 'vimeo':
x.object = $('<iframe src="" frameborder="0" allowFullScreen="1"></iframe>');
x.src = '//player.vimeo.com/video/' + tmp[1] + (x.options ? '?' + x.options : '');
if (!x.width || !x.height) {
x.width = "800";
x.height = "480";
}
break;
case 'wistia':
x.object = $('<iframe src="" frameborder="0" allowFullScreen="1"></iframe>');
x.src = '//fast.wistia.net/' + tmp[1] + (x.options ? '?' + x.options : '');
if (!x.width || !x.height) {
x.width = "800";
x.height = "480";
}
break;
case 'bcove':
x.object = $('<iframe src="" frameborder="0" allowFullScreen="1" width="100%"></iframe>');
x.src = '//bcove.me/' + tmp[1] + (x.options ? '?' + x.options : '');
if (!x.width || !x.height) {
x.width = "640";
x.height = "360";
}
break;
default:
x.object = $('<img src="" alt="" style="vertical-align:bottom" />');
if (settings.preload) {
var tmp = document.createElement('img');
tmp.src = x.src; cache.push(tmp);
}
x.width = a.attr('width');
x.height = a.attr('height');
break;
}
// Fix src if protocol is 'file'.
if (window.location.protocol == 'file:'
&& x.src.match(/^\/\//))
x.src = 'http:' + x.src;
queue.push(x);
i.removeAttr('title');
a
.removeAttr('href')
.css('cursor', 'pointer')
.css('outline', 0)
.on('click', function(e) {
e.preventDefault();
e.stopPropagation();
$popup.trigger('poptrox_open', [index]);
});
});
// Expose settings.
$this.prop('_poptrox', settings);
return $this;
};
})(jQuery);

1
assets/js/jquery.poptrox.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,903 @@
/*
jquery.poptrox.js v2.5.2-dev | (c) @ajlkn | github.com/ajlkn/jquery.poptrox | MIT licensed
Modified to add lazy loading for caption. See comments for 'Lazy load captions'.
*/
(function($) {
// Disables selection
$.fn.poptrox_disableSelection = function() { return $(this).css('user-select', 'none').css('-khtml-user-select', 'none').css('-moz-user-select', 'none').css('-o-user-select', 'none').css('-webkit-user-select', 'none'); }
// Poptrox prototype method
$.fn.poptrox = function(options) {
// Handle no elements.
if (this.length == 0)
return $(this);
// Handle multiple elements.
if (this.length > 1) {
for (var i=0; i < this.length; i++)
$(this[i]).poptrox(options);
return $(this);
}
// Settings
var settings = $.extend({
preload: false, // If true, preload fullsize images in the background
baseZIndex: 1000, // Base Z-Index
fadeSpeed: 300, // Global fade speed
overlayColor: '#000000', // Overlay color
overlayOpacity: 0.6, // Overlay opacity
overlayClass: 'poptrox-overlay', // Overlay class
windowMargin: 50, // Window margin size (in pixels; only comes into play when an image is larger than the viewport)
windowHeightPad: 0, // Window height pad
selector: 'a', // Anchor tag selector
caption: null, // Caption settings (see docs)
parent: 'body', // Parent selector (ie. where all the popup/overlay stuff gets added).
popupSpeed: 300, // Popup (resize) speed
popupWidth: 200, // Popup width
popupHeight: 100, // Popup height
popupIsFixed: false, // If true, popup won't resize to fit images
useBodyOverflow: false, // If true, the BODY tag is set to overflow: hidden when the popup is visible
usePopupEasyClose: true, // If true, popup can be closed by clicking on it anywhere
usePopupForceClose: false, // If true, popup can be closed even while content is loading
usePopupLoader: true, // If true, show the popup loader
usePopupCloser: true, // If true, show the popup closer button/link
usePopupCaption: false, // If true, show the popup image caption
usePopupNav: false, // If true, show (and use) popup navigation
usePopupDefaultStyling: true, // If true, default popup styling will be applied (background color, text color, etc)
popupBackgroundColor: '#FFFFFF', // (Default Style) Popup background color (when usePopupStyling = true)
popupTextColor: '#000000', // (Default Style) Popup text color (when usePopupStyling = true)
popupLoaderTextSize: '2em', // (Default Style) Popup loader text size
popupCloserBackgroundColor: '#000000', // (Default Style) Popup closer background color (when usePopupStyling = true)
popupCloserTextColor: '#FFFFFF', // (Default Style) Popup closer text color (when usePopupStyling = true)
popupCloserTextSize: '20px', // (Default Style) Popup closer text size
popupPadding: 10, // (Default Style) Popup padding (when usePopupStyling = true)
popupCaptionHeight: 60, // (Default Style) Popup height of caption area
popupCaptionTextSize: null, // (Default Style) Popup caption text size
popupBlankCaptionText: '(untitled)', // Applied to images that don't have captions (when captions are enabled)
popupCloserText: '&#215;', // Popup closer text
popupLoaderText: '&bull;&bull;&bull;&bull;', // Popup loader text
popupClass: 'poptrox-popup', // Popup class
popupSelector: null, // (Advanced) Popup selector (use this if you want to replace the built-in popup)
popupLoaderSelector: '.loader', // (Advanced) Popup Loader selector
popupCloserSelector: '.closer', // (Advanced) Popup Closer selector
popupCaptionSelector: '.caption', // (Advanced) Popup Caption selector
popupNavPreviousSelector: '.nav-previous', // (Advanced) Popup Nav Previous selector
popupNavNextSelector: '.nav-next', // (Advanced) Popup Nav Next selector
onPopupClose: null, // Called when popup closes
onPopupOpen: null // Called when popup opens
}, options);
// Variables
var $this = $(this),
$body = $('body'),
$overlay = $('<div class="' + settings.overlayClass + '"></div>'),
$window = $(window);
var windowWidth,
windowHeight,
queue = [],
navPos = 0,
isLocked = false,
cache = new Array();
var updateWH = function() {
windowWidth = $window.width();
windowHeight = $window.height() + settings.windowHeightPad;
var dw = Math.abs($popup.width() - $popup.outerWidth()), dh = Math.abs($popup.height() - $popup.outerHeight());
var maxw = windowWidth - (settings.windowMargin * 2) - dw, maxh = windowHeight - (settings.windowMargin * 2) - dh;
$popup
.css('min-width', settings.popupWidth)
.css('min-height', settings.popupHeight);
$pic.children()
.css('max-width', maxw)
.css('max-height', maxh);
};
// Disable unused features
if (!settings.usePopupLoader)
settings.popupLoaderSelector = null;
if (!settings.usePopupCloser)
settings.popupCloserSelector = null;
if (!settings.usePopupCaption)
settings.popupCaptionSelector = null;
if (!settings.usePopupNav) {
settings.popupNavPreviousSelector = null;
settings.popupNavNextSelector = null;
}
// Get popup
var $popup;
if (settings.popupSelector)
$popup = $(settings.popupSelector);
else
$popup = $('<div class="' + settings.popupClass + '">' + (settings.popupLoaderSelector ? '<div class="loader">' + settings.popupLoaderText + '</div>' : '') + '<div class="pic"></div>' + (settings.popupCaptionSelector ? '<div class="caption"></div>' : '') + (settings.popupCloserSelector ? '<span class="closer">' + settings.popupCloserText + '</span>' : '') + (settings.popupNavPreviousSelector ? '<div class="nav-previous"></div>' : '') + (settings.popupNavNextSelector ? '<div class="nav-next"></div>' : '') + '</div>');
// Get popup components
var $pic = $popup.find('.pic'),
$x = $(),
$loader = $popup.find(settings.popupLoaderSelector),
$caption = $popup.find(settings.popupCaptionSelector),
$closer = $popup.find(settings.popupCloserSelector),
$nav_next = $popup.find(settings.popupNavNextSelector),
$nav_previous = $popup.find(settings.popupNavPreviousSelector),
$nav = $nav_next.add($nav_previous);
// Apply default styling?
if (settings.usePopupDefaultStyling) {
$popup
.css('background', settings.popupBackgroundColor)
.css('color', settings.popupTextColor)
.css('padding', settings.popupPadding + 'px');
if ($caption.length > 0) {
$popup
.css('padding-bottom', settings.popupCaptionHeight + 'px');
$caption
.css('position', 'absolute')
.css('left', '0')
.css('bottom', '0')
.css('width', '100%')
.css('text-align', 'center')
.css('height', settings.popupCaptionHeight + 'px')
.css('line-height', settings.popupCaptionHeight + 'px');
if (settings.popupCaptionTextSize)
$caption.css('font-size', popupCaptionTextSize);
}
if ($closer.length > 0)
$closer
.html(settings.popupCloserText)
.css('font-size', settings.popupCloserTextSize)
.css('background', settings.popupCloserBackgroundColor)
.css('color', settings.popupCloserTextColor)
.css('display', 'block')
.css('width', '40px')
.css('height', '40px')
.css('line-height', '40px')
.css('text-align', 'center')
.css('position', 'absolute')
.css('text-decoration', 'none')
.css('outline', '0')
.css('top', '0')
.css('right', '-40px');
if ($loader.length > 0) {
$loader
.html('')
.css('position', 'relative')
.css('font-size', settings.popupLoaderTextSize)
.on('startSpinning', function(e) {
var x = $('<div>' + settings.popupLoaderText + '</div>');
x
.css('height', Math.floor(settings.popupHeight / 2) + 'px')
.css('overflow', 'hidden')
.css('line-height', Math.floor(settings.popupHeight / 2) + 'px')
.css('text-align', 'center')
.css('margin-top', Math.floor(($popup.height() - x.height() + ($caption.length > 0 ? $caption.height() : 0)) / 2))
.css('color', (settings.popupTextColor ? settings.popupTextColor : ''))
.on('xfin', function() { x.fadeTo(300, 0.5, function() { x.trigger('xfout'); }); })
.on('xfout', function() { x.fadeTo(300, 0.05, function() { x.trigger('xfin'); }); })
.trigger('xfin');
$loader.append(x);
})
.on('stopSpinning', function(e) {
var x = $loader.find('div');
x.remove();
});
}
if ($nav.length == 2) {
$nav
.css('font-size', '75px')
.css('text-align', 'center')
.css('color', '#fff')
.css('text-shadow', 'none')
.css('height', '100%')
.css('position', 'absolute')
.css('top', '0')
.css('opacity', '0.35')
.css('cursor', 'pointer')
.css('box-shadow', 'inset 0px 0px 10px 0px rgba(0,0,0,0)')
.poptrox_disableSelection();
var wn, wp;
if (settings.usePopupEasyClose) {
wn = '100px';
wp = '100px';
}
else {
wn = '75%';
wp = '25%';
}
$nav_next
.css('right', '0')
.css('width', wn)
.html('<div style="position: absolute; height: 100px; width: 125px; top: 50%; right: 0; margin-top: -50px;">&gt;</div>');
$nav_previous
.css('left', '0')
.css('width', wp)
.html('<div style="position: absolute; height: 100px; width: 125px; top: 50%; left: 0; margin-top: -50px;">&lt;</div>');
}
}
// Main
$window
.on('resize orientationchange', function() {
updateWH();
});
$caption
.on('update', function(e, s) {
if (!s || s.length == 0)
s = settings.popupBlankCaptionText;
$caption.html(s);
});
$closer
.css('cursor', 'pointer')
.on('click', function(e) {
e.preventDefault();
e.stopPropagation();
$popup.trigger('poptrox_close');
return true;
});
$nav_next
.on('click', function(e) {
e.stopPropagation();
e.preventDefault();
$popup.trigger('poptrox_next');
});
$nav_previous
.on('click', function(e) {
e.stopPropagation();
e.preventDefault();
$popup.trigger('poptrox_previous');
});
$overlay
.css('position', 'fixed')
.css('left', 0)
.css('top', 0)
.css('z-index', settings.baseZIndex)
.css('width', '100%')
.css('height', '100%')
.css('text-align', 'center')
.css('cursor', 'pointer')
.appendTo(settings.parent)
.prepend('<div style="display:inline-block;height:100%;vertical-align:middle;"></div>')
.append('<div style="position:absolute;left:0;top:0;width:100%;height:100%;background:' + settings.overlayColor + ';opacity:' + settings.overlayOpacity + ';filter:alpha(opacity=' + (settings.overlayOpacity * 100) + ');"></div>')
.hide()
.on('touchmove', function(e) {
return false;
})
.on('click', function(e) {
e.preventDefault();
e.stopPropagation();
$popup.trigger('poptrox_close');
});
$popup
.css('display', 'inline-block')
.css('vertical-align', 'middle')
.css('position', 'relative')
.css('z-index', 1)
.css('cursor', 'auto')
.appendTo($overlay)
.hide()
.on('poptrox_next', function() {
var x = navPos + 1;
if (x >= queue.length)
x = 0;
$popup.trigger('poptrox_switch', [x]);
})
.on('poptrox_previous', function() {
var x = navPos - 1;
if (x < 0)
x = queue.length - 1;
$popup.trigger('poptrox_switch', [x]);
})
.on('poptrox_reset', function() {
updateWH();
$popup
.data('width', settings.popupWidth)
.data('height', settings.popupHeight);
$loader.hide().trigger('stopSpinning');
$caption.hide();
$closer.hide();
$nav.hide();
$pic.hide();
$x
.attr('src', '')
.detach();
})
.on('poptrox_open', function(e, index) {
if (isLocked)
return true;
isLocked = true;
if (settings.useBodyOverflow)
$body.css('overflow', 'hidden');
if (settings.onPopupOpen)
(settings.onPopupOpen)();
$popup
.addClass('loading');
$overlay
.fadeTo(settings.fadeSpeed, 1.0, function() {
$popup.trigger('poptrox_switch', [index, true]);
});
})
.on('poptrox_switch', function(e, index, ignoreLock) {
var x, img;
// Lazy load captions
var lazyCaption;
if (!ignoreLock && isLocked)
return true;
isLocked = true;
$popup
.addClass('loading')
.css('width', $popup.data('width'))
.css('height', $popup.data('height'));
// Cleanup from previous
$caption.hide();
if ($x.attr('src'))
$x.attr('src', '');
$x.detach();
// Activate new object
x = queue[index];
$x = x.object;
$x.off('load');
$pic
.css('text-indent', '-9999px')
.show()
.append($x);
if (x.type == 'ajax')
$.get(x.src, function(data) {
$x.html(data);
$x.trigger('load');
});
else
$x.attr('src', x.src);
if (x.type != 'image') {
var xwidth, xheight;
xwidth = x.width;
xheight = x.height;
if (xwidth.slice(-1) == '%')
xwidth = (parseInt(xwidth.substring(0, xwidth.length - 1)) / 100.00) * $window.width();
if (xheight.slice(-1) == '%')
xheight = (parseInt(xheight.substring(0, xheight.length - 1)) / 100.00) * $window.height();
$x
.css('position', 'relative')
.css('outline', '0')
.css('z-index', settings.baseZIndex + 100)
.width(xwidth)
.height(xheight);
}
// Initialize
$loader.trigger('startSpinning').fadeIn(300);
$popup.show();
if (settings.popupIsFixed) {
$popup
.removeClass('loading')
.width(settings.popupWidth)
.height(settings.popupHeight);
$x.on('load', function() {
$x.off('load');
$loader.hide().trigger('stopSpinning');
// Lazy load captions
if (typeof settings.caption == "function") {
lazyCaption = settings.caption(x.a);
} else {
lazyCaption = x.captionText;
}
$caption.trigger("update", [lazyCaption]).fadeIn(settings.fadeSpeed);
$closer.fadeIn(settings.fadeSpeed);
$pic.css('text-indent', 0).hide().fadeIn(settings.fadeSpeed, function() { isLocked = false; });
navPos = index;
$nav.fadeIn(settings.fadeSpeed);
});
}
else {
$x.on('load', function() {
updateWH();
$x.off('load');
$loader.hide().trigger('stopSpinning');
var nw = $x.width(),
nh = $x.height(),
f = function() {
// Lazy load captions
if (typeof settings.caption == "function") {
lazyCaption = settings.caption(x.a);
} else {
lazyCaption = x.captionText;
}
$caption.trigger("update", [lazyCaption]).fadeIn(settings.fadeSpeed);
$closer.fadeIn(settings.fadeSpeed);
$pic.css('text-indent', 0).hide().fadeIn(settings.fadeSpeed, function() { isLocked = false; });
navPos = index;
$nav.fadeIn(settings.fadeSpeed);
$popup
.removeClass('loading')
.data('width', nw)
.data('height', nh)
.css('width', 'auto')
.css('height', 'auto');
};
if (nw == $popup.data('width')
&& nh == $popup.data('height'))
(f)();
else
$popup.animate({ width: nw, height: nh }, settings.popupSpeed, 'swing', f);
});
}
if (x.type != 'image')
$x.trigger('load');
})
.on('poptrox_close', function() {
if (isLocked
&& !settings.usePopupForceClose)
return true;
isLocked = true;
$popup
.hide()
.trigger('poptrox_reset');
if (settings.onPopupClose)
(settings.onPopupClose)();
$overlay
.fadeOut(settings.fadeSpeed, function() {
if (settings.useBodyOverflow)
$body.css('overflow', 'auto');
isLocked = false;
});
})
.trigger('poptrox_reset');
// Easy close.
if (settings.usePopupEasyClose) {
$caption.on('click', 'a', function(e) {
e.stopPropagation();
});
$popup
.css('cursor', 'pointer')
.on('click', function(e) {
e.stopPropagation();
e.preventDefault();
$popup.trigger('poptrox_close');
});
}
else
$popup
.on('click', function(e) {
e.stopPropagation();
});
$window
.keydown(function(e) {
if ($popup.is(':visible')) {
switch (e.keyCode) {
case 37:
case 32:
if (settings.usePopupNav) {
$popup.trigger('poptrox_previous');
return false;
}
break;
case 39:
if (settings.usePopupNav) {
$popup.trigger('poptrox_next');
return false;
}
break;
case 27:
$popup.trigger('poptrox_close');
return false;
break;
}
}
});
$this.find(settings.selector).each(function(index) {
var x, tmp, a = $(this), i = a.find('img'), data = a.data('poptrox');
// Ignore? Skip.
if (data == 'ignore')
return;
// No href? Bail.
if (!a.attr('href'))
return;
x = {
// Lazy load captions, added 'a' below
a: a,
src: a.attr('href'),
captionText: i.attr('title'),
width: null,
height: null,
type: null,
object: null,
options: null
};
// Determine caption.
// No caption setting? Use default (title attribute of image).
if (!settings.caption)
c = i.attr('title');
// Function?
else if (typeof(settings.caption) == 'function')
c = (settings.caption)(a);
// Selector?
else if ('selector' in settings.caption) {
var s;
s = a.find(settings.caption.selector);
if ('attribute' in settings.caption)
c = s.attr(settings.caption.attribute);
else {
c = s.html();
if (settings.caption.remove === true)
s.remove();
}
}
x.captionText = c;
// If a data attribute exists, use it
if (data) {
var b = data.split(',');
// Type.
if (0 in b)
x.type = b[0];
// Size.
if (1 in b) {
tmp = b[1].match(/([0-9%]+)x([0-9%]+)/);
if (tmp && tmp.length == 3) {
x.width = tmp[1];
x.height = tmp[2];
}
}
// Options.
if (2 in b)
x.options = b[2];
}
// No type? Attempt to guess it based on the href's domain
if (!x.type) {
tmp = x.src.match(/\/\/([a-z0-9\.]+)\/.*/);
if (!tmp || tmp.length < 2)
tmp = [false];
switch (tmp[1]) {
case 'api.soundcloud.com':
x.type = 'soundcloud';
break;
case 'youtu.be':
x.type = 'youtube';
break;
case 'vimeo.com':
x.type = 'vimeo';
break;
case 'wistia.net':
x.type = 'wistia';
break;
case 'bcove.me':
x.type = 'bcove';
break;
default:
x.type = 'image';
break;
}
}
// Create object (based on type)
tmp = x.src.match(/\/\/[a-z0-9\.]+\/(.*)/);
switch (x.type) {
case 'iframe':
x.object = $('<iframe src="" frameborder="0"></iframe>');
x.object
.on('click', function(e) { e.stopPropagation(); })
.css('cursor', 'auto');
if (!x.width || !x.height) {
x.width = "600";
x.height = "400";
}
break;
case 'ajax':
x.object = $('<div class="poptrox-ajax"></div>');
x.object
.on('click', function(e) { e.stopPropagation(); })
.css('cursor', 'auto')
.css('overflow', 'auto');
if (!x.width || !x.height) {
x.width = "600";
x.height = "400";
}
break;
case 'soundcloud':
x.object = $('<iframe scrolling="no" frameborder="no" src=""></iframe>');
x.src = '//w.soundcloud.com/player/?url=' + escape(x.src) + (x.options ? '&' + x.options : '');
x.width = '600';
x.height = "166";
break;
case 'youtube':
x.object = $('<iframe src="" frameborder="0" allowfullscreen="1"></iframe>');
x.src = '//www.youtube.com/embed/' + tmp[1] + (x.options ? '?' + x.options : '');
if (!x.width || !x.height) {
x.width = "800";
x.height = "480";
}
break;
case 'vimeo':
x.object = $('<iframe src="" frameborder="0" allowFullScreen="1"></iframe>');
x.src = '//player.vimeo.com/video/' + tmp[1] + (x.options ? '?' + x.options : '');
if (!x.width || !x.height) {
x.width = "800";
x.height = "480";
}
break;
case 'wistia':
x.object = $('<iframe src="" frameborder="0" allowFullScreen="1"></iframe>');
x.src = '//fast.wistia.net/' + tmp[1] + (x.options ? '?' + x.options : '');
if (!x.width || !x.height) {
x.width = "800";
x.height = "480";
}
break;
case 'bcove':
x.object = $('<iframe src="" frameborder="0" allowFullScreen="1" width="100%"></iframe>');
x.src = '//bcove.me/' + tmp[1] + (x.options ? '?' + x.options : '');
if (!x.width || !x.height) {
x.width = "640";
x.height = "360";
}
break;
default:
x.object = $('<img src="" alt="" style="vertical-align:bottom" />');
if (settings.preload) {
var tmp = document.createElement('img');
tmp.src = x.src; cache.push(tmp);
}
x.width = a.attr('width');
x.height = a.attr('height');
break;
}
// Fix src if protocol is 'file'.
if (window.location.protocol == 'file:'
&& x.src.match(/^\/\//))
x.src = 'http:' + x.src;
queue.push(x);
i.removeAttr('title');
a
.removeAttr('href')
.css('cursor', 'pointer')
.css('outline', 0)
.on('click', function(e) {
e.preventDefault();
e.stopPropagation();
$popup.trigger('poptrox_open', [index]);
});
});
// Expose settings.
$this.prop('_poptrox', settings);
return $this;
};
})(jQuery);

File diff suppressed because one or more lines are too long

266
assets/js/main.js Normal file
View File

@@ -0,0 +1,266 @@
/*
Multiverse by HTML5 UP
html5up.net | @ajlkn
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
Added EXIF data and enhanced for Jekyll by Ram Patra
*/
(function ($) {
var $window = $(window),
$body = $("body"),
$wrapper = $("#wrapper");
// Breakpoints.
breakpoints({
xlarge: ["1281px", "1680px"],
large: ["981px", "1280px"],
medium: ["737px", "980px"],
small: ["481px", "736px"],
xsmall: [null, "480px"],
});
// Hack: Enable IE workarounds.
if (browser.name == "ie") $body.addClass("ie");
// Touch?
if (browser.mobile) $body.addClass("touch");
// Transitions supported?
if (browser.canUse("transition")) {
// Play initial animations on page load.
$window.on("load", function () {
window.setTimeout(function () {
$body.removeClass("is-preload");
}, 100);
});
// Prevent transitions/animations on resize.
var resizeTimeout;
$window.on("resize", function () {
window.clearTimeout(resizeTimeout);
$body.addClass("is-resizing");
resizeTimeout = window.setTimeout(function () {
$body.removeClass("is-resizing");
}, 100);
});
}
// Scroll back to top.
$window.scrollTop(0);
// Panels.
var $panels = $(".panel");
$panels.each(function () {
var $this = $(this),
$toggles = $('[href="#' + $this.attr("id") + '"]'),
$closer = $('<div class="closer" />').appendTo($this);
// Closer.
$closer.on("click", function (event) {
$this.trigger("---hide");
});
// Events.
$this
.on("click", function (event) {
event.stopPropagation();
})
.on("---toggle", function () {
if ($this.hasClass("active")) $this.triggerHandler("---hide");
else $this.triggerHandler("---show");
})
.on("---show", function () {
// Hide other content.
if ($body.hasClass("content-active")) $panels.trigger("---hide");
// Activate content, toggles.
$this.addClass("active");
$toggles.addClass("active");
// Activate body.
$body.addClass("content-active");
})
.on("---hide", function () {
// Deactivate content, toggles.
$this.removeClass("active");
$toggles.removeClass("active");
// Deactivate body.
$body.removeClass("content-active");
});
// Toggles.
$toggles
.removeAttr("href")
.css("cursor", "pointer")
.on("click", function (event) {
event.preventDefault();
event.stopPropagation();
$this.trigger("---toggle");
});
});
// Global events.
$body.on("click", function (event) {
if ($body.hasClass("content-active")) {
event.preventDefault();
event.stopPropagation();
$panels.trigger("---hide");
}
});
$window.on("keyup", function (event) {
if (event.keyCode == 27 && $body.hasClass("content-active")) {
event.preventDefault();
event.stopPropagation();
$panels.trigger("---hide");
}
});
// Header.
var $header = $("#header");
// Links.
$header.find("a").each(function () {
var $this = $(this),
href = $this.attr("href");
// Internal link? Skip.
if (!href || href.charAt(0) == "#") return;
// Redirect on click.
$this
.removeAttr("href")
.css("cursor", "pointer")
.on("click", function (event) {
event.preventDefault();
event.stopPropagation();
window.location.href = href;
});
});
// Footer.
var $footer = $("#footer");
// Copyright.
// This basically just moves the copyright line to the end of the *last* sibling of its current parent
// when the "medium" breakpoint activates, and moves it back when it deactivates.
$footer.find(".copyright").each(function () {
var $this = $(this),
$parent = $this.parent(),
$lastParent = $parent.parent().children().last();
breakpoints.on("<=medium", function () {
$this.appendTo($lastParent);
});
breakpoints.on(">medium", function () {
$this.appendTo($parent);
});
});
// Main.
var $main = $("#main"),
exifDatas = {};
// Thumbs.
$main.children(".thumb").each(function () {
var $this = $(this),
$image = $this.find(".image"),
$image_img = $image.children("img"),
x;
// No image? Bail.
if ($image.length == 0) return;
// Image.
// This sets the background of the "image" <span> to the image pointed to by its child
// <img> (which is then hidden). Gives us way more flexibility.
// Set background.
$image.css("background-image", "url(" + $image_img.attr("src") + ")");
// Set background position.
if ((x = $image_img.data("position"))) $image.css("background-position", x);
// Hide original img.
$image_img.hide();
// EXIF data
$image_img[0].addEventListener("load", function() {
EXIF.getData($image_img[0], function () {
exifDatas[$image_img.data('name')] = getExifDataMarkup(this);
});
});
});
// Poptrox.
$main.poptrox({
baseZIndex: 20000,
caption: function ($a) {
var $image_img = $a.children('img');
var data = exifDatas[$image_img.data('name')];
if (data === undefined) {
// EXIF data
EXIF.getData($image_img[0], function () {
data = exifDatas[$image_img.data('name')] = getExifDataMarkup(this);
});
}
return data !== undefined ? '<p>' + data + '</p>' : ' ';
},
fadeSpeed: 300,
onPopupClose: function () {
$body.removeClass("modal-active");
},
onPopupOpen: function () {
$body.addClass("modal-active");
},
overlayOpacity: 0,
popupCloserText: "",
popupHeight: 150,
popupLoaderText: "",
popupSpeed: 300,
popupWidth: 150,
selector: ".thumb > a.image",
usePopupCaption: true,
usePopupCloser: true,
usePopupDefaultStyling: false,
usePopupForceClose: true,
usePopupLoader: true,
usePopupNav: true,
windowMargin: 50,
});
// Hack: Set margins to 0 when 'xsmall' activates.
breakpoints.on("<=xsmall", function () {
$main[0]._poptrox.windowMargin = 0;
});
breakpoints.on(">xsmall", function () {
$main[0]._poptrox.windowMargin = 50;
});
function getExifDataMarkup(img) {
var exif = $('#main').data('exif');
var template = '';
for (var current in exif) {
var current_data = exif[current];
var exif_data = EXIF.getTag(img, current_data['tag']);
if (typeof exif_data !== "undefined") {
template += '<i class="' + current_data['icon'] + '" aria-hidden="true"></i> ' + exif_data + '&nbsp;&nbsp;';
}
}
return template;
}
})(jQuery);

1
assets/js/main.min.js vendored Normal file
View File

@@ -0,0 +1 @@
!function(e){var o,n=e(window),a=e("body");e("#wrapper");(breakpoints({xlarge:["1281px","1680px"],large:["981px","1280px"],medium:["737px","980px"],small:["481px","736px"],xsmall:[null,"480px"]}),"ie"==browser.name&&a.addClass("ie"),browser.mobile&&a.addClass("touch"),browser.canUse("transition"))&&(n.on("load",function(){window.setTimeout(function(){a.removeClass("is-preload")},100)}),n.on("resize",function(){window.clearTimeout(o),a.addClass("is-resizing"),o=window.setTimeout(function(){a.removeClass("is-resizing")},100)}));n.scrollTop(0);var t=e(".panel");t.each(function(){var o=e(this),n=e('[href="#'+o.attr("id")+'"]');e('<div class="closer" />').appendTo(o).on("click",function(e){o.trigger("---hide")}),o.on("click",function(e){e.stopPropagation()}).on("---toggle",function(){o.hasClass("active")?o.triggerHandler("---hide"):o.triggerHandler("---show")}).on("---show",function(){a.hasClass("content-active")&&t.trigger("---hide"),o.addClass("active"),n.addClass("active"),a.addClass("content-active")}).on("---hide",function(){o.removeClass("active"),n.removeClass("active"),a.removeClass("content-active")}),n.removeAttr("href").css("cursor","pointer").on("click",function(e){e.preventDefault(),e.stopPropagation(),o.trigger("---toggle")})}),a.on("click",function(e){a.hasClass("content-active")&&(e.preventDefault(),e.stopPropagation(),t.trigger("---hide"))}),n.on("keyup",function(e){27==e.keyCode&&a.hasClass("content-active")&&(e.preventDefault(),e.stopPropagation(),t.trigger("---hide"))}),e("#header").find("a").each(function(){var o=e(this),n=o.attr("href");n&&"#"!=n.charAt(0)&&o.removeAttr("href").css("cursor","pointer").on("click",function(e){e.preventDefault(),e.stopPropagation(),window.location.href=n})}),e("#footer").find(".copyright").each(function(){var o=e(this),n=o.parent(),a=n.parent().children().last();breakpoints.on("<=medium",function(){o.appendTo(a)}),breakpoints.on(">medium",function(){o.appendTo(n)})});var i=e("#main"),r={};function s(o){var n=e("#main").data("exif"),a="";for(var t in n){var i=n[t],r=EXIF.getTag(o,i.tag);void 0!==r&&(a+='<i class="'+i.icon+'" aria-hidden="true"></i> '+r+"&nbsp;&nbsp;")}return a}i.children(".thumb").each(function(){var o,n=e(this).find(".image"),a=n.children("img");0!=n.length&&(n.css("background-image","url("+a.attr("src")+")"),(o=a.data("position"))&&n.css("background-position",o),a.hide(),a[0].addEventListener("load",function(){EXIF.getData(a[0],function(){r[a.data("name")]=s(this)})}))}),i.poptrox({baseZIndex:2e4,caption:function(e){var o=e.children("img"),n=r[o.data("name")];return void 0===n&&EXIF.getData(o[0],function(){n=r[o.data("name")]=s(this)}),void 0!==n?"<p>"+n+"</p>":" "},fadeSpeed:300,onPopupClose:function(){a.removeClass("modal-active")},onPopupOpen:function(){a.addClass("modal-active")},overlayOpacity:0,popupCloserText:"",popupHeight:150,popupLoaderText:"",popupSpeed:300,popupWidth:150,selector:".thumb > a.image",usePopupCaption:!0,usePopupCloser:!0,usePopupDefaultStyling:!1,usePopupForceClose:!0,usePopupLoader:!0,usePopupNav:!0,windowMargin:50}),breakpoints.on("<=xsmall",function(){i[0]._poptrox.windowMargin=0}),breakpoints.on(">xsmall",function(){i[0]._poptrox.windowMargin=50})}(jQuery);

587
assets/js/util.js Normal file
View File

@@ -0,0 +1,587 @@
(function($) {
/**
* Generate an indented list of links from a nav. Meant for use with panel().
* @return {jQuery} jQuery object.
*/
$.fn.navList = function() {
var $this = $(this);
$a = $this.find('a'),
b = [];
$a.each(function() {
var $this = $(this),
indent = Math.max(0, $this.parents('li').length - 1),
href = $this.attr('href'),
target = $this.attr('target');
b.push(
'<a ' +
'class="link depth-' + indent + '"' +
( (typeof target !== 'undefined' && target != '') ? ' target="' + target + '"' : '') +
( (typeof href !== 'undefined' && href != '') ? ' href="' + href + '"' : '') +
'>' +
'<span class="indent-' + indent + '"></span>' +
$this.text() +
'</a>'
);
});
return b.join('');
};
/**
* Panel-ify an element.
* @param {object} userConfig User config.
* @return {jQuery} jQuery object.
*/
$.fn.panel = function(userConfig) {
// No elements?
if (this.length == 0)
return $this;
// Multiple elements?
if (this.length > 1) {
for (var i=0; i < this.length; i++)
$(this[i]).panel(userConfig);
return $this;
}
// Vars.
var $this = $(this),
$body = $('body'),
$window = $(window),
id = $this.attr('id'),
config;
// Config.
config = $.extend({
// Delay.
delay: 0,
// Hide panel on link click.
hideOnClick: false,
// Hide panel on escape keypress.
hideOnEscape: false,
// Hide panel on swipe.
hideOnSwipe: false,
// Reset scroll position on hide.
resetScroll: false,
// Reset forms on hide.
resetForms: false,
// Side of viewport the panel will appear.
side: null,
// Target element for "class".
target: $this,
// Class to toggle.
visibleClass: 'visible'
}, userConfig);
// Expand "target" if it's not a jQuery object already.
if (typeof config.target != 'jQuery')
config.target = $(config.target);
// Panel.
// Methods.
$this._hide = function(event) {
// Already hidden? Bail.
if (!config.target.hasClass(config.visibleClass))
return;
// If an event was provided, cancel it.
if (event) {
event.preventDefault();
event.stopPropagation();
}
// Hide.
config.target.removeClass(config.visibleClass);
// Post-hide stuff.
window.setTimeout(function() {
// Reset scroll position.
if (config.resetScroll)
$this.scrollTop(0);
// Reset forms.
if (config.resetForms)
$this.find('form').each(function() {
this.reset();
});
}, config.delay);
};
// Vendor fixes.
$this
.css('-ms-overflow-style', '-ms-autohiding-scrollbar')
.css('-webkit-overflow-scrolling', 'touch');
// Hide on click.
if (config.hideOnClick) {
$this.find('a')
.css('-webkit-tap-highlight-color', 'rgba(0,0,0,0)');
$this
.on('click', 'a', function(event) {
var $a = $(this),
href = $a.attr('href'),
target = $a.attr('target');
if (!href || href == '#' || href == '' || href == '#' + id)
return;
// Cancel original event.
event.preventDefault();
event.stopPropagation();
// Hide panel.
$this._hide();
// Redirect to href.
window.setTimeout(function() {
if (target == '_blank')
window.open(href);
else
window.location.href = href;
}, config.delay + 10);
});
}
// Event: Touch stuff.
$this.on('touchstart', function(event) {
$this.touchPosX = event.originalEvent.touches[0].pageX;
$this.touchPosY = event.originalEvent.touches[0].pageY;
})
$this.on('touchmove', function(event) {
if ($this.touchPosX === null
|| $this.touchPosY === null)
return;
var diffX = $this.touchPosX - event.originalEvent.touches[0].pageX,
diffY = $this.touchPosY - event.originalEvent.touches[0].pageY,
th = $this.outerHeight(),
ts = ($this.get(0).scrollHeight - $this.scrollTop());
// Hide on swipe?
if (config.hideOnSwipe) {
var result = false,
boundary = 20,
delta = 50;
switch (config.side) {
case 'left':
result = (diffY < boundary && diffY > (-1 * boundary)) && (diffX > delta);
break;
case 'right':
result = (diffY < boundary && diffY > (-1 * boundary)) && (diffX < (-1 * delta));
break;
case 'top':
result = (diffX < boundary && diffX > (-1 * boundary)) && (diffY > delta);
break;
case 'bottom':
result = (diffX < boundary && diffX > (-1 * boundary)) && (diffY < (-1 * delta));
break;
default:
break;
}
if (result) {
$this.touchPosX = null;
$this.touchPosY = null;
$this._hide();
return false;
}
}
// Prevent vertical scrolling past the top or bottom.
if (($this.scrollTop() < 0 && diffY < 0)
|| (ts > (th - 2) && ts < (th + 2) && diffY > 0)) {
event.preventDefault();
event.stopPropagation();
}
});
// Event: Prevent certain events inside the panel from bubbling.
$this.on('click touchend touchstart touchmove', function(event) {
event.stopPropagation();
});
// Event: Hide panel if a child anchor tag pointing to its ID is clicked.
$this.on('click', 'a[href="#' + id + '"]', function(event) {
event.preventDefault();
event.stopPropagation();
config.target.removeClass(config.visibleClass);
});
// Body.
// Event: Hide panel on body click/tap.
$body.on('click touchend', function(event) {
$this._hide(event);
});
// Event: Toggle.
$body.on('click', 'a[href="#' + id + '"]', function(event) {
event.preventDefault();
event.stopPropagation();
config.target.toggleClass(config.visibleClass);
});
// Window.
// Event: Hide on ESC.
if (config.hideOnEscape)
$window.on('keydown', function(event) {
if (event.keyCode == 27)
$this._hide(event);
});
return $this;
};
/**
* Apply "placeholder" attribute polyfill to one or more forms.
* @return {jQuery} jQuery object.
*/
$.fn.placeholder = function() {
// Browser natively supports placeholders? Bail.
if (typeof (document.createElement('input')).placeholder != 'undefined')
return $(this);
// No elements?
if (this.length == 0)
return $this;
// Multiple elements?
if (this.length > 1) {
for (var i=0; i < this.length; i++)
$(this[i]).placeholder();
return $this;
}
// Vars.
var $this = $(this);
// Text, TextArea.
$this.find('input[type=text],textarea')
.each(function() {
var i = $(this);
if (i.val() == ''
|| i.val() == i.attr('placeholder'))
i
.addClass('polyfill-placeholder')
.val(i.attr('placeholder'));
})
.on('blur', function() {
var i = $(this);
if (i.attr('name').match(/-polyfill-field$/))
return;
if (i.val() == '')
i
.addClass('polyfill-placeholder')
.val(i.attr('placeholder'));
})
.on('focus', function() {
var i = $(this);
if (i.attr('name').match(/-polyfill-field$/))
return;
if (i.val() == i.attr('placeholder'))
i
.removeClass('polyfill-placeholder')
.val('');
});
// Password.
$this.find('input[type=password]')
.each(function() {
var i = $(this);
var x = $(
$('<div>')
.append(i.clone())
.remove()
.html()
.replace(/type="password"/i, 'type="text"')
.replace(/type=password/i, 'type=text')
);
if (i.attr('id') != '')
x.attr('id', i.attr('id') + '-polyfill-field');
if (i.attr('name') != '')
x.attr('name', i.attr('name') + '-polyfill-field');
x.addClass('polyfill-placeholder')
.val(x.attr('placeholder')).insertAfter(i);
if (i.val() == '')
i.hide();
else
x.hide();
i
.on('blur', function(event) {
event.preventDefault();
var x = i.parent().find('input[name=' + i.attr('name') + '-polyfill-field]');
if (i.val() == '') {
i.hide();
x.show();
}
});
x
.on('focus', function(event) {
event.preventDefault();
var i = x.parent().find('input[name=' + x.attr('name').replace('-polyfill-field', '') + ']');
x.hide();
i
.show()
.focus();
})
.on('keypress', function(event) {
event.preventDefault();
x.val('');
});
});
// Events.
$this
.on('submit', function() {
$this.find('input[type=text],input[type=password],textarea')
.each(function(event) {
var i = $(this);
if (i.attr('name').match(/-polyfill-field$/))
i.attr('name', '');
if (i.val() == i.attr('placeholder')) {
i.removeClass('polyfill-placeholder');
i.val('');
}
});
})
.on('reset', function(event) {
event.preventDefault();
$this.find('select')
.val($('option:first').val());
$this.find('input,textarea')
.each(function() {
var i = $(this),
x;
i.removeClass('polyfill-placeholder');
switch (this.type) {
case 'submit':
case 'reset':
break;
case 'password':
i.val(i.attr('defaultValue'));
x = i.parent().find('input[name=' + i.attr('name') + '-polyfill-field]');
if (i.val() == '') {
i.hide();
x.show();
}
else {
i.show();
x.hide();
}
break;
case 'checkbox':
case 'radio':
i.attr('checked', i.attr('defaultValue'));
break;
case 'text':
case 'textarea':
i.val(i.attr('defaultValue'));
if (i.val() == '') {
i.addClass('polyfill-placeholder');
i.val(i.attr('placeholder'));
}
break;
default:
i.val(i.attr('defaultValue'));
break;
}
});
});
return $this;
};
/**
* Moves elements to/from the first positions of their respective parents.
* @param {jQuery} $elements Elements (or selector) to move.
* @param {bool} condition If true, moves elements to the top. Otherwise, moves elements back to their original locations.
*/
$.prioritize = function($elements, condition) {
var key = '__prioritize';
// Expand $elements if it's not already a jQuery object.
if (typeof $elements != 'jQuery')
$elements = $($elements);
// Step through elements.
$elements.each(function() {
var $e = $(this), $p,
$parent = $e.parent();
// No parent? Bail.
if ($parent.length == 0)
return;
// Not moved? Move it.
if (!$e.data(key)) {
// Condition is false? Bail.
if (!condition)
return;
// Get placeholder (which will serve as our point of reference for when this element needs to move back).
$p = $e.prev();
// Couldn't find anything? Means this element's already at the top, so bail.
if ($p.length == 0)
return;
// Move element to top of parent.
$e.prependTo($parent);
// Mark element as moved.
$e.data(key, $p);
}
// Moved already?
else {
// Condition is true? Bail.
if (condition)
return;
$p = $e.data(key);
// Move element back to its original location (using our placeholder).
$e.insertAfter($p);
// Unmark element as moved.
$e.removeData(key);
}
});
};
})(jQuery);

1
assets/js/util.min.js vendored Normal file

File diff suppressed because one or more lines are too long