Skip to content
Snippets Groups Projects
Commit fe2e380d authored by aeschylus's avatar aeschylus Committed by GitHub
Browse files

Merge pull request #1150 from ProjectMirador/2.1.1

2.1.1
parents 52a5c988 ef2f2245
No related branches found
No related tags found
No related merge requests found
Showing
with 8 additions and 2417 deletions
{ {
"name": "Mirador", "name": "mirador",
"version": "2.0.0", "version": "2.1.1",
"homepage": "https://github.com/IIIF/m2", "homepage": "https://github.com/ProjectMirador/mirador",
"authors": [ "authors": [
"aeschylus <scipioaffricanus@gmail.com>" "aeschylus <scipioaffricanus@gmail.com>"
], ],
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
"tests" "tests"
], ],
"dependencies": { "dependencies": {
"jquery": "https://code.jquery.com/jquery-3.1.1.min.js",
"jquery-ui": "*", "jquery-ui": "*",
"jquery.scrollTo": "~1.4.12", "jquery.scrollTo": "~1.4.12",
"mousetrap": "~1.4.6", "mousetrap": "~1.4.6",
...@@ -27,10 +28,13 @@ ...@@ -27,10 +28,13 @@
"paper": "git://github.com/paperjs/paper.js.git#*", "paper": "git://github.com/paperjs/paper.js.git#*",
"spectrum": "git://github.com/bgrins/spectrum.git#*", "spectrum": "git://github.com/bgrins/spectrum.git#*",
"jquery-awesome-cursor": "git://github.com/jwarby/jquery-awesome-cursor.git#*", "jquery-awesome-cursor": "git://github.com/jwarby/jquery-awesome-cursor.git#*",
"qTip2": "~2.2.1" "qtip2": "~2.2.1"
}, },
"devDependencies": { "devDependencies": {
"sinon-server": "http://sinonjs.org/releases/sinon-server-1.12.2.js", "sinon-server": "http://sinonjs.org/releases/sinon-server-1.12.2.js",
"jasmine-jquery": "~2.0.6" "jasmine-jquery": "~2.0.6"
},
"resolutions": {
"jquery": ">=1.7.2"
} }
} }
{
"name": "Isfahan",
"homepage": "https://github.com/aeschylus/Isfahan",
"authors": [
"aeschylus <scipioaffricanus@gmail.com>"
],
"description": "A simple tiling window manager built with d3.js",
"keywords": [
"window",
"manager",
"layout",
"d3.js"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"app/bower_components",
"test",
"tests"
],
"dependencies": {
"d3": "~3.4.12",
"jquery": "~2.1.1"
},
"_release": "4803a7a24e",
"_resolution": {
"type": "branch",
"branch": "master",
"commit": "4803a7a24ef32aad1597ef20dea0218577474039"
},
"_source": "https://github.com/aeschylus/Isfahan.git",
"_target": "*",
"_originalSource": "https://github.com/aeschylus/Isfahan.git"
}
\ No newline at end of file
// Generated on 2014-10-04 using generator-webapp 0.4.8
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
module.exports = function (grunt) {
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);
// Define the configuration for all the tasks
grunt.initConfig({
// Project settings
config: {
// Configurable paths
app: 'app',
dist: 'dist'
},
// Watches files for changes and runs tasks based on the changed files
watch: {
bower: {
files: ['bower.json'],
tasks: ['bowerInstall']
},
js: {
files: ['<%= config.app %>/scripts/{,*/}*.js'],
// tasks: ['jshint'],
options: {
livereload: true
}
},
jstest: {
files: ['test/spec/{,*/}*.js'],
tasks: ['test:watch']
},
gruntfile: {
files: ['Gruntfile.js']
},
styles: {
files: ['<%= config.app %>/styles/{,*/}*.css'],
tasks: ['newer:copy:styles', 'autoprefixer']
},
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: [
'<%= config.app %>/{,*/}*.html',
'.tmp/styles/{,*/}*.css',
'<%= config.app %>/images/{,*/}*'
]
}
},
// The actual grunt server settings
connect: {
options: {
port: 9000,
livereload: 35729,
// Change this to '0.0.0.0' to access the server from outside
hostname: 'localhost'
},
livereload: {
options: {
open: true,
base: [
'.tmp',
'<%= config.app %>'
]
}
},
test: {
options: {
port: 9001,
base: [
'.tmp',
'test',
'<%= config.app %>'
]
}
},
dist: {
options: {
open: true,
base: '<%= config.dist %>',
livereload: false
}
}
},
// Empties folders to start fresh
clean: {
dist: {
files: [{
dot: true,
src: [
'.tmp',
'<%= config.dist %>/*',
'!<%= config.dist %>/.git*'
]
}]
},
server: '.tmp'
},
// Make sure code styles are up to par and there are no obvious mistakes
// jshint: {
// options: {
// jshintrc: '.jshintrc',
// reporter: require('jshint-stylish')
// },
// all: [
// 'Gruntfile.js',
// '<%= config.app %>/scripts/{,*/}*.js',
// '!<%= config.app %>/scripts/vendor/*',
// 'test/spec/{,*/}*.js'
// ]
// },
// Mocha testing framework configuration options
mocha: {
all: {
options: {
run: true,
urls: ['http://<%= connect.test.options.hostname %>:<%= connect.test.options.port %>/index.html']
}
}
},
// Add vendor prefixed styles
autoprefixer: {
options: {
browsers: ['last 1 version']
},
dist: {
files: [{
expand: true,
cwd: '.tmp/styles/',
src: '{,*/}*.css',
dest: '.tmp/styles/'
}]
}
},
// Automatically inject Bower components into the HTML file
bowerInstall: {
app: {
src: ['<%= config.app %>/index.html'],
ignorePath: '<%= config.app %>/'
}
},
// Renames files for browser caching purposes
rev: {
dist: {
files: {
src: [
'<%= config.dist %>/scripts/{,*/}*.js',
'<%= config.dist %>/styles/{,*/}*.css',
'<%= config.dist %>/images/{,*/}*.*',
'<%= config.dist %>/styles/fonts/{,*/}*.*',
'<%= config.dist %>/*.{ico,png}'
]
}
}
},
// Reads HTML for usemin blocks to enable smart builds that automatically
// concat, minify and revision files. Creates configurations in memory so
// additional tasks can operate on them
useminPrepare: {
options: {
dest: '<%= config.dist %>'
},
html: '<%= config.app %>/index.html'
},
// Performs rewrites based on rev and the useminPrepare configuration
usemin: {
options: {
assetsDirs: ['<%= config.dist %>', '<%= config.dist %>/images']
},
html: ['<%= config.dist %>/{,*/}*.html'],
css: ['<%= config.dist %>/styles/{,*/}*.css']
},
// The following *-min tasks produce minified files in the dist folder
imagemin: {
dist: {
files: [{
expand: true,
cwd: '<%= config.app %>/images',
src: '{,*/}*.{gif,jpeg,jpg,png}',
dest: '<%= config.dist %>/images'
}]
}
},
svgmin: {
dist: {
files: [{
expand: true,
cwd: '<%= config.app %>/images',
src: '{,*/}*.svg',
dest: '<%= config.dist %>/images'
}]
}
},
htmlmin: {
dist: {
options: {
collapseBooleanAttributes: true,
collapseWhitespace: true,
removeAttributeQuotes: true,
removeCommentsFromCDATA: true,
removeEmptyAttributes: true,
removeOptionalTags: true,
removeRedundantAttributes: true,
useShortDoctype: true
},
files: [{
expand: true,
cwd: '<%= config.dist %>',
src: '{,*/}*.html',
dest: '<%= config.dist %>'
}]
}
},
// By default, your `index.html`'s <!-- Usemin block --> will take care of
// minification. These next options are pre-configured if you do not wish
// to use the Usemin blocks.
// cssmin: {
// dist: {
// files: {
// '<%= config.dist %>/styles/main.css': [
// '.tmp/styles/{,*/}*.css',
// '<%= config.app %>/styles/{,*/}*.css'
// ]
// }
// }
// },
// uglify: {
// dist: {
// files: {
// '<%= config.dist %>/scripts/scripts.js': [
// '<%= config.dist %>/scripts/scripts.js'
// ]
// }
// }
// },
// concat: {
// dist: {}
// },
// Copies remaining files to places other tasks can use
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= config.app %>',
dest: '<%= config.dist %>',
src: [
'*.{ico,png,txt}',
'.htaccess',
'images/{,*/}*.webp',
'{,*/}*.html',
'styles/fonts/{,*/}*.*'
]
}]
},
styles: {
expand: true,
dot: true,
cwd: '<%= config.app %>/styles',
dest: '.tmp/styles/',
src: '{,*/}*.css'
}
},
// Run some tasks in parallel to speed up build process
concurrent: {
server: [
'copy:styles'
],
test: [
'copy:styles'
],
dist: [
'copy:styles',
'imagemin',
'svgmin'
]
}
});
grunt.registerTask('serve', function (target) {
if (target === 'dist') {
return grunt.task.run(['build', 'connect:dist:keepalive']);
}
grunt.task.run([
'clean:server',
'concurrent:server',
'autoprefixer',
'connect:livereload',
'watch'
]);
});
grunt.registerTask('server', function (target) {
grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
grunt.task.run([target ? ('serve:' + target) : 'serve']);
});
grunt.registerTask('test', function (target) {
if (target !== 'watch') {
grunt.task.run([
'clean:server',
'concurrent:test',
'autoprefixer'
]);
}
grunt.task.run([
'connect:test',
'mocha'
]);
});
grunt.registerTask('build', [
'clean:dist',
'useminPrepare',
'concurrent:dist',
'autoprefixer',
'concat',
'cssmin',
'uglify',
'copy:dist',
'rev',
'usemin',
'htmlmin'
]);
grunt.registerTask('default', [
// 'newer:jshint',
'test',
'build'
]);
};
Isfahan
=======
A tiling window manager based on d3.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Page Not Found :(</title>
<style>
::-moz-selection {
background: #b3d4fc;
text-shadow: none;
}
::selection {
background: #b3d4fc;
text-shadow: none;
}
html {
padding: 30px 10px;
font-size: 20px;
line-height: 1.4;
color: #737373;
background: #f0f0f0;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
html,
input {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
body {
max-width: 500px;
_width: 500px;
padding: 30px 20px 50px;
border: 1px solid #b3b3b3;
border-radius: 4px;
margin: 0 auto;
box-shadow: 0 1px 10px #a7a7a7, inset 0 1px 0 #fff;
background: #fcfcfc;
}
h1 {
margin: 0 10px;
font-size: 50px;
text-align: center;
}
h1 span {
color: #bbb;
}
h3 {
margin: 1.5em 0 0.5em;
}
p {
margin: 1em 0;
}
ul {
padding: 0 0 0 40px;
margin: 1em 0;
}
.container {
max-width: 380px;
_width: 380px;
margin: 0 auto;
}
/* google search */
#goog-fixurl ul {
list-style: none;
padding: 0;
margin: 0;
}
#goog-fixurl form {
margin: 0;
}
#goog-wm-qt,
#goog-wm-sb {
border: 1px solid #bbb;
font-size: 16px;
line-height: normal;
vertical-align: top;
color: #444;
border-radius: 2px;
}
#goog-wm-qt {
width: 220px;
height: 20px;
padding: 5px;
margin: 5px 10px 0 0;
box-shadow: inset 0 1px 1px #ccc;
}
#goog-wm-sb {
display: inline-block;
height: 32px;
padding: 0 10px;
margin: 5px 0 0;
white-space: nowrap;
cursor: pointer;
background-color: #f5f5f5;
background-image: -webkit-linear-gradient(rgba(255,255,255,0), #f1f1f1);
background-image: -moz-linear-gradient(rgba(255,255,255,0), #f1f1f1);
background-image: -ms-linear-gradient(rgba(255,255,255,0), #f1f1f1);
background-image: -o-linear-gradient(rgba(255,255,255,0), #f1f1f1);
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
*overflow: visible;
*display: inline;
*zoom: 1;
}
#goog-wm-sb:hover,
#goog-wm-sb:focus {
border-color: #aaa;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
background-color: #f8f8f8;
}
#goog-wm-qt:hover,
#goog-wm-qt:focus {
border-color: #105cb6;
outline: 0;
color: #222;
}
input::-moz-focus-inner {
padding: 0;
border: 0;
}
</style>
</head>
<body>
<div class="container">
<h1>Not found <span>:(</span></h1>
<p>Sorry, but the page you were trying to view does not exist.</p>
<p>It looks like this was the result of either:</p>
<ul>
<li>a mistyped address</li>
<li>an out-of-date link</li>
</ul>
<script>
var GOOG_FIXURL_LANG = (navigator.language || '').slice(0,2),GOOG_FIXURL_SITE = location.host;
</script>
<script src="//linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js"></script>
</div>
</body>
</html>
bower_components/Isfahan/app/favicon.ico

4.19 KiB

<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<head>
<meta charset="utf-8">
<title>Isfahan</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="shortcut icon" href="/favicon.ico">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<!-- build:css styles/vendor.css -->
<!-- bower:css -->
<!-- endbower -->
<!-- endbuild -->
<!-- build:css(.tmp) styles/main.css -->
<link rel="stylesheet" href="styles/main.css">
<!-- endbuild -->
</head>
<body>
<!--[if lt IE 10]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<div id="container">
</div>
<input type="range" min="1" max="400" value="100">
<!-- build:js scripts/vendor.js -->
<!-- bower:js -->
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/d3/d3.js"></script>
<!-- endbower -->
<!-- endbuild -->
<!-- build:js({app,.tmp}) scripts/main.js -->
<script src="scripts/main.js"></script>
<script>
var singleNested = {
"type": "column",
"children":[
{
"type":"row",
"children":[
{
"type":"column",
"children":[
{
"type":"row",
"children":[
{
"type":"column",
"children":[
{
"type":"column",
},
{
"type":"column",
},
{
"type":"column",
}]
},
{
"type":"column",
},
{
"type":"column",
}]
},
{
"type":"column",
},
{
"type":"column",
}]
},
{
"type":"column",
},
{
"type":"column",
}]
},
{
"type":"row",
"children":[
{
"type":"column",
},
{
"type":"column",
},
{
"type":"column",
}]
}
]
};
var oneBytwo = {
'type': 'row',
'children': [
{
'type': 'column'
},
{
'type': 'column'
}]
};
var oneByThree = {
'type': 'row',
'children': [
{
'type': 'column'
},
{
'type': 'column'
},
{
'type': 'column'
}]
};
var threeBythree = {
"type": "row",
"children":[
{
"type":"column",
"children":[
{
"type":"row",
},
{
"type":"row",
},
{
"type":"row",
}]
}
,{
"type":"column",
"children":[
{
"type":"row",
},
{
"type":"row",
},
{
"type":"row",
}]
},
{
"type":"column",
"children":[
{
"type":"row",
},
{
"type":"row",
},
{
"type":"row",
}]
}]
}
var layoutInput = {
"type": "row",
"children":[
{
"type":"column",
},
{
"type":"column",
"children":[
{
"type":"row",
"children":[
{
"type":"column",
},
{
"type":"column",
},
{
"type":"column",
}]
},
{
"type":"row",
"children":[
{
"type":"column",
"children":[
{
"type":"column",
},
{
"type":"column",
},
{
"type":"column",
}]
},
{
"type":"column",
},
{
"type":"column",
}]
},
{
"type":"row",
}]
}],
"label":"Reference",
"iconClass":"th-list"
};
function update(data, animate) {
var windowingSystem = Isfahan({
containerId: 'container',
layoutDescription: data,
configuration: null,
padding: 3
});
console.log('data before filter: ');
console.log(data);
data = windowingSystem.filter( function(d) {
return !d.children;
});
console.log('data after filter: ');
console.log(data);
// Data Join.
var divs = d3.select("#container").selectAll("div.tileWindow")
.data(data, function(d) {console.log(d); return d.address; });
// Update
if (animate) {
divs.transition()
.duration(300).call(cell);
} else {
divs.call(cell);
}
// Enter
if (animate) {
divs.enter().append("div")
.attr("class", "tileWindow")
.transition().duration(300)
.call(cell);
} else {
divs.enter().append("div")
.attr("class", "tileWindow")
.call(cell);
}
// Exit
divs.exit()
.remove("div");
function cell() {
this
.style("left", function(d) { return d.x + "px"; })
.style("top", function(d) { return d.y + "px"; })
.style("width", function(d) { return Math.max(0, d.dx ) + "px"; })
.style("height", function(d) { return Math.max(0, d.dy ) + "px"; });
}
}
d3.select(window).on('resize', function(event) {
update(option, false);
})
function changeIt(animate) {
var options = [threeBythree, layoutInput, singleNested];
option = options[Math.floor(Math.random() * 3)];
update(option, true);
}
update(oneBytwo, false);
function setOption(layoutName) {
option = layoutName;
update(option, true);
}
var input = document.getElementsByTagName("input")[0];
input.onchange = function() {
var val = input.value;
var tile = selected;
windowingSystem.resize(tile, val);
console.log('resizing slot');
}
// Mock API
// load from serialised version
// Fill/address/empty the slot
// Just get the dom reference for
// an address of the grid system
// close area by address or id
// insert new area by address
// left/right split, top/bottom split
// serialise contents/layout
// resize a sub-slot
// fix rounding errors
// UI layer has ugly code
// re-evaluate styling hooks
</script>
<!-- endbuild -->
</body>
</html>
# robotstxt.org/
User-agent: *
var Isfahan = function(configObject) {
var _this = this,
containerSize = function(containerId) {
return [document.getElementById(containerId).offsetWidth,
document.getElementById(containerId).offsetHeight]
},
containerId = configObject.containerId,
pad = d3_layout_cellPadNull,
round = Math.round,
padding = configObject.padding,
hierarchy = d3.layout.hierarchy(),
layoutDescription = configObject.layoutDescription;
function calculateLayout(node) {
var children = node.children;
if (children && children.length) {
var rect = pad(node),
type = node.type,
group = [],
remaining = children.slice(), // copy-on-write
child,
n;
while ((n = remaining.length) > 0) {
group.push(child = remaining[n - 1]);
remaining.pop();
}
position(group, node.type, rect);
children.forEach(function(child, index) {
child.address = node.address.concat("." + child.type + (index + 1));
})
children.forEach(calculateLayout);
}
}
// Positions the specified row of nodes. Modifies `rect`.
function position(group, groupType, rect) {
// console.log('%c\n'+' parent ' + groupType + ' rect is: ', 'background: #222; color: #EFEFEF; font-family: helvetica neue; font-size:20px; padding: 0 7px 3px 0;');
// console.log(rect);
var i = -1,
row = (groupType === "row") ? false : true, // for ternary statements later, specifies whether that particular child is a row or not. Allows easy, centralised description of the parameter calculations that can be switched from row to column.
n = group.length,
x = rect.x,
y = rect.y,
o;
var offset = 0;
while (++i < n) {
o = group[n-(i+1)],
d = divisor(o, row, rect, group, n),
o.id = typeof o.id !== 'undefined' ? o.id : genUuid(),
o.x = row ? x : x + offset,
o.y = row ? y + offset : y,
o.dx = row ? rect.dx : rect.dx/d,
o.dy = row ? rect.dy/d : rect.dy,
offset += row ? o.dy : o.dx;
// console.log({x:o.x, y: o.y, width:o.dx, height: o.dy});
}
}
function divisor(node, row, rect, group, n) {
var old = false,
dimension = row ? 'dy' : 'dx',
total = rect[dimension],
divisor;
// if not already set, divide equally.
group.forEach(function(item) {
if (!item[dimension] === undefined) {
old = true;
}
});
if (old) {
console.log('preserved');
var sum = group.reduce(
function(previousValue, currentValue, index, array) {
return previousValue[dimension] + currentValue[dimension];
});
console.log('sum: ' + sum);
divisor = (node[dimension]/sum)*total;
console.log("divisor: "+divisor);
return divisor;
} else {
return n;
}
}
function isfahan(configObject) {
var nodes = hierarchy(configObject.layoutDescription),
root = nodes[0];
size = (function(containerSelector) {
var width = jQuery(containerSelector).width();
var height = jQuery(containerSelector).height();
return [width, height];
})(configObject.containerSelector);
root.x = 0;
root.y = 0;
root.dx = containerSize(containerId)[0];
root.dy = containerSize(containerId)[1];
root.address = root.type + "1";
root.id = root.id || genUuid();
calculateLayout(root);
isfahan.padding(padding);
nodes = nodes.map(function(node) {
return merge(node, pad(node));
});
return nodes;
}
isfahan.size = function(x) {
if (!arguments.length) return containerSize;
containerSize = x;
return isfahan;
};
isfahan.round = function(x) {
if (!arguments.length) return round != Number;
round = x ? Math.round : Number;
return isfahan;
};
isfahan.padding = function(x) {
if (!arguments.length) return padding;
function padFunction(node) {
var p = x.call(isfahan, node, node.depth);
console.log(p);
return p == null
? d3_layout_cellPadNull(node)
: d3_layout_cellPad(node, typeof p === "number" ? [p, p, p, p] : p);
}
function padConstant(node) {
return d3_layout_cellPad(node, x);
}
var type;
pad = (padding = x) == null ? d3_layout_cellPadNull
: (type = typeof x) === "function" ? padFunction
: type === "number" ? (x = [x, x, x, x], padConstant)
: padConstant;
return isfahan;
};
function genUuid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
});
}
function d3_layout_cellPadNull(node) {
return {x: node.x, y: node.y, dx: node.dx, dy: node.dy};
}
function d3_layout_cellPad(node, padding) {
var x = node.x + padding[3],
y = node.y + padding[0],
dx = node.dx - padding[1] - padding[3],
dy = node.dy - padding[0] - padding[2];
if (dx < 0) { x += dx / 2; dx = 0; }
if (dy < 0) { y += dy / 2; dy = 0; }
return {x: x, y: y, dx: dx, dy: dy};
}
function merge(target, source) {
/* Merges two (or more) objects,
giving the last one precedence */
if ( typeof target !== 'object' ) {
target = {};
}
for (var property in source) {
if ( source.hasOwnProperty(property) ) {
var sourceProperty = source[ property ];
if ( typeof sourceProperty === 'object' ) {
target[ property ] = util.merge( target[ property ], sourceProperty );
continue;
}
target[ property ] = sourceProperty;
}
}
for (var a = 2, l = arguments.length; a < l; a++) {
merge(target, arguments[a]);
}
return target;
};
// return d3.rebind(isfahan, hierarchy,"sort", "children", "value");
return isfahan(configObject);
};
body, html {
background: #fafafa;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #222;
margin:0;
padding:0;
height:100%;
width:100%;
}
body {
position: absolute;
left:0;
right:0;
bottom:0;
top:0;
overflow:hidden;
}
input {
position: fixed;
bottom: 0;
left: 0;
}
.hero-unit {
margin: 50px auto 0 auto;
width: 300px;
font-size: 18px;
font-weight: 200;
line-height: 30px;
background-color: #eee;
border-radius: 6px;
padding: 60px;
}
.hero-unit h1 {
font-size: 60px;
line-height: 1;
letter-spacing: -1px;
}
.browsehappy {
margin: 0.2em 0;
background: #ccc;
color: #000;
padding: 0.2em 0;
}
#container {
box-sizing: border-box;
position: absolute;
margin: 5px;
top:0;
bottom:0;
left:0;
right:0;
}
.tileWindow {
position: absolute;
box-sizing: border-box;
background-color: linen;
box-shadow: inset 0 0 25px black;
}
{
"name": "Isfahan",
"version": "0.0.1",
"homepage": "https://github.com/aeschylus/Isfahan",
"authors": [
"aeschylus <scipioaffricanus@gmail.com>"
],
"description": "A simple tiling window manager built with d3.js",
"keywords": [
"window",
"manager",
"layout",
"d3.js"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"app/bower_components",
"test",
"tests"
],
"dependencies": {
"d3": "~3.4.12",
"jquery": "~2.1.1"
}
}
{
"name": "isfahan",
"version": "0.0.0",
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-jshint": "~0.7.0",
"grunt-contrib-cssmin": "~0.7.0",
"grunt-contrib-connect": "~0.5.0",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-htmlmin": "~0.1.3",
"grunt-bower-install": "~1.0.0",
"grunt-contrib-imagemin": "~0.5.0",
"grunt-contrib-watch": "~0.5.2",
"grunt-rev": "~0.1.0",
"grunt-autoprefixer": "~0.5.0",
"grunt-usemin": "~2.0.0",
"grunt-mocha": "~0.4.0",
"grunt-newer": "~0.6.0",
"grunt-svgmin": "~0.2.0",
"grunt-concurrent": "~0.4.0",
"load-grunt-tasks": "~0.2.0",
"time-grunt": "~0.2.0",
"jshint-stylish": "~0.1.3"
},
"engines": {
"node": ">=0.8.0"
}
}
{
"name": "URIjs",
"version": "1.13.2",
"main": [
"src/URI.js",
"src/IPv6.js",
"src/SecondLevelDomains.js",
"src/punycode.js",
"src/URITemplate.js",
"src/jquery.URI.js",
"src/URI.min.js",
"src/jquery.URI.min.js",
"src/URI.fragmentQuery.js",
"src/URI.fragmentURI.js"
],
"ignore": [
".*",
"*.css",
"/*.js",
"/*.html",
"/*.json",
"utils",
"test",
"prettify"
],
"dependencies": {
"jquery": ">=1.7.0"
},
"homepage": "https://github.com/medialize/URI.js",
"_release": "1.13.2",
"_resolution": {
"type": "version",
"tag": "v1.13.2",
"commit": "85cc312f394ee848933da218a4ff407e8e8e81e7"
},
"_source": "https://github.com/medialize/URI.js.git",
"_target": "~1.13.2",
"_originalSource": "https://github.com/medialize/URI.js.git",
"_direct": true
}
\ No newline at end of file
This diff is collapsed.
{
"name": "URIjs",
"version": "1.13.2",
"main": [
"src/URI.js",
"src/IPv6.js",
"src/SecondLevelDomains.js",
"src/punycode.js",
"src/URITemplate.js",
"src/jquery.URI.js",
"src/URI.min.js",
"src/jquery.URI.min.js",
"src/URI.fragmentQuery.js",
"src/URI.fragmentURI.js"
],
"ignore": [
".*",
"*.css",
"/*.js",
"/*.html",
"/*.json",
"utils",
"test",
"prettify"
],
"dependencies": {
"jquery": ">=1.7.0"
}
}
# Contributing to URI.js #
URI.js Project License: MIT License
* You will only Submit Contributions where You have authored 100% of the content.
* You will only Submit Contributions to which You have the necessary rights. This means that if You are employed You have received the necessary permissions from Your employer to make the Contributions.
* Whatever content You Contribute will be provided under the project License.
---
Thanks for your help!
Pull Requests go into the branch **master**. The *gh-pages* branch is a presentation of the *master* branch at the last given release.
Whenever you change code, make sure you run the test suite before sending a pull request. Please add tests for any features you add to the code base. We're using [QUnit](http://qunitjs.com/) for testing.
We're looking forward to splitting URI.js in several files, each dealing with a specific domain, to make the 1800 lines of code more bearable to work with. This will lead to using [Grunt](http://gruntjs.com/) to build a distributable version (and the removal of `build.html`). We're not sure when we'll get to this. If you want to pitch in, just holler!
/*!
* URI.js - Mutating URLs
* IPv6 Support
*
* Version: 1.13.2
*
* Author: Rodney Rehm
* Web: http://medialize.github.io/URI.js/
*
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
* GPL v3 http://opensource.org/licenses/GPL-3.0
*
*/
(function (root, factory) {
'use strict';
// https://github.com/umdjs/umd/blob/master/returnExports.js
if (typeof exports === 'object') {
// Node
module.exports = factory();
} else if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(factory);
} else {
// Browser globals (root is window)
root.IPv6 = factory(root);
}
}(this, function (root) {
'use strict';
/*
var _in = "fe80:0000:0000:0000:0204:61ff:fe9d:f156";
var _out = IPv6.best(_in);
var _expected = "fe80::204:61ff:fe9d:f156";
console.log(_in, _out, _expected, _out === _expected);
*/
// save current IPv6 variable, if any
var _IPv6 = root && root.IPv6;
function bestPresentation(address) {
// based on:
// Javascript to test an IPv6 address for proper format, and to
// present the "best text representation" according to IETF Draft RFC at
// http://tools.ietf.org/html/draft-ietf-6man-text-addr-representation-04
// 8 Feb 2010 Rich Brown, Dartware, LLC
// Please feel free to use this code as long as you provide a link to
// http://www.intermapper.com
// http://intermapper.com/support/tools/IPV6-Validator.aspx
// http://download.dartware.com/thirdparty/ipv6validator.js
var _address = address.toLowerCase();
var segments = _address.split(':');
var length = segments.length;
var total = 8;
// trim colons (:: or ::a:b:c… or …a:b:c::)
if (segments[0] === '' && segments[1] === '' && segments[2] === '') {
// must have been ::
// remove first two items
segments.shift();
segments.shift();
} else if (segments[0] === '' && segments[1] === '') {
// must have been ::xxxx
// remove the first item
segments.shift();
} else if (segments[length - 1] === '' && segments[length - 2] === '') {
// must have been xxxx::
segments.pop();
}
length = segments.length;
// adjust total segments for IPv4 trailer
if (segments[length - 1].indexOf('.') !== -1) {
// found a "." which means IPv4
total = 7;
}
// fill empty segments them with "0000"
var pos;
for (pos = 0; pos < length; pos++) {
if (segments[pos] === '') {
break;
}
}
if (pos < total) {
segments.splice(pos, 1, '0000');
while (segments.length < total) {
segments.splice(pos, 0, '0000');
}
length = segments.length;
}
// strip leading zeros
var _segments;
for (var i = 0; i < total; i++) {
_segments = segments[i].split('');
for (var j = 0; j < 3 ; j++) {
if (_segments[0] === '0' && _segments.length > 1) {
_segments.splice(0,1);
} else {
break;
}
}
segments[i] = _segments.join('');
}
// find longest sequence of zeroes and coalesce them into one segment
var best = -1;
var _best = 0;
var _current = 0;
var current = -1;
var inzeroes = false;
// i; already declared
for (i = 0; i < total; i++) {
if (inzeroes) {
if (segments[i] === '0') {
_current += 1;
} else {
inzeroes = false;
if (_current > _best) {
best = current;
_best = _current;
}
}
} else {
if (segments[i] === '0') {
inzeroes = true;
current = i;
_current = 1;
}
}
}
if (_current > _best) {
best = current;
_best = _current;
}
if (_best > 1) {
segments.splice(best, _best, '');
}
length = segments.length;
// assemble remaining segments
var result = '';
if (segments[0] === '') {
result = ':';
}
for (i = 0; i < length; i++) {
result += segments[i];
if (i === length - 1) {
break;
}
result += ':';
}
if (segments[length - 1] === '') {
result += ':';
}
return result;
}
function noConflict() {
/*jshint validthis: true */
if (root.IPv6 === this) {
root.IPv6 = _IPv6;
}
return this;
}
return {
best: bestPresentation,
noConflict: noConflict
};
}));
/*!
* URI.js - Mutating URLs
* Second Level Domain (SLD) Support
*
* Version: 1.13.2
*
* Author: Rodney Rehm
* Web: http://medialize.github.io/URI.js/
*
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
* GPL v3 http://opensource.org/licenses/GPL-3.0
*
*/
(function (root, factory) {
'use strict';
// https://github.com/umdjs/umd/blob/master/returnExports.js
if (typeof exports === 'object') {
// Node
module.exports = factory();
} else if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(factory);
} else {
// Browser globals (root is window)
root.SecondLevelDomains = factory(root);
}
}(this, function (root) {
'use strict';
// save current SecondLevelDomains variable, if any
var _SecondLevelDomains = root && root.SecondLevelDomains;
var SLD = {
// list of known Second Level Domains
// converted list of SLDs from https://github.com/gavingmiller/second-level-domains
// ----
// publicsuffix.org is more current and actually used by a couple of browsers internally.
// downside is it also contains domains like "dyndns.org" - which is fine for the security
// issues browser have to deal with (SOP for cookies, etc) - but is way overboard for URI.js
// ----
list: {
'ac':' com gov mil net org ',
'ae':' ac co gov mil name net org pro sch ',
'af':' com edu gov net org ',
'al':' com edu gov mil net org ',
'ao':' co ed gv it og pb ',
'ar':' com edu gob gov int mil net org tur ',
'at':' ac co gv or ',
'au':' asn com csiro edu gov id net org ',
'ba':' co com edu gov mil net org rs unbi unmo unsa untz unze ',
'bb':' biz co com edu gov info net org store tv ',
'bh':' biz cc com edu gov info net org ',
'bn':' com edu gov net org ',
'bo':' com edu gob gov int mil net org tv ',
'br':' adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ',
'bs':' com edu gov net org ',
'bz':' du et om ov rg ',
'ca':' ab bc mb nb nf nl ns nt nu on pe qc sk yk ',
'ck':' biz co edu gen gov info net org ',
'cn':' ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ',
'co':' com edu gov mil net nom org ',
'cr':' ac c co ed fi go or sa ',
'cy':' ac biz com ekloges gov ltd name net org parliament press pro tm ',
'do':' art com edu gob gov mil net org sld web ',
'dz':' art asso com edu gov net org pol ',
'ec':' com edu fin gov info med mil net org pro ',
'eg':' com edu eun gov mil name net org sci ',
'er':' com edu gov ind mil net org rochest w ',
'es':' com edu gob nom org ',
'et':' biz com edu gov info name net org ',
'fj':' ac biz com info mil name net org pro ',
'fk':' ac co gov net nom org ',
'fr':' asso com f gouv nom prd presse tm ',
'gg':' co net org ',
'gh':' com edu gov mil org ',
'gn':' ac com gov net org ',
'gr':' com edu gov mil net org ',
'gt':' com edu gob ind mil net org ',
'gu':' com edu gov net org ',
'hk':' com edu gov idv net org ',
'id':' ac co go mil net or sch web ',
'il':' ac co gov idf k12 muni net org ',
'in':' ac co edu ernet firm gen gov i ind mil net nic org res ',
'iq':' com edu gov i mil net org ',
'ir':' ac co dnssec gov i id net org sch ',
'it':' edu gov ',
'je':' co net org ',
'jo':' com edu gov mil name net org sch ',
'jp':' ac ad co ed go gr lg ne or ',
'ke':' ac co go info me mobi ne or sc ',
'kh':' com edu gov mil net org per ',
'ki':' biz com de edu gov info mob net org tel ',
'km':' asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ',
'kn':' edu gov net org ',
'kr':' ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ',
'kw':' com edu gov net org ',
'ky':' com edu gov net org ',
'kz':' com edu gov mil net org ',
'lb':' com edu gov net org ',
'lk':' assn com edu gov grp hotel int ltd net ngo org sch soc web ',
'lr':' com edu gov net org ',
'lv':' asn com conf edu gov id mil net org ',
'ly':' com edu gov id med net org plc sch ',
'ma':' ac co gov m net org press ',
'mc':' asso tm ',
'me':' ac co edu gov its net org priv ',
'mg':' com edu gov mil nom org prd tm ',
'mk':' com edu gov inf name net org pro ',
'ml':' com edu gov net org presse ',
'mn':' edu gov org ',
'mo':' com edu gov net org ',
'mt':' com edu gov net org ',
'mv':' aero biz com coop edu gov info int mil museum name net org pro ',
'mw':' ac co com coop edu gov int museum net org ',
'mx':' com edu gob net org ',
'my':' com edu gov mil name net org sch ',
'nf':' arts com firm info net other per rec store web ',
'ng':' biz com edu gov mil mobi name net org sch ',
'ni':' ac co com edu gob mil net nom org ',
'np':' com edu gov mil net org ',
'nr':' biz com edu gov info net org ',
'om':' ac biz co com edu gov med mil museum net org pro sch ',
'pe':' com edu gob mil net nom org sld ',
'ph':' com edu gov i mil net ngo org ',
'pk':' biz com edu fam gob gok gon gop gos gov net org web ',
'pl':' art bialystok biz com edu gda gdansk gorzow gov info katowice krakow lodz lublin mil net ngo olsztyn org poznan pwr radom slupsk szczecin torun warszawa waw wroc wroclaw zgora ',
'pr':' ac biz com edu est gov info isla name net org pro prof ',
'ps':' com edu gov net org plo sec ',
'pw':' belau co ed go ne or ',
'ro':' arts com firm info nom nt org rec store tm www ',
'rs':' ac co edu gov in org ',
'sb':' com edu gov net org ',
'sc':' com edu gov net org ',
'sh':' co com edu gov net nom org ',
'sl':' com edu gov net org ',
'st':' co com consulado edu embaixada gov mil net org principe saotome store ',
'sv':' com edu gob org red ',
'sz':' ac co org ',
'tr':' av bbs bel biz com dr edu gen gov info k12 name net org pol tel tsk tv web ',
'tt':' aero biz cat co com coop edu gov info int jobs mil mobi museum name net org pro tel travel ',
'tw':' club com ebiz edu game gov idv mil net org ',
'mu':' ac co com gov net or org ',
'mz':' ac co edu gov org ',
'na':' co com ',
'nz':' ac co cri geek gen govt health iwi maori mil net org parliament school ',
'pa':' abo ac com edu gob ing med net nom org sld ',
'pt':' com edu gov int net nome org publ ',
'py':' com edu gov mil net org ',
'qa':' com edu gov mil net org ',
're':' asso com nom ',
'ru':' ac adygeya altai amur arkhangelsk astrakhan bashkiria belgorod bir bryansk buryatia cbg chel chelyabinsk chita chukotka chuvashia com dagestan e-burg edu gov grozny int irkutsk ivanovo izhevsk jar joshkar-ola kalmykia kaluga kamchatka karelia kazan kchr kemerovo khabarovsk khakassia khv kirov koenig komi kostroma kranoyarsk kuban kurgan kursk lipetsk magadan mari mari-el marine mil mordovia mosreg msk murmansk nalchik net nnov nov novosibirsk nsk omsk orenburg org oryol penza perm pp pskov ptz rnd ryazan sakhalin samara saratov simbirsk smolensk spb stavropol stv surgut tambov tatarstan tom tomsk tsaritsyn tsk tula tuva tver tyumen udm udmurtia ulan-ude vladikavkaz vladimir vladivostok volgograd vologda voronezh vrn vyatka yakutia yamal yekaterinburg yuzhno-sakhalinsk ',
'rw':' ac co com edu gouv gov int mil net ',
'sa':' com edu gov med net org pub sch ',
'sd':' com edu gov info med net org tv ',
'se':' a ac b bd c d e f g h i k l m n o org p parti pp press r s t tm u w x y z ',
'sg':' com edu gov idn net org per ',
'sn':' art com edu gouv org perso univ ',
'sy':' com edu gov mil net news org ',
'th':' ac co go in mi net or ',
'tj':' ac biz co com edu go gov info int mil name net nic org test web ',
'tn':' agrinet com defense edunet ens fin gov ind info intl mincom nat net org perso rnrt rns rnu tourism ',
'tz':' ac co go ne or ',
'ua':' biz cherkassy chernigov chernovtsy ck cn co com crimea cv dn dnepropetrovsk donetsk dp edu gov if in ivano-frankivsk kh kharkov kherson khmelnitskiy kiev kirovograd km kr ks kv lg lugansk lutsk lviv me mk net nikolaev od odessa org pl poltava pp rovno rv sebastopol sumy te ternopil uzhgorod vinnica vn zaporizhzhe zhitomir zp zt ',
'ug':' ac co go ne or org sc ',
'uk':' ac bl british-library co cym gov govt icnet jet lea ltd me mil mod national-library-scotland nel net nhs nic nls org orgn parliament plc police sch scot soc ',
'us':' dni fed isa kids nsn ',
'uy':' com edu gub mil net org ',
've':' co com edu gob info mil net org web ',
'vi':' co com k12 net org ',
'vn':' ac biz com edu gov health info int name net org pro ',
'ye':' co com gov ltd me net org plc ',
'yu':' ac co edu gov org ',
'za':' ac agric alt bourse city co cybernet db edu gov grondar iaccess imt inca landesign law mil net ngo nis nom olivetti org pix school tm web ',
'zm':' ac co com edu gov net org sch '
},
// gorhill 2013-10-25: Using indexOf() instead Regexp(). Significant boost
// in both performance and memory footprint. No initialization required.
// http://jsperf.com/uri-js-sld-regex-vs-binary-search/4
// Following methods use lastIndexOf() rather than array.split() in order
// to avoid any memory allocations.
has: function(domain) {
var tldOffset = domain.lastIndexOf('.');
if (tldOffset <= 0 || tldOffset >= (domain.length-1)) {
return false;
}
var sldOffset = domain.lastIndexOf('.', tldOffset-1);
if (sldOffset <= 0 || sldOffset >= (tldOffset-1)) {
return false;
}
var sldList = SLD.list[domain.slice(tldOffset+1)];
if (!sldList) {
return false;
}
return sldList.indexOf(' ' + domain.slice(sldOffset+1, tldOffset) + ' ') >= 0;
},
is: function(domain) {
var tldOffset = domain.lastIndexOf('.');
if (tldOffset <= 0 || tldOffset >= (domain.length-1)) {
return false;
}
var sldOffset = domain.lastIndexOf('.', tldOffset-1);
if (sldOffset >= 0) {
return false;
}
var sldList = SLD.list[domain.slice(tldOffset+1)];
if (!sldList) {
return false;
}
return sldList.indexOf(' ' + domain.slice(0, tldOffset) + ' ') >= 0;
},
get: function(domain) {
var tldOffset = domain.lastIndexOf('.');
if (tldOffset <= 0 || tldOffset >= (domain.length-1)) {
return null;
}
var sldOffset = domain.lastIndexOf('.', tldOffset-1);
if (sldOffset <= 0 || sldOffset >= (tldOffset-1)) {
return null;
}
var sldList = SLD.list[domain.slice(tldOffset+1)];
if (!sldList) {
return null;
}
if (sldList.indexOf(' ' + domain.slice(sldOffset+1, tldOffset) + ' ') < 0) {
return null;
}
return domain.slice(sldOffset+1);
},
noConflict: function(){
if (root.SecondLevelDomains === this) {
root.SecondLevelDomains = _SecondLevelDomains;
}
return this;
}
};
return SLD;
}));
/*
* Extending URI.js for fragment abuse
*/
// --------------------------------------------------------------------------------
// EXAMPLE: storing application/x-www-form-urlencoded data in the fragment
// possibly helpful for Google's hashbangs
// see http://code.google.com/web/ajaxcrawling/
// --------------------------------------------------------------------------------
// Note: make sure this is the last file loaded!
// USAGE:
// var uri = URI("http://example.org/#?foo=bar");
// uri.fragment(true) === {foo: "bar"};
// uri.fragment({bar: "foo"});
// uri.toString() === "http://example.org/#?bar=foo";
// uri.addFragment("name", "value");
// uri.toString() === "http://example.org/#?bar=foo&name=value";
// uri.removeFragment("name");
// uri.toString() === "http://example.org/#?bar=foo";
(function (root, factory) {
'use strict';
// https://github.com/umdjs/umd/blob/master/returnExports.js
if (typeof exports === 'object') {
// Node
module.exports = factory(require('./URI'));
} else if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['./URI'], factory);
} else {
// Browser globals (root is window)
factory(root.URI);
}
}(this, function (URI) {
'use strict';
var p = URI.prototype;
// old fragment handler we need to wrap
var f = p.fragment;
// make fragmentPrefix configurable
URI.fragmentPrefix = '?';
var _parts = URI._parts;
URI._parts = function() {
var parts = _parts();
parts.fragmentPrefix = URI.fragmentPrefix;
return parts;
};
p.fragmentPrefix = function(v) {
this._parts.fragmentPrefix = v;
return this;
};
// add fragment(true) and fragment({key: value}) signatures
p.fragment = function(v, build) {
var prefix = this._parts.fragmentPrefix;
var fragment = this._parts.fragment || '';
if (v === true) {
if (fragment.substring(0, prefix.length) !== prefix) {
return {};
}
return URI.parseQuery(fragment.substring(prefix.length));
} else if (v !== undefined && typeof v !== 'string') {
this._parts.fragment = prefix + URI.buildQuery(v);
this.build(!build);
return this;
} else {
return f.call(this, v, build);
}
};
p.addFragment = function(name, value, build) {
var prefix = this._parts.fragmentPrefix;
var data = URI.parseQuery((this._parts.fragment || '').substring(prefix.length));
URI.addQuery(data, name, value);
this._parts.fragment = prefix + URI.buildQuery(data);
if (typeof name !== 'string') {
build = value;
}
this.build(!build);
return this;
};
p.removeFragment = function(name, value, build) {
var prefix = this._parts.fragmentPrefix;
var data = URI.parseQuery((this._parts.fragment || '').substring(prefix.length));
URI.removeQuery(data, name, value);
this._parts.fragment = prefix + URI.buildQuery(data);
if (typeof name !== 'string') {
build = value;
}
this.build(!build);
return this;
};
p.addHash = p.addFragment;
p.removeHash = p.removeFragment;
// extending existing object rather than defining something new
return URI;
}));
\ No newline at end of file
/*
* Extending URI.js for fragment abuse
*/
// --------------------------------------------------------------------------------
// EXAMPLE: storing a relative URL in the fragment ("FragmentURI")
// possibly helpful when working with backbone.js or sammy.js
// inspired by https://github.com/medialize/URI.js/pull/2
// --------------------------------------------------------------------------------
// Note: make sure this is the last file loaded!
// USAGE:
// var uri = URI("http://example.org/#!/foo/bar/baz.html");
// var furi = uri.fragment(true);
// furi.pathname() === '/foo/bar/baz.html';
// furi.pathname('/hello.html');
// uri.toString() === "http://example.org/#!/hello.html"
(function (root, factory) {
'use strict';
// https://github.com/umdjs/umd/blob/master/returnExports.js
if (typeof exports === 'object') {
// Node
module.exports = factory(require('./URI'));
} else if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['./URI'], factory);
} else {
// Browser globals (root is window)
factory(root.URI);
}
}(this, function (URI) {
'use strict';
var p = URI.prototype;
// old handlers we need to wrap
var f = p.fragment;
var b = p.build;
// make fragmentPrefix configurable
URI.fragmentPrefix = '!';
var _parts = URI._parts;
URI._parts = function() {
var parts = _parts();
parts.fragmentPrefix = URI.fragmentPrefix;
return parts;
};
p.fragmentPrefix = function(v) {
this._parts.fragmentPrefix = v;
return this;
};
// add fragment(true) and fragment(URI) signatures
p.fragment = function(v, build) {
var prefix = this._parts.fragmentPrefix;
var fragment = this._parts.fragment || '';
var furi;
if (v === true) {
if (fragment.substring(0, prefix.length) !== prefix) {
furi = URI('');
} else {
furi = new URI(fragment.substring(prefix.length));
}
this._fragmentURI = furi;
furi._parentURI = this;
return furi;
} else if (v !== undefined && typeof v !== 'string') {
this._fragmentURI = v;
v._parentURI = v;
this._parts.fragment = prefix + v.toString();
this.build(!build);
return this;
} else if (typeof v === 'string') {
this._fragmentURI = undefined;
}
return f.call(this, v, build);
};
// make .build() of the actual URI aware of the FragmentURI
p.build = function(deferBuild) {
var t = b.call(this, deferBuild);
if (deferBuild !== false && this._parentURI) {
// update the parent
this._parentURI.fragment(this);
}
return t;
};
// extending existing object rather than defining something new
return URI;
}));
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment