");
+ var storage = document.createDocumentFragment();
+ for (var i = 0; i < self.count; i++) {
+ var newdot = dot.clone().attr("data-ur-state", i == self.itemIndex ? "active" : "inactive");
+ storage.appendChild(newdot[0]);
+ }
+ $(self.dots).append(storage);
+ }
+ }
+ }
+
+ self.update = function() {
+ var oldCount = $items.length;
+ $items = $(self.scroller).find("[data-ur-carousel-component='item']");
+ if (oldCount != $items.length) {
+ self.items = $items.filter(":not([data-ur-clone])").toArray();
+ self.count = self.items.length;
+ lastIndex = $items.length - 1;
+
+ $items.each(function(i, obj) {
+ if ($(obj).attr("data-ur-state") == "active") {
+ self.itemIndex = i;
+ return false;
+ }
+ });
+
+ // in case the previous active item was removed
+ if (self.itemIndex >= $items.length - self.options.cloneLength) {
+ self.itemIndex = lastIndex - self.options.cloneLength;
+ $items.eq(self.itemIndex).attr("data-ur-state", "active");
+ }
+
+ // in the rare case the destination element was (re)moved
+ if (!$.contains(self.scroller, dest))
+ dest = $items[self.itemIndex];
+
+ updateDots();
+ updateIndex(self.options.center ? self.itemIndex + self.options.cloneLength : self.itemIndex);
+ }
+
+ viewport = $container.outerWidth();
+ // Adjust the container to be the necessary width.
+ var totalWidth = 0;
+
+ // pixel-perfect division, slightly inefficient?
+ var divisions = [];
+ if (self.options.fill > 0) {
+ var remainder = viewport;
+ for (var i = self.options.fill; i > 0; i--) {
+ var length = Math.round(remainder/i);
+ divisions.push(length);
+ remainder -= length;
+ }
+ }
+
+ allItemsWidth = 0;
+ for (var i = 0; i < $items.length; i++) {
+ if (self.options.fill > 0) {
+ var length = divisions[i % self.options.fill];
+ var item = $items.eq(i);
+ // set outerWidth regardless of box-sizing
+ item.css("width", length + parseInt(item.css("width")) - item.outerWidth()); // could add true param if margins allowed
+ totalWidth += length;
+ }
+ else
+ totalWidth += width($items[i]);
+
+ if (i <= lastIndex - self.options.cloneLength && i >= (self.options.center ? self.options.cloneLength : 0))
+ allItemsWidth += width($items[i]);
+ }
+
+ $(self.scroller).width(totalWidth);
+
+ var currentItem = $items[self.itemIndex];
+ var newTranslate = -(offsetFront(currentItem) + shift * width(currentItem));
+ destinationOffset = -offsetFront(dest);
+ if (self.options.center) {
+ newTranslate += centerOffset(currentItem);
+ destinationOffset += centerOffset(dest);
+ }
+ translateX(newTranslate);
+ };
+
+ self.autoscrollStart = function() {
+ if (!self.options.autoscroll)
+ return;
+
+ autoscrollId = setTimeout(function() {
+ if (viewport != 0) {
+ if (!self.options.infinite && self.itemIndex == lastIndex && self.options.autoscrollForward)
+ self.jumpToIndex(0);
+ else if (!self.options.infinite && self.itemIndex == 0 && !self.options.autoscrollForward)
+ self.jumpToIndex(lastIndex);
+ else
+ moveTo(self.options.autoscrollForward ? -1 : 1);
+ }
+ else
+ self.autoscrollStart();
+ }, self.options.autoscrollDelay);
+ };
+
+ self.autoscrollStop = function() {
+ clearTimeout(autoscrollId);
+ };
+
+ function updateButtons() {
+ if (self.options.infinite)
+ $([self.button.prev, self.button.next]).attr("data-ur-state", "enabled");
+ else {
+ $(self.button.prev).attr("data-ur-state", self.itemIndex == 0 ? "disabled" : "enabled");
+ $(self.button.next).attr("data-ur-state", self.itemIndex == self.count - Math.max(self.options.fill, 1) ? "disabled" : "enabled");
+ }
+ }
+
+ // execute side effects of new index
+ function updateIndex(newIndex) {
+ if (newIndex === undefined)
+ return;
+
+ self.itemIndex = newIndex;
+ if (self.itemIndex < 0)
+ self.itemIndex = 0;
+ else if (self.itemIndex > lastIndex)
+ self.itemIndex = lastIndex;
+
+ var realIndex = self.itemIndex;
+ if (self.options.infinite && self.options.center)
+ realIndex = self.itemIndex - self.options.cloneLength;
+ realIndex = realIndex % self.count;
+ $(self.counter).html(function() {
+ var template = $(this).attr("data-ur-template") || "{{index}} of {{count}}";
+ return template.replace("{{index}}", realIndex + 1).replace("{{count}}", self.count);
+ });
+
+ $items.attr("data-ur-state", "inactive");
+ $items.eq(self.itemIndex % self.count).attr("data-ur-state", "active");
+
+ $(self.dots).find("[data-ur-carousel-component='dot']").attr("data-ur-state", "inactive").eq(realIndex).attr("data-ur-state", "active");
+
+ updateButtons();
+ }
+
+ function startSwipe(e) {
+ if (!self.options.verticalScroll)
+ stifle(e);
+ self.autoscrollStop();
+
+ self.flag.touched = true;
+ self.flag.lock = null;
+ self.flag.click = true;
+
+ coords = getEventCoords(e);
+
+ startCoords = prevCoords = coords;
+ startingOffset = getTranslateX();
+ }
+
+ function continueSwipe(e) {
+ if (!self.flag.touched) // for non-touch environments since mousemove fires without mousedown
+ return;
+
+ prevCoords = coords;
+ coords = getEventCoords(e);
+
+ if (Math.abs(startCoords.y - coords.y) + Math.abs(startCoords.x - coords.x) > 0)
+ self.flag.click = false;
+
+ if (touchscreen && self.options.verticalScroll) {
+ var slope = Math.abs((startCoords.y - coords.y)/(startCoords.x - coords.x));
+ if (self.flag.lock) {
+ if (self.flag.lock == "y")
+ return;
+ }
+ else if (slope > 1.2) {
+ self.flag.lock = "y";
+ return;
+ }
+ else if (slope <= 1.2)
+ self.flag.lock = "x";
+ else
+ return;
+ }
+
+ stifle(e);
+
+ if (coords !== null) {
+ var dist = startingOffset + swipeDist(startCoords, coords); // new translate() value, usually negative
+
+ var threshold = -dist;
+ if (self.options.center)
+ threshold += viewport/2;
+ $items.each(function(i, item) {
+ var boundStart = offsetFront(item);
+ var boundEnd = boundStart + width(item);
+ if (boundEnd > threshold) {
+ self.itemIndex = i;
+ shift = (threshold - boundStart)/width(item);
+ if (self.options.center)
+ shift -= 0.5;
+ return false;
+ }
+ });
+
+ if (self.options.infinite) {
+ if (self.options.center) {
+ if (self.itemIndex < self.options.cloneLength) { // at the start of carousel so loop to end
+ startingOffset -= allItemsWidth;
+ dist -= allItemsWidth;
+ self.itemIndex += self.count;
+ }
+ else if (self.itemIndex >= self.count + self.options.cloneLength) { // at the end of carousel so loop to start
+ startingOffset += allItemsWidth;
+ dist += allItemsWidth;
+ self.itemIndex -= self.count;
+ }
+ }
+ else {
+ if (shift < 0) { // at the start of carousel so loop to end
+ startingOffset -= allItemsWidth;
+ dist -= allItemsWidth;
+ self.itemIndex += self.count;
+ var item = $items[self.itemIndex];
+ shift = (-dist - offsetFront(item))/width(item);
+ }
+ else if (self.itemIndex >= self.count) { // at the end of carousel so loop to start
+ var offset = offsetFront($items[self.count]) - offsetFront($items[0]); // length of all original items
+ startingOffset += offset;
+ dist += offset;
+ self.itemIndex -= self.count;
+ }
+ }
+ }
+
+ translateX(dist);
+ }
+
+ }
+
+ function finishSwipe(e) {
+ if (!self.flag.touched) // for non-touch environments since mouseup fires without mousedown
+ return;
+
+ if (!self.flag.click || self.flag.lock)
+ stifle(e);
+ else if (e.target.tagName == "AREA")
+ location.href = e.target.href;
+
+ self.flag.touched = false;
+
+ var dir = coords.x - prevCoords.x;
+ if (self.options.center) {
+ if (dir < 0 && shift > 0)
+ moveTo(-1)
+ else if (dir > 0 && shift < 0)
+ moveTo(1);
+ else
+ moveTo(0);
+ }
+ else
+ moveTo(dir < 0 ? -1: 0);
+ }
+
+ function moveTo(direction) {
+ self.autoscrollStop();
+
+ // in case prev/next buttons are being spammed
+ clearTimeout(momentumId);
+
+ var newIndex = self.itemIndex - direction;
+ if (!self.options.infinite) {
+ if (self.options.fill > 0)
+ newIndex = bound(newIndex, [0, self.count - self.options.fill]);
+ else
+ newIndex = bound(newIndex, [0, lastIndex]);
+ }
+
+ // when snapping to clone, prepare to snap back to original element
+ if (self.options.infinite) {
+ var transform = getTranslateX();
+ if (self.options.center) {
+ if (newIndex < self.options.cloneLength) { // clone at start of carousel so loop to back
+ translateX(transform - allItemsWidth);
+ newIndex += self.count;
+ self.itemIndex = newIndex + direction;
+ }
+ else if (newIndex >= self.count + self.options.cloneLength) { // clone at end of carousel so loop to front
+ translateX(transform + allItemsWidth);
+ newIndex -= self.count;
+ self.itemIndex = newIndex + direction;
+ }
+
+ }
+ else {
+ if (newIndex < 0) { // at start of carousel so loop to back
+ translateX(transform - allItemsWidth);
+ newIndex += self.count;
+ self.itemIndex = newIndex + direction;
+ }
+ else if (newIndex > self.count) { // clone at end of carousel so loop to start
+ translateX(transform + allItemsWidth);
+ newIndex -= self.count;
+ self.itemIndex = newIndex + direction;
+ }
+
+ }
+ }
+
+ dest = $items[newIndex];
+ $container.triggerHandler("slidestart", {index: newIndex});
+
+ // timeout needed for mobile safari
+ setTimeout(function() {
+ snapTo();
+ updateIndex(newIndex);
+ }, 0);
+ }
+
+ function snapTo() {
+ destinationOffset = -offsetFront(dest);
+ if (self.options.center)
+ destinationOffset += centerOffset(dest);
+
+ function momentum() {
+ // in case user touched in the middle of snapping
+ if (self.flag.touched)
+ return;
+
+ var translate = getTranslateX();
+ var distance = destinationOffset - translate;
+ var delta = distance - zeroFloor(distance / self.options.speed);
+
+ // Hacky -- this is for the desktop browser only -- to fix rounding errors
+ // Ideally, this is removed at compile time
+ if(Math.abs(delta) < 0.01)
+ delta = 0;
+
+ var newTransform = translate + delta;
+ translateX(newTransform);
+
+ self.flag.snapping = delta != 0;
+ if (self.flag.snapping)
+ momentumId = setTimeout(momentum, 16);
+ else
+ endSnap();
+ }
+
+ momentum();
+ }
+
+ function endSnap() {
+ // infinite, non-centered carousels when swiping from last item back to first can't switch early in moveTo() since no clones at front
+ if (self.options.infinite && !self.options.center && self.itemIndex >= self.count) {
+ translateX(getTranslateX() + allItemsWidth);
+ self.itemIndex -= self.count;
+ }
+ shift = 0;
+ self.flag.click = true;
+ self.autoscrollStart();
+ $container.triggerHandler("slideend", {index: self.itemIndex});
+ }
+
+ self.jumpToIndex = function(index) {
+ moveTo(self.itemIndex - index);
+ };
+
+ // could be end.y - start.y if vertical option implemented
+ function swipeDist(start, end) {
+ return end.x - start.x;
+ }
+
+ function translateX(x) {
+ self.translate = x;
+ var css = translatePrefix + x + "px, 0px" + translateSuffix;
+ $(self.scroller).css({webkitTransform: css, MozTransform: css, msTransform: css, transform: css});
+ }
+
+ function getTranslateX() {
+ return self.translate;
+ }
+
+ // could possibly be $(item).outerWidth(true) if margins are allowed
+ function width(item) {
+ return item.offsetWidth;
+ }
+
+ // .offsetLeft/Top, could includ margin as "part" of the element with - parseInt($(item).css("marginLeft"))
+ function offsetFront(item) {
+ return item.offsetLeft;
+ }
+
+ // offset needed to center element, round since subpixel translation makes images blurry
+ function centerOffset(item) {
+ return Math.floor((viewport - width(item))/2);
+ }
+
+ readAttributes();
+
+ // delay initialization until we can figure out number of clones
+ var zeroWidth = false;
+ if (self.options.infinite && !self.options.fill && self.options.cloneLength == 0) {
+ $items.width(function(i, width) {
+ if (width == 0)
+ zeroWidth = true;
+ });
+ }
+ if (zeroWidth) {
+ // wait until (late-loaded) images are loaded or other content inserted
+ console.warn("carousel with id: " + self.urId + " will be late loaded");
+ var imgs = $items.find("img").addBack("img");
+ var numImgs = imgs.length;
+ if (numImgs > 0)
+ imgs.on("load.ur.carousel", function() {
+ if (--numImgs == 0)
+ initialize();
+ });
+ else
+ $(window).on("load.ur.carousel", initialize);
+ }
+ else
+ initialize();
+
+ }
+};
+
+window.Uranium = {lib: interactions};
+$.each(interactions, function(name) {
+ Uranium[name] = {};
+});
+
+$.fn.Uranium = function() {
+ var jqObj = this;
+ $.each(interactions, function() {
+ this(jqObj);
+ });
+ return this;
+};
+
+$(document).ready($(document).Uranium);
+
+})(jQuery);
diff --git a/examples/scss/drawer.scss b/examples/scss/drawer.scss
new file mode 100644
index 0000000..344761d
--- /dev/null
+++ b/examples/scss/drawer.scss
@@ -0,0 +1,49 @@
+@import "compass";
+#wrapper {
+ display: -webkit-box !important;
+ display: -webkit-flex !important;
+ display: flex !important;
+ overflow-x: hidden;
+ &[data-ur-state="enabled"] {
+ #menu {
+ @include transform(translate3d(100%, 0, 0));
+ }
+ #page {
+ @include transform(translate3d(50%, 0, 0));
+ }
+ }
+}
+#menu, #page {
+ @include transform(translate3d(0, 0, 0));
+ @include transition(0.3s);
+ width: 0;
+}
+
+#menu {
+ -webkit-box-flex: 1;
+ -webkit-flex: 1;
+ flex: 1;
+ margin-left: -50%;
+ &:not([data-ur-state="enabled"]) {
+ height: 0;
+ }
+}
+#page {
+ -webkit-box-flex: 2;
+ -webkit-flex: 2;
+ flex: 2;
+}
+
+#mask {
+ background: rgba(0, 0, 0, 0.3);
+ content: "";
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ &:not([data-ur-state="enabled"]) {
+ display: none;
+ }
+}
+
diff --git a/examples/scss/test.scss b/examples/scss/test.scss
new file mode 100644
index 0000000..7e6fe4e
--- /dev/null
+++ b/examples/scss/test.scss
@@ -0,0 +1,213 @@
+@import "compass";
+/* Structure */
+
+ /* Togglers */
+ [data-ur-set="toggler"] [data-ur-toggler-component="button"] {
+ cursor: pointer ;
+ }
+ [data-ur-set="toggler"] [data-ur-toggler-component="content"]{
+ &[data-ur-collapsible='enabled'] {
+ height: 0;
+ display: none;
+ opacity: 1;
+ @include transition(height 0.3s linear, opacity 0.1s ease, margin 0.1s linear);
+ }
+ &[data-ur-state="enabled"] {
+ display: block;
+ &[data-ur-collapsible='enabled'] {
+ @include transition(height 0.3s linear, opacity 0.1s 0.2s ease, margin 0.1s 0.2s linear);
+ }
+ }
+ &[data-ur-state="disabled"] {
+ display: none;
+ &[data-ur-collapsible='enabled'] {
+ opacity: 0;
+ display: block;
+ margin: 0;
+ overflow: hidden;
+ }
+ }
+ }
+
+ /* Tabs */
+ [data-ur-set="tabs"] {
+ [data-ur-tabs-component="content"] {
+ display:none;
+ &[data-ur-state="enabled"] {
+ display:block;
+ }
+ }
+ [data-ur-tabs-component="button"] {
+ cursor: pointer ;
+ opacity: 0.5;
+ }
+ &:not([data-ur-closeable="true"]) [data-ur-tabs-component="button"][data-ur-state="enabled"] {
+ cursor: default ;
+ opacity: 1.0;
+ }
+ }
+
+ /* Input Clear */
+ [data-ur-set="input-clear"] {
+ position: relative;
+ }
+
+ /* Zoom */
+ [data-ur-zoom-component="view_container"] {
+ overflow: hidden;
+ display: inline-block;
+ position: relative;
+ }
+ [data-ur-state="enabled-in"] [data-ur-zoom-component],
+ [data-ur-state="enabled-out"] [data-ur-zoom-component] {
+ -webkit-transition-duration: 0.4s;
+ -moz-transition-duration: 0.4s;
+ -ms-transition-duration: 0.4s;
+ -o-transition-duration: 0.4s;
+ transition-duration: 0.4s;
+ -webkit-transition-property: -webkit-transform;
+ -moz-transition-property: -moz-transform;
+ -ms-transition-property: -ms-transform;
+ -o-transition-property: -o-transform;
+ transition-property: transform;
+ -webkit-transition-timing-function: ease-in-out;
+ -moz-transition-timing-function: ease-in-out;
+ -ms-transition-timing-function: ease-in-out;
+ -o-transition-timing-function: ease-in-out;
+ transition-timing-function: ease-in-out;
+ }
+ [data-ur-zoom-component="loading"][data-ur-state="disabled"] {
+ display: none;
+ }
+ [data-ur-zoom-component="button"] {
+ position: absolute;
+ z-index: 1000;
+ span:last-child {
+ display: none;
+ }
+ &[data-ur-state="enabled"] {
+ span:first-child {
+ display: none;
+ }
+ span:last-child {
+ display: inline;
+ }
+ }
+ }
+
+ /* Carousel */
+ [data-ur-carousel-component="view_container"] {
+ overflow-x: hidden;
+ cursor: pointer;
+ }
+ [data-ur-carousel-component="scroll_container"] > * {
+ display: inline-block;
+ float: left;
+ }
+ [data-ur-carousel-component="button"][data-ur-state="disabled"] {
+ opacity: 0.3;
+ }
+
+/* Appearance */
+
+ /* Tabs */
+ [data-ur-set="tabs"] {
+ margin-bottom: 15px;
+ span {
+ padding: 10px;
+ border: 1px solid black;
+ display: inline-block;
+ border-bottom: 0px;
+ }
+ &[data-ur-closeable="true"] span {
+ border: 1px solid black;
+ display: block;
+ }
+ div {
+ padding: 10px;
+ border: 1px solid red;
+ }
+ }
+
+
+ /* Input Clear */
+ [data-ur-set="input-clear"] {
+ input[data-ur-input-clear-component="input"] {
+ width: 100%;
+ min-height: 30px;
+ position: relative;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ }
+ .data-ur-input-clear-ex {
+ position: absolute;
+ display: none;
+ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAKQ2lDQ1BJQ0MgcHJvZmlsZQAAeNqdU3dYk/cWPt/3ZQ9WQtjwsZdsgQAiI6wIyBBZohCSAGGEEBJAxYWIClYUFRGcSFXEgtUKSJ2I4qAouGdBiohai1VcOO4f3Ke1fXrv7e371/u855zn/M55zw+AERImkeaiagA5UoU8Otgfj09IxMm9gAIVSOAEIBDmy8JnBcUAAPADeXh+dLA//AGvbwACAHDVLiQSx+H/g7pQJlcAIJEA4CIS5wsBkFIAyC5UyBQAyBgAsFOzZAoAlAAAbHl8QiIAqg0A7PRJPgUA2KmT3BcA2KIcqQgAjQEAmShHJAJAuwBgVYFSLALAwgCgrEAiLgTArgGAWbYyRwKAvQUAdo5YkA9AYACAmUIszAAgOAIAQx4TzQMgTAOgMNK/4KlfcIW4SAEAwMuVzZdL0jMUuJXQGnfy8ODiIeLCbLFCYRcpEGYJ5CKcl5sjE0jnA0zODAAAGvnRwf44P5Dn5uTh5mbnbO/0xaL+a/BvIj4h8d/+vIwCBAAQTs/v2l/l5dYDcMcBsHW/a6lbANpWAGjf+V0z2wmgWgrQevmLeTj8QB6eoVDIPB0cCgsL7SViob0w44s+/zPhb+CLfvb8QB7+23rwAHGaQJmtwKOD/XFhbnauUo7nywRCMW735yP+x4V//Y4p0eI0sVwsFYrxWIm4UCJNx3m5UpFEIcmV4hLpfzLxH5b9CZN3DQCshk/ATrYHtctswH7uAQKLDljSdgBAfvMtjBoLkQAQZzQyefcAAJO/+Y9AKwEAzZek4wAAvOgYXKiUF0zGCAAARKCBKrBBBwzBFKzADpzBHbzAFwJhBkRADCTAPBBCBuSAHAqhGJZBGVTAOtgEtbADGqARmuEQtMExOA3n4BJcgetwFwZgGJ7CGLyGCQRByAgTYSE6iBFijtgizggXmY4EImFINJKApCDpiBRRIsXIcqQCqUJqkV1II/ItchQ5jVxA+pDbyCAyivyKvEcxlIGyUQPUAnVAuagfGorGoHPRdDQPXYCWomvRGrQePYC2oqfRS+h1dAB9io5jgNExDmaM2WFcjIdFYIlYGibHFmPlWDVWjzVjHVg3dhUbwJ5h7wgkAouAE+wIXoQQwmyCkJBHWExYQ6gl7CO0EroIVwmDhDHCJyKTqE+0JXoS+cR4YjqxkFhGrCbuIR4hniVeJw4TX5NIJA7JkuROCiElkDJJC0lrSNtILaRTpD7SEGmcTCbrkG3J3uQIsoCsIJeRt5APkE+S+8nD5LcUOsWI4kwJoiRSpJQSSjVlP+UEpZ8yQpmgqlHNqZ7UCKqIOp9aSW2gdlAvU4epEzR1miXNmxZDy6Qto9XQmmlnafdoL+l0ugndgx5Fl9CX0mvoB+nn6YP0dwwNhg2Dx0hiKBlrGXsZpxi3GS+ZTKYF05eZyFQw1zIbmWeYD5hvVVgq9ip8FZHKEpU6lVaVfpXnqlRVc1U/1XmqC1SrVQ+rXlZ9pkZVs1DjqQnUFqvVqR1Vu6k2rs5Sd1KPUM9RX6O+X/2C+mMNsoaFRqCGSKNUY7fGGY0hFsYyZfFYQtZyVgPrLGuYTWJbsvnsTHYF+xt2L3tMU0NzqmasZpFmneZxzQEOxrHg8DnZnErOIc4NznstAy0/LbHWaq1mrX6tN9p62r7aYu1y7Rbt69rvdXCdQJ0snfU6bTr3dQm6NrpRuoW623XP6j7TY+t56Qn1yvUO6d3RR/Vt9KP1F+rv1u/RHzcwNAg2kBlsMThj8MyQY+hrmGm40fCE4agRy2i6kcRoo9FJoye4Ju6HZ+M1eBc+ZqxvHGKsNN5l3Gs8YWJpMtukxKTF5L4pzZRrmma60bTTdMzMyCzcrNisyeyOOdWca55hvtm82/yNhaVFnMVKizaLx5balnzLBZZNlvesmFY+VnlW9VbXrEnWXOss623WV2xQG1ebDJs6m8u2qK2brcR2m23fFOIUjynSKfVTbtox7PzsCuya7AbtOfZh9iX2bfbPHcwcEh3WO3Q7fHJ0dcx2bHC866ThNMOpxKnD6VdnG2ehc53zNRemS5DLEpd2lxdTbaeKp26fesuV5RruutK10/Wjm7ub3K3ZbdTdzD3Ffav7TS6bG8ldwz3vQfTw91jicczjnaebp8LzkOcvXnZeWV77vR5Ps5wmntYwbcjbxFvgvct7YDo+PWX6zukDPsY+Ap96n4e+pr4i3z2+I37Wfpl+B/ye+zv6y/2P+L/hefIW8U4FYAHBAeUBvYEagbMDawMfBJkEpQc1BY0FuwYvDD4VQgwJDVkfcpNvwBfyG/ljM9xnLJrRFcoInRVaG/owzCZMHtYRjobPCN8Qfm+m+UzpzLYIiOBHbIi4H2kZmRf5fRQpKjKqLupRtFN0cXT3LNas5Fn7Z72O8Y+pjLk722q2cnZnrGpsUmxj7Ju4gLiquIF4h/hF8ZcSdBMkCe2J5MTYxD2J43MC52yaM5zkmlSWdGOu5dyiuRfm6c7Lnnc8WTVZkHw4hZgSl7I/5YMgQlAvGE/lp25NHRPyhJuFT0W+oo2iUbG3uEo8kuadVpX2ON07fUP6aIZPRnXGMwlPUit5kRmSuSPzTVZE1t6sz9lx2S05lJyUnKNSDWmWtCvXMLcot09mKyuTDeR55m3KG5OHyvfkI/lz89sVbIVM0aO0Uq5QDhZML6greFsYW3i4SL1IWtQz32b+6vkjC4IWfL2QsFC4sLPYuHhZ8eAiv0W7FiOLUxd3LjFdUrpkeGnw0n3LaMuylv1Q4lhSVfJqedzyjlKD0qWlQyuCVzSVqZTJy26u9Fq5YxVhlWRV72qX1VtWfyoXlV+scKyorviwRrjm4ldOX9V89Xlt2treSrfK7etI66Trbqz3Wb+vSr1qQdXQhvANrRvxjeUbX21K3nShemr1js20zcrNAzVhNe1bzLas2/KhNqP2ep1/XctW/a2rt77ZJtrWv913e/MOgx0VO97vlOy8tSt4V2u9RX31btLugt2PGmIbur/mft24R3dPxZ6Pe6V7B/ZF7+tqdG9s3K+/v7IJbVI2jR5IOnDlm4Bv2pvtmne1cFoqDsJB5cEn36Z8e+NQ6KHOw9zDzd+Zf7f1COtIeSvSOr91rC2jbaA9ob3v6IyjnR1eHUe+t/9+7zHjY3XHNY9XnqCdKD3x+eSCk+OnZKeenU4/PdSZ3Hn3TPyZa11RXb1nQ8+ePxd07ky3X/fJ897nj13wvHD0Ivdi2yW3S609rj1HfnD94UivW2/rZffL7Vc8rnT0Tes70e/Tf/pqwNVz1/jXLl2feb3vxuwbt24m3Ry4Jbr1+Hb27Rd3Cu5M3F16j3iv/L7a/eoH+g/qf7T+sWXAbeD4YMBgz8NZD+8OCYee/pT/04fh0kfMR9UjRiONj50fHxsNGr3yZM6T4aeypxPPyn5W/3nrc6vn3/3i+0vPWPzY8Av5i8+/rnmp83Lvq6mvOscjxx+8znk98ab8rc7bfe+477rfx70fmSj8QP5Q89H6Y8en0E/3Pud8/vwv94Tz+4A5JREAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfcAx8WHyF/aorvAAABgUlEQVRIx8WWsXnCQAyFf5smHZR0oUwXynS5EWADsgEbyNqADUKZdB4BbwAbmDIdbJBGzmc7d+eD8BGVZ1nv9PSkU0aiicgjMAMmdnQCalU9pvyfJQRfAwsD8VkNlMAmBpoFAMZAYSCX2AYoVPU8CCQiz8AWmHOd7YGVqh6CQAaya9XhWjsBrg2W9eja/SETX2auoTFvfShuCILFKjoZmbrqyE+lqW7uuXVtqgzZTFWPTUYxdW1VdQk4C9ynZmniCdm6TV3oRqWqvgEY1w1Yh3/zKQMxFgDZAG2dgC3R4DmLCWmWicirOZEK5mnuIbW6PDJa2urZNZlcAUJToxN3sBSgIHU9gQwC1ZeAiMi4TWMiWJ3baA+B1QF17TxgsRg/DRvsARF59xS+IxDzWUSmyv1G0Aigqqqzc24CvAScn4Cp53xq34IPoap++qb3/oaK3v+a3vd4+PJeXxxS+yKhJTpP+ajvVVXVl3PuA3iI1Cy2nKx829D/rlsDCyRWw4sWyG+u+8N6uRUsuAAAAABJRU5ErkJggg==) no-repeat;
+ height: 27px;
+ width: 27px;
+ top: 4px;
+ right: 2px;
+ }
+ }
+
+ /* Zoom */
+ [data-ur-zoom-component="button"] {
+ background: gray;
+ opacity: .6;
+ border-radius: 15px;
+ font-size: 24px;
+ line-height: 30px;
+ bottom: 5px;
+ left: 5px;
+ text-align: center;
+ width: 30px;
+ height: 30px;
+ }
+ [data-ur-zoom-component="img"] {
+ display: block;
+ }
+
+ /* Carousel */
+ [data-ur-carousel-component="view_container"] {
+ background-color: #ffd700;
+ border: 1px solid black;
+ overflow: hidden;
+ position: relative;
+ /*height: 250px; */
+ max-width: 750px;
+ }
+ [data-ur-infinite="enabled"] [data-ur-carousel-component="scroll_container"] {
+ margin: auto;
+/* width: 250px; */
+ }
+ [data-ur-carousel-component="scroll_container"] img {
+ -webkit-user-drag: none;
+ float: left;
+ }
+ [data-ur-carousel-component="button"] {
+ display: inline-block;
+ &[data-ur-state="disabled"] {
+ opacity: 0.3;
+ }
+ }
+ [data-ur-carousel-component="dots"] {
+ float: right;
+ }
+ [data-ur-carousel-component="dot"] {
+ -moz-border-radius: 7px;
+ -webkit-border-radius: 7px;
+ -o-border-radius: 7px;
+ -ms-border-radius: 7px;
+ -khtml-border-radius: 7px;
+ border-radius: 7px;
+ background: black;
+ display: inline-block;
+ margin: 0 5px;
+ opacity: 0.8;
+ width: 10px;
+ height: 10px;
+ &[data-ur-state="inactive"] {
+ opacity: 0.3;
+ }
+ }
diff --git a/examples/site/Gemfile b/examples/site/Gemfile
deleted file mode 100644
index 45f27d0..0000000
--- a/examples/site/Gemfile
+++ /dev/null
@@ -1,6 +0,0 @@
-source "http://gems.moovweb.org"
-
-gem "rake"
-gem "manhattan_uploader", "0.2.24"
-gem "fusion", "0.0.5"
-gem "rdiscount"
\ No newline at end of file
diff --git a/examples/site/Rakefile b/examples/site/Rakefile
deleted file mode 100644
index 38ced4b..0000000
--- a/examples/site/Rakefile
+++ /dev/null
@@ -1,51 +0,0 @@
-task :enrich do
- require 'fusion'
-
- modes = {"pretty-bundles" => Fusion::Quick, "optimized-bundles" => Fusion::Optimized}
- # The old pretty mode would remove comments and auto-indent ... I should add that to fusion
-
- modes.each do |bundle_name, compiler|
- puts "Building (#{bundle_name})"
-
- bundles = File.join(File.expand_path("."),"build/#{bundle_name}.yml")
-
- Fusion::configure({:bundle_file_path => bundles})
- this_compiler = compiler.new
- this_compiler.run
- end
-
-end
-
-task :upload => [:enrich] do
- require 'manhattan_uploader'
- require 'rdiscount'
- require 'erb'
-
- version = File.read("VERSION").strip
- if File.exists? "JENKINS"
- version += "."
- version += File.read("JENKINS").strip
- end
-
- buildf = File.open("BUILD_VERSION", 'w')
- buildf.puts version
- buildf.close
-
- urls = ManhattanUploader.run(File.expand_path("."), "build/src", false)
-
- urls.first =~ /(\d+\.\d+\.\d+)/
-
- raise Exception.new("Could not extract version from url : (#{urls.first})") if $1.nil?
-
- version = $1
-
- latest_page = File.open("build/latest.md.erb").read
- md = ERB.new(latest_page).result(binding)
- latest_page = RDiscount.new(md).to_html
-
- url = ManhattanUploader.upload_file("uranium/latest.html", latest_page)
- puts "Uploaded latest page: #{url[:s3]}"
-
-end
-
-task :default => [:enrich]
diff --git a/examples/site/VERSION b/examples/site/VERSION
deleted file mode 100644
index ceab6e1..0000000
--- a/examples/site/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-0.1
\ No newline at end of file
diff --git a/examples/site/_layouts/default.html b/examples/site/_layouts/default.html
deleted file mode 100644
index e62a0f8..0000000
--- a/examples/site/_layouts/default.html
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
Uranium JS | {{ page.title }}
-
-
-
-
-
-
-
-
-
-
- {{content}}
-
-
-
-
\ No newline at end of file
diff --git a/examples/site/_layouts/geocode-widget-sub.html b/examples/site/_layouts/geocode-widget-sub.html
deleted file mode 100644
index f9761b3..0000000
--- a/examples/site/_layouts/geocode-widget-sub.html
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
Uranium JS | {{ page.title }}
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/site/_layouts/index.html b/examples/site/_layouts/index.html
deleted file mode 100644
index bdb9577..0000000
--- a/examples/site/_layouts/index.html
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
Uranium JS | {{ page.title }}
-
-
-
-
-
-
-
-
- {{content}}
-
-
-
\ No newline at end of file
diff --git a/examples/site/_layouts/map-widget-sub.html b/examples/site/_layouts/map-widget-sub.html
deleted file mode 100644
index 49bd985..0000000
--- a/examples/site/_layouts/map-widget-sub.html
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
Uranium JS | {{ page.title }}
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/site/_layouts/widgets.html b/examples/site/_layouts/widgets.html
deleted file mode 100644
index 8b975a7..0000000
--- a/examples/site/_layouts/widgets.html
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
Uranium JS | {{ page.title }}
-
-
-
-
-
-
-
-
-
- {{content}}
-
-
-
-
\ No newline at end of file
diff --git a/examples/site/attributes_explanation.html b/examples/site/attributes_explanation.html
deleted file mode 100644
index 8f2149c..0000000
--- a/examples/site/attributes_explanation.html
+++ /dev/null
@@ -1,19 +0,0 @@
----
-layout: default
-title: Attribute Explanation
-name: attribute_explanation
----
-
-
Attribute Explanation
-
The attributes for Uranium are kind of long. This can be a pain to work with. This is just
- a page to explain why the attributes are as they are.
-
-
Let's look at the following example from the toggler tutorials:
-
data-ur-toggler-component='button'
-
Take the first bit: data . We use this in the attribute because HTML5 allows custom attributes, but only
- when they're prefixed with data- . So that's why we have the first bit.
-
The next bit of the attribute, ur , is to identify the attribute as a Uranium attribute. Pretty
- self-explanatory.
-
After that, we get into the aspects that define which widget you're using (in our example above, the
- toggler) and what part of the widget you want to define. Pretty easy, really!
-
diff --git a/examples/site/compatibility.html b/examples/site/compatibility.html
deleted file mode 100644
index b14ad10..0000000
--- a/examples/site/compatibility.html
+++ /dev/null
@@ -1,176 +0,0 @@
----
-layout: default
-title: Compatibility
-name: compatibility
-more_selected: selected
----
-
-
Compatibility
-
- Our intention with Uranium is to provide as complete as possible mobile coverage.
-
-
-
- As Uranium is built on xui, there are some issues with IE and BlackBerry. On the xui site , you need to download
- a different version depending on whether you're using IE, BlackBerry, or most other browsers.
-
-
Compatibility Table: Devices
-
-
-
-
-
Compatibility Table: Desktop
-
-
-
Here's a key to what each element in the table means.
-
- P - test passed
- M - mixed results
- F - test failed
- [blank] - not tested
-
-
*For select list on Android LG 2.2.1, the wrong element is getting touch-highlighted
-
\ No newline at end of file
diff --git a/examples/site/download.html b/examples/site/download.html
deleted file mode 100644
index 3597f6a..0000000
--- a/examples/site/download.html
+++ /dev/null
@@ -1,38 +0,0 @@
----
-layout: default
-title: Download
-name: download
-download_selected: selected
----
-
-
Current Version: 0.1.46
-
Download
-
-
Here you can download Uranium for use in a project. Right-click on the appropriate file from the choices below, save it, then add it to your project. Hopefully the names are pretty self-explanatory. The webkit option should work on most browsers (check out the compatibility tables .) The BlackBerry version is for older, non-webkit BlackBerries. Internet Explorer also requires its own version.
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/site/grouping.html b/examples/site/grouping.html
deleted file mode 100644
index fb444b8..0000000
--- a/examples/site/grouping.html
+++ /dev/null
@@ -1,62 +0,0 @@
----
-layout: default
-title: Grouping
-name: grouping
-more_selected: selected
----
-
-
Grouping
-
Sets vs IDs
-
-
In Uranium, we can group widgets in two ways: sets and ids. A set is when the whole
- widget is wrapped in a div (or other tag) with the attribute data-ur-set="widget" .
-
-
An id is where every component of the widget is given a unique id attribute. For example,
- giving the attribute data-ur-toggler-id="unique_id" . So, this is an alternative way to
- group a set of divs.
-
-
It's generally a better practice to use data-ur-set . This allows for better, well-structured
- and hierarchical HTML. However, it isn't possible in all cases to add this attribute. It's
- in these instances we use data-ur-widget-id attributes. They are functionally
- the same - as seen below.
-
-
-
-
- This Toggler Uses IDs
-
-
-
- Thom
- Jonny
- Ed
- Colin
-
-
-
-
- This Toggler Uses a Set
-
-
-
- Mission
- Guerrero
- Valencia
- Dolores
-
-
-
-
-
How Uranium Works
-
-
Uranium searches through the HTML document for the special attributes
- we give to tags. Once it sees the data-ur , it looks for groups of components.
- The set allows it to determine what widget we're defining.
-
-
Next, the javascript looks for ids on a component. If it finds an
- id, it uses this. If it doesn't , it uses the set.
-
-
This is explained visually in the flowchart below.
-
-
-
\ No newline at end of file
diff --git a/examples/site/images/ci-1.png b/examples/site/images/ci-1.png
deleted file mode 100644
index 5069907..0000000
Binary files a/examples/site/images/ci-1.png and /dev/null differ
diff --git a/examples/site/images/ci-2.png b/examples/site/images/ci-2.png
deleted file mode 100644
index 1fcb762..0000000
Binary files a/examples/site/images/ci-2.png and /dev/null differ
diff --git a/examples/site/images/disabled.png b/examples/site/images/disabled.png
deleted file mode 100644
index c0a6622..0000000
Binary files a/examples/site/images/disabled.png and /dev/null differ
diff --git a/examples/site/images/enabled.png b/examples/site/images/enabled.png
deleted file mode 100644
index ab27a15..0000000
Binary files a/examples/site/images/enabled.png and /dev/null differ
diff --git a/examples/site/images/pic1.jpeg b/examples/site/images/pic1.jpeg
deleted file mode 100644
index 8bab06b..0000000
Binary files a/examples/site/images/pic1.jpeg and /dev/null differ
diff --git a/examples/site/images/pic2.jpeg b/examples/site/images/pic2.jpeg
deleted file mode 100644
index dfbf2c8..0000000
Binary files a/examples/site/images/pic2.jpeg and /dev/null differ
diff --git a/examples/site/images/pic3.jpeg b/examples/site/images/pic3.jpeg
deleted file mode 100644
index c34d7e4..0000000
Binary files a/examples/site/images/pic3.jpeg and /dev/null differ
diff --git a/examples/site/images/pic4.jpeg b/examples/site/images/pic4.jpeg
deleted file mode 100644
index c73861c..0000000
Binary files a/examples/site/images/pic4.jpeg and /dev/null differ
diff --git a/examples/site/images/popup.jpeg b/examples/site/images/popup.jpeg
deleted file mode 100644
index 37e0243..0000000
Binary files a/examples/site/images/popup.jpeg and /dev/null differ
diff --git a/examples/site/images/popup2.jpg b/examples/site/images/popup2.jpg
deleted file mode 100644
index df654f0..0000000
Binary files a/examples/site/images/popup2.jpg and /dev/null differ
diff --git a/examples/site/images/sample1.png b/examples/site/images/sample1.png
deleted file mode 100644
index e6ca8ef..0000000
Binary files a/examples/site/images/sample1.png and /dev/null differ
diff --git a/examples/site/images/sample2.png b/examples/site/images/sample2.png
deleted file mode 100644
index f1b8a25..0000000
Binary files a/examples/site/images/sample2.png and /dev/null differ
diff --git a/examples/site/images/sample3.png b/examples/site/images/sample3.png
deleted file mode 100644
index 47add7b..0000000
Binary files a/examples/site/images/sample3.png and /dev/null differ
diff --git a/examples/site/images/sample4.png b/examples/site/images/sample4.png
deleted file mode 100644
index b71780c..0000000
Binary files a/examples/site/images/sample4.png and /dev/null differ
diff --git a/examples/site/images/sample5.png b/examples/site/images/sample5.png
deleted file mode 100644
index 53e918a..0000000
Binary files a/examples/site/images/sample5.png and /dev/null differ
diff --git a/examples/site/images/sample6.png b/examples/site/images/sample6.png
deleted file mode 100644
index a7fe78f..0000000
Binary files a/examples/site/images/sample6.png and /dev/null differ
diff --git a/examples/site/images/sample7.png b/examples/site/images/sample7.png
deleted file mode 100644
index 0c9863b..0000000
Binary files a/examples/site/images/sample7.png and /dev/null differ
diff --git a/examples/site/images/sample8.png b/examples/site/images/sample8.png
deleted file mode 100644
index 5049479..0000000
Binary files a/examples/site/images/sample8.png and /dev/null differ
diff --git a/examples/site/images/uranium_flowchart.png b/examples/site/images/uranium_flowchart.png
deleted file mode 100644
index d1a37ef..0000000
Binary files a/examples/site/images/uranium_flowchart.png and /dev/null differ
diff --git a/examples/site/images/zoom1.JPG b/examples/site/images/zoom1.JPG
deleted file mode 100644
index 1d823e8..0000000
Binary files a/examples/site/images/zoom1.JPG and /dev/null differ
diff --git a/examples/site/images/zoom2.JPG b/examples/site/images/zoom2.JPG
deleted file mode 100644
index b829b93..0000000
Binary files a/examples/site/images/zoom2.JPG and /dev/null differ
diff --git a/examples/site/images/zoom3.JPG b/examples/site/images/zoom3.JPG
deleted file mode 100644
index 7c8a6e0..0000000
Binary files a/examples/site/images/zoom3.JPG and /dev/null differ
diff --git a/examples/site/images/zoom4.JPG b/examples/site/images/zoom4.JPG
deleted file mode 100644
index 5d663e5..0000000
Binary files a/examples/site/images/zoom4.JPG and /dev/null differ
diff --git a/examples/site/index.html b/examples/site/index.html
deleted file mode 100644
index f3f6ee6..0000000
--- a/examples/site/index.html
+++ /dev/null
@@ -1,241 +0,0 @@
----
-layout: index
-title: Home
-name: home
-home_selected: selected
----
-
-
-
-
-
Fast, Lean Web Interaction Library.*for mobile too!
-
-
-
-
-
"The best thing I've seen in a long time!"
-
-
-Otto Frederick Rohwedder*
-
-
-
-
-
-
What is Uranium?
-
- Uranium is a set of widgets - snippets of code that allow you to do neat things on your website.
-
-
-
HOW TO USE:
-
- Give HTML pre-defined attributes
- Include the Uranium library
- ... That's it
-
-
-
- It's seriously that easy. We've put in all the hard work to make awesome widgets that are
- really easy to use.
-
-
- Uranium is perfect for mobile development. Lots of the widgets were made with that in mind. But,
- as you can see by the examples below, they're great on a desktop site too.
-
-
-
-
-
-
Why use Uranium?
-
It's Lightweight
-
- The whole Uranium library is 15 KB zipped! This includes all the widgets and xui .
-
-
-
It's Easy to Use
-
- Uranium requires zero javascript programming on your part.
-
-
*he may not have actually said this, but we think he'd love Uranium anyway.
-
-
-
-
-
-
-
What can Uranium do?
-
-
-
Example
-
-
-
The Code
-
-
-
-
-
-
-
Toggler
-
Click on the button
-
And content appears
-
-
-
-
-
-
-
-
-{% highlight html %}
-
-{% endhighlight %}
-
-
-
-
-
-
-
-
-
Example
-
-
-
The Code
-
-
-
-
-
-
-
-{% highlight html %}
-
-{% endhighlight %}
-
-
-
-
-
-
-
-
-
-
-
Example
-
-
-
The Code
-
-
-
-
-
-
-
Select List
-
- Click on
- a Value
- in this
- List
-
-
-
-
-
Click on
-
a Value
-
in this
-
List
-
-
-
-
-
-
-
-
-
-{% highlight html %}
-
-
- Click on
- a Value
- in this
- List
-
-
- Click on
- a Value
- in this
- List
-
-
-{% endhighlight %}
-
-
-
-
-
-
-
-
-
-
-
Uranium is used by...
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/site/model.html b/examples/site/model.html
deleted file mode 100644
index 5737f19..0000000
--- a/examples/site/model.html
+++ /dev/null
@@ -1,52 +0,0 @@
----
-layout: default
-title: Model
-name: model
-more_selected: selected
----
-
-
Model
-
-
Sets and Components
-
-
Every widget has at its core a set and a series of components. The set is unique for every
- widget: data-ur-set="toggler" for the toggler widget, etc. The set
- attribute should be used to wrap the whole widget.
-
There are usually a few components per widget. For example, a toggler has a button and
- content. Components are designated in the following way: they'll have data-ur-{widget}-component="thing" .
-
Most of the widgets also have some extra properties. For example,
- font resizer has a data-ur-font-resizer-min , which is used to set the minimum font
- size value.
-
-
-
Naming
-
-
The attributes in Uranium are fairly lengthy. This is because we have chosen to follow the
- conventions of HTML5.
-
In HTML4, we weren't allowed to create our own attributes. Only ids, classes and names were really
- accepted. In HTML5, we can — but we have to start every attribute with "data". So that's
- why all Uranium's attributes start with that. After that, it's "ur" — to signify that
- the attribute is for Uranium.
-
After those two, the names of the attributes are quite straight-forward. data-ur-set helps
- define the following set of tags by grouping them into a set (giving the name of the widget as
- a value).
-
-
-
Declarative Javascript
-
-
Uranium works with declarative javascript. What this means is that we give tags in the HTML
- specific attributes. These attributes tell the javascript what to do.
-
Here's a couple of simple examples:
-
- <div data-ur-set='toggler'> </div>
-
-
This attribute tells javascript to treat this div tag as a toggler set.
-
And this:
-
- <span data-ur-toggler-component='button' data-ur-state='enabled'> </span>
-
-
Tells Uranium to treat the span as a toggler button in its enabled state.
-
-
-
-
diff --git a/examples/site/more.html b/examples/site/more.html
deleted file mode 100644
index e9ce52b..0000000
--- a/examples/site/more.html
+++ /dev/null
@@ -1,108 +0,0 @@
----
-layout: default
-title: More
-name: more
-more_selected: selected
----
-
-
The Uranium Philosophy
-
-
-
Philosophy
-
Uranium is lightweight
-
Uranium is only 15KB when zipped.
- This makes it perfect for mobile devices, where minimizing KB is essential. It's also possible
- to make a custom build if you need it to be even lighter.
-
-
- Uranium was made in xui. Xui is a featherweight mobile javascript library that was used to develop Uranium.
- Uranium is bundled with xui to make just one javascript file. This makes it perfect for
- mobile devices, where minimizing the amount of data downloaded is key.
- If you want it even lighter, you can make a custom build yourself.
-
-
-
Uranium is easy to use
-
No javascript knowledge is necessary to use Uranium.
- (Of course, if you do know javascript, it allows you to play around with the widgets.)
-
-
That's right: you don't need to touch a single line of javascript. It uses the
- 'declarative' javascript style, a model that looks for how
- HTML elements are formatted. Then, it constructs all the necessary javascript magic to make those
- elements come to life.
-
-
Uranium is pliable
-
Uranium bundles with xui -- which (we think) provides a great minimal set of convenient
- javascript functions (query, add-listeners, ajax, iterate, etc). With this in mind, Uranium is the
- best of both worlds - its primary purpose is to make it easy to create great widgets UI/UX, but if
- you need to do something fancy, it gives you the tools you need to do so concisely.
-
-
Uranium is not designed for executing logic or site functions
-
Uranium makes the view (your UI/UX) rely on the model (your HTML). The declarative aspect
- is not designed for performing functions. You wouldn't want to add attributes to an element
- to perform some js logic (this is exactly why 'onclicks' should be avoided) - thats what
- events/listeners/callbacks are for.
-
-
-
-
-
Who's Behind Uranium?
-
-
Sean Jezewski
-
-
-
Sean is the lead architect on Uranium - core design and philosophy.. He's the guy to
- go to for most Uranium questions.
-
-
-
-
Hampton Catlin
-
-
-
Hampton helped with the core design and philosophy of Uranium.
-
-
-
-
Jeff Patzer
-
-
-
Jeff created the awesome geocode widget ,
- which allows you to reverse-geocode a user's location. The information gained
- is then used to populate a form.
-
-
-
-
Sam Merry
-
-
-
Sam has also contributed to the select list widget.
-
-
-
-
Aaron Leung
-
-
-
Aaron coded the beautiful thing that is
- font resizer . It pretty much does what you expect: allows you to easily resize text
- at the click of a button.
-
-
-
-
-
-
Want to know more?
-
- Here's more information on the Uranium project. It's not essential for a beginner, but you may
- want to check this stuff out if you become more interested in Uranium.
-
-
-
-
-
-
- Model - general information about the model on which all the widgets are based
- Styling - "lazy" and "proper" styling of widgets
- Grouping - when to use sets and when to use ids
- Compatibility - compatibility of the widgets with various mobile devices
-
-
-
\ No newline at end of file
diff --git a/examples/site/src/uranium-pretty.js b/examples/site/src/uranium-pretty.js
deleted file mode 100644
index 8491471..0000000
--- a/examples/site/src/uranium-pretty.js
+++ /dev/null
@@ -1,4322 +0,0 @@
-(function () {
-/**
- Basics
- ======
-
- xui is available as the global `x$` function. It accepts a CSS selector string or DOM element, or an array of a mix of these, as parameters,
- and returns the xui object. For example:
-
- var header = x$('#header'); // returns the element with id attribute equal to "header".
-
- For more information on CSS selectors, see the [W3C specification](http://www.w3.org/TR/CSS2/selector.html). Please note that there are
- different levels of CSS selector support (Levels 1, 2 and 3) and different browsers support each to different degrees. Be warned!
-
- The functions described in the docs are available on the xui object and often manipulate or retrieve information about the elements in the
- xui collection.
-
-*/
-var undefined,
- xui,
- window = this,
- string = new String('string'), // prevents Goog compiler from removing primative and subsidising out allowing us to compress further
- document = window.document, // obvious really
- simpleExpr = /^#?([\w-]+)$/, // for situations of dire need. Symbian and the such
- idExpr = /^#/,
- tagExpr = /<([\w:]+)/, // so you can create elements on the fly a la x$('
yay ')
- slice = function (e) { return [].slice.call(e, 0); };
- try { var a = slice(document.documentElement.childNodes)[0].nodeType; }
- catch(e){ slice = function (e) { var ret=[]; for (var i=0; e[i]; i++) ret.push(e[i]); return ret; }; }
-
-window.x$ = window.xui = xui = function(q, context) {
- return new xui.fn.find(q, context);
-};
-
-// patch in forEach to help get the size down a little and avoid over the top currying on event.js and dom.js (shortcuts)
-if (! [].forEach) {
- Array.prototype.forEach = function(fn) {
- var len = this.length || 0,
- i = 0,
- that = arguments[1]; // wait, what's that!? awwww rem. here I thought I knew ya!
- // @rem - that that is a hat tip to your thats :)
-
- if (typeof fn == 'function') {
- for (; i < len; i++) {
- fn.call(that, this[i], i, this);
- }
- }
- };
-}
-/*
- * Array Remove - By John Resig (MIT Licensed)
- */
-function removex(array, from, to) {
- var rest = array.slice((to || from) + 1 || array.length);
- array.length = from < 0 ? array.length + from: from;
- return array.push.apply(array, rest);
-}
-
-// converts all CSS style names to DOM style names, i.e. margin-left to marginLeft
-function domstyle(name) {
- return name.replace(/\-[a-z]/g,function(m) { return m[1].toUpperCase(); });
-}
-
-// converts all DOM style names to CSS style names, i.e. marginLeft to margin-left
-function cssstyle(name) {
- return name.replace(/[A-Z]/g, function(m) { return '-'+m.toLowerCase(); })
-}
-
-xui.fn = xui.prototype = {
-
-/**
- extend
- ------
-
- Extends XUI's prototype with the members of another object.
-
- ### syntax ###
-
- xui.extend( object );
-
- ### arguments ###
-
- - object `Object` contains the members that will be added to XUI's prototype.
-
- ### example ###
-
- Given:
-
- var sugar = {
- first: function() { return this[0]; },
- last: function() { return this[this.length - 1]; }
- }
-
- We can extend xui's prototype with members of `sugar` by using `extend`:
-
- xui.extend(sugar);
-
- Now we can use `first` and `last` in all instances of xui:
-
- var f = x$('.button').first();
- var l = x$('.notice').last();
-*/
- extend: function(o) {
- for (var i in o) {
- xui.fn[i] = o[i];
- }
- },
-
-/**
- find
- ----
-
- Find the elements that match a query string. `x$` is an alias for `find`.
-
- ### syntax ###
-
- x$( window ).find( selector, context );
-
- ### arguments ###
-
- - selector `String` is a CSS selector that will query for elements.
- - context `HTMLElement` is the parent element to search from _(optional)_.
-
- ### example ###
-
- Given the following markup:
-
-
-
-
- We can select list items using `find`:
-
- x$('li'); // returns all four list item elements.
- x$('#second').find('li'); // returns list items "three" and "four"
-*/
- find: function(q, context) {
- var ele = [], tempNode;
-
- if (!q) {
- return this;
- } else if (context == undefined && this.length) {
- ele = this.each(function(el) {
- ele = ele.concat(slice(xui(q, el)));
- }).reduce(ele);
- } else {
- context = context || document;
- // fast matching for pure ID selectors and simple element based selectors
- if (typeof q == string) {
- if (simpleExpr.test(q) && context.getElementById && context.getElementsByTagName) {
- ele = idExpr.test(q) ? [context.getElementById(q.substr(1))] : context.getElementsByTagName(q);
- // nuke failed selectors
- if (ele[0] == null) {
- ele = [];
- }
- // match for full html tags to create elements on the go
- } else if (tagExpr.test(q)) {
- tempNode = document.createElement('i');
- tempNode.innerHTML = q;
- slice(tempNode.childNodes).forEach(function (el) {
- ele.push(el);
- });
- } else {
- // one selector, check if Sizzle is available and use it instead of querySelectorAll.
- if (window.Sizzle !== undefined) {
- ele = Sizzle(q, context);
- } else {
- ele = context.querySelectorAll(q);
- }
- }
- // blanket slice
- ele = slice(ele);
- } else if (q instanceof Array) {
- ele = q;
- } else if (q.nodeName || q === window) { // only allows nodes in
- // an element was passed in
- ele = [q];
- } else if (q.toString() == '[object NodeList]' ||
-q.toString() == '[object HTMLCollection]' || typeof q.length == 'number') {
- ele = slice(q);
- }
- }
- // disabling the append style, could be a plugin (found in more/base):
- // xui.fn.add = function (q) { this.elements = this.elements.concat(this.reduce(xui(q).elements)); return this; }
- return this.set(ele);
- },
-
-/**
- set
- ---
-
- Sets the objects in the xui collection.
-
- ### syntax ###
-
- x$( window ).set( array );
-*/
- set: function(elements) {
- var ret = xui();
- ret.cache = slice(this.length ? this : []);
- ret.length = 0;
- [].push.apply(ret, elements);
- return ret;
- },
-
-/**
- reduce
- ------
-
- Reduces the set of elements in the xui object to a unique set.
-
- ### syntax ###
-
- x$( window ).reduce( elements, index );
-
- ### arguments ###
-
- - elements `Array` is an array of elements to reduce _(optional)_.
- - index `Number` is the last array index to include in the reduction. If unspecified, it will reduce all elements _(optional)_.
-*/
- reduce: function(elements, b) {
- var a = [],
- elements = elements || slice(this);
- elements.forEach(function(el) {
- // question the support of [].indexOf in older mobiles (RS will bring up 5800 to test)
- if (a.indexOf(el, 0, b) < 0)
- a.push(el);
- });
-
- return a;
- },
-
-/**
- has
- ---
-
- Returns the elements that match a given CSS selector.
-
- ### syntax ###
-
- x$( window ).has( selector );
-
- ### arguments ###
-
- - selector `String` is a CSS selector that will match all children of the xui collection.
-
- ### example ###
-
- Given:
-
-
-
- We can use `has` to select specific objects:
-
- var divs = x$('div'); // got all three divs.
- var rounded = divs.has('.round'); // got two divs with the class .round
-*/
- has: function(q) {
- var list = xui(q);
- return this.filter(function () {
- var that = this;
- var found = null;
- list.each(function (el) {
- found = (found || el == that);
- });
- return found;
- });
- },
-
-/**
- filter
- ------
-
- Extend XUI with custom filters. This is an interal utility function, but is also useful to developers.
-
- ### syntax ###
-
- x$( window ).filter( fn );
-
- ### arguments ###
-
- - fn `Function` is called for each element in the XUI collection.
-
- // `index` is the array index of the current element
- function( index ) {
- // `this` is the element iterated on
- // return true to add element to new XUI collection
- }
-
- ### example ###
-
- Filter all the `
` elements that are disabled:
-
- x$('input').filter(function(index) {
- return this.checked;
- });
-*/
- filter: function(fn) {
- var elements = [];
- return this.each(function(el, i) {
- if (fn.call(el, i)) elements.push(el);
- }).set(elements);
- },
-
-/**
- not
- ---
-
- The opposite of `has`. It modifies the elements and returns all of the elements that do __not__ match a CSS query.
-
- ### syntax ###
-
- x$( window ).not( selector );
-
- ### arguments ###
-
- - selector `String` a CSS selector for the elements that should __not__ be matched.
-
- ### example ###
-
- Given:
-
-
-
Item one
-
Item two
-
Item three
-
Item four
-
-
- We can use `not` to select objects:
-
- var divs = x$('div'); // got all four divs.
- var notRound = divs.not('.round'); // got two divs with classes .square and .shadow
-*/
- not: function(q) {
- var list = slice(this),
- omittedNodes = xui(q);
- if (!omittedNodes.length) {
- return this;
- }
- return this.filter(function(i) {
- var found;
- omittedNodes.each(function(el) {
- return found = list[i] != el;
- });
- return found;
- });
- },
-
-/**
- each
- ----
-
- Element iterator for an XUI collection.
-
- ### syntax ###
-
- x$( window ).each( fn )
-
- ### arguments ###
-
- - fn `Function` callback that is called once for each element.
-
- // `element` is the current element
- // `index` is the element index in the XUI collection
- // `xui` is the XUI collection.
- function( element, index, xui ) {
- // `this` is the current element
- }
-
- ### example ###
-
- x$('div').each(function(element, index, xui) {
- alert("Here's the " + index + " element: " + element);
- });
-*/
- each: function(fn) {
- // we could compress this by using [].forEach.call - but we wouldn't be able to support
- // fn return false breaking the loop, a feature I quite like.
- for (var i = 0, len = this.length; i < len; ++i) {
- if (fn.call(this[i], this[i], i, this) === false)
- break;
- }
- return this;
- }
-};
-
-xui.fn.find.prototype = xui.fn;
-xui.extend = xui.fn.extend;
-/**
- DOM
- ===
-
- Set of methods for manipulating the Document Object Model (DOM).
-
-*/
-xui.extend({
-/**
- html
- ----
-
- Manipulates HTML in the DOM. Also just returns the inner HTML of elements in the collection if called with no arguments.
-
- ### syntax ###
-
- x$( window ).html( location, html );
-
- or this method will accept just a HTML fragment with a default behavior of inner:
-
- x$( window ).html( html );
-
- or you can use shorthand syntax by using the location name argument as the function name:
-
- x$( window ).outer( html );
- x$( window ).before( html );
-
- or you can just retrieve the inner HTML of elements in the collection with:
-
- x$( document.body ).html();
-
- ### arguments ###
-
- - location `String` can be one of: _inner_, _outer_, _top_, _bottom_, _remove_, _before_ or _after_.
- - html `String` is a string of HTML markup or a `HTMLElement`.
-
- ### example ###
-
- x$('#foo').html('inner', '
rock and roll ');
- x$('#foo').html('outer', '
lock and load
');
- x$('#foo').html('top', '
bangers and mash
');
- x$('#foo').html('bottom','
mean and clean ');
- x$('#foo').html('remove');
- x$('#foo').html('before', '
some warmup html
');
- x$('#foo').html('after', '
more html!
');
-
- or
-
- x$('#foo').html('
sweet as honey
');
- x$('#foo').outer('
free as a bird
');
- x$('#foo').top('
top of the pops ');
- x$('#foo').bottom('
bottom of the barrel ');
- x$('#foo').before('
first in line ');
- x$('#foo').after('
better late than never ');
-*/
- html: function(location, html) {
- clean(this);
-
- if (arguments.length == 0) {
- var i = [];
- this.each(function(el) {
- i.push(el.innerHTML);
- });
- return i;
- }
- if (arguments.length == 1 && arguments[0] != 'remove') {
- html = location;
- location = 'inner';
- }
- if (location != 'remove' && html && html.each !== undefined) {
- if (location == 'inner') {
- var d = document.createElement('p');
- html.each(function(el) {
- d.appendChild(el);
- });
- this.each(function(el) {
- el.innerHTML = d.innerHTML;
- });
- } else {
- var that = this;
- html.each(function(el){
- that.html(location, el);
- });
- }
- return this;
- }
- return this.each(function(el) {
- var parent,
- list,
- len,
- i = 0;
- if (location == "inner") { // .html
- if (typeof html == string || typeof html == "number") {
- el.innerHTML = html;
- list = el.getElementsByTagName('SCRIPT');
- len = list.length;
- for (; i < len; i++) {
- eval(list[i].text);
- }
- } else {
- el.innerHTML = '';
- el.appendChild(html);
- }
- } else {
- if (location == 'remove') {
- el.parentNode.removeChild(el);
- } else {
- var elArray = ['outer', 'top', 'bottom'],
- wrappedE = wrapHelper(html, (elArray.indexOf(location) > -1 ? el : el.parentNode )),
- children = wrappedE.childNodes;
- if (location == "outer") { // .replaceWith
- el.parentNode.replaceChild(wrappedE, el);
- } else if (location == "top") { // .prependTo
- el.insertBefore(wrappedE, el.firstChild);
- } else if (location == "bottom") { // .appendTo
- el.insertBefore(wrappedE, null);
- } else if (location == "before") { // .insertBefore
- el.parentNode.insertBefore(wrappedE, el);
- } else if (location == "after") { // .insertAfter
- el.parentNode.insertBefore(wrappedE, el.nextSibling);
- }
- var parent = wrappedE.parentNode;
- while(children.length) {
- parent.insertBefore(children[0], wrappedE);
- }
- parent.removeChild(wrappedE);
- }
- }
- });
- },
-
-/**
- attr
- ----
-
- Gets or sets attributes on elements. If getting, returns an array of attributes matching the xui element collection's indices.
-
- ### syntax ###
-
- x$( window ).attr( attribute, value );
-
- ### arguments ###
-
- - attribute `String` is the name of HTML attribute to get or set.
- - value `Varies` is the value to set the attribute to. Do not use to get the value of attribute _(optional)_.
-
- ### example ###
-
- To get an attribute value, simply don't provide the optional second parameter:
-
- x$('.someClass').attr('class');
-
- To set an attribute, use both parameters:
-
- x$('.someClass').attr('disabled', 'disabled');
-*/
- attr: function(attribute, val) {
- if (arguments.length == 2) {
- return this.each(function(el) {
- if (el.tagName && el.tagName.toLowerCase() == 'input' && attribute == 'value') el.value = val;
- else if (el.setAttribute) {
- if (attribute == 'checked' && (val == '' || val == false || typeof val == "undefined")) el.removeAttribute(attribute);
- else el.setAttribute(attribute, val);
- }
- });
- } else {
- var attrs = [];
- this.each(function(el) {
- if (el.tagName && el.tagName.toLowerCase() == 'input' && attribute == 'value') attrs.push(el.value);
- else if (el.getAttribute && el.getAttribute(attribute)) {
- attrs.push(el.getAttribute(attribute));
- }
- });
- return attrs;
- }
- }
-});
-"inner outer top bottom remove before after".split(' ').forEach(function (method) {
- xui.fn[method] = function(where) { return function (html) { return this.html(where, html); }; }(method);
-});
-// private method for finding a dom element
-function getTag(el) {
- return (el.firstChild === null) ? {'UL':'LI','DL':'DT','TR':'TD'}[el.tagName] || el.tagName : el.firstChild.tagName;
-}
-
-function wrapHelper(html, el) {
- if (typeof html == string) return wrap(html, getTag(el));
- else { var e = document.createElement('div'); e.appendChild(html); return e; }
-}
-
-// private method
-// Wraps the HTML in a TAG, Tag is optional
-// If the html starts with a Tag, it will wrap the context in that tag.
-function wrap(xhtml, tag) {
- var e = document.createElement('div');
- e.innerHTML = xhtml;
- return e;
-}
-
-/*
-* Removes all erronious nodes from the DOM.
-*
-*/
-function clean(collection) {
- var ns = /\S/;
- collection.each(function(el) {
- var d = el,
- n = d.firstChild,
- ni = -1,
- nx;
- while (n) {
- nx = n.nextSibling;
- if (n.nodeType == 3 && !ns.test(n.nodeValue)) {
- d.removeChild(n);
- } else {
- n.nodeIndex = ++ni; // FIXME not sure what this is for, and causes IE to bomb (the setter) - @rem
- }
- n = nx;
- }
- });
-}
-/**
- Event
- =====
-
- A good old fashioned events with new skool handling. Shortcuts exist for:
-
- - click
- - load
- - touchstart
- - touchmove
- - touchend
- - touchcancel
- - gesturestart
- - gesturechange
- - gestureend
- - orientationchange
-
-*/
-xui.events = {}; var cache = {};
-xui.extend({
-
-/**
- on
- --
-
- Registers a callback function to a DOM event on the element collection.
-
- ### syntax ###
-
- x$( 'button' ).on( type, fn );
-
- or
-
- x$( 'button' ).click( fn );
-
- ### arguments ###
-
- - type `String` is the event to subscribe (e.g. _load_, _click_, _touchstart_, etc).
- - fn `Function` is a callback function to execute when the event is fired.
-
- ### example ###
-
- x$( 'button' ).on( 'click', function(e) {
- alert('hey that tickles!');
- });
-
- or
-
- x$(window).load(function(e) {
- x$('.save').touchstart( function(evt) { alert('tee hee!'); }).css(background:'grey');
- });
-*/
- on: function(type, fn, details) {
- return this.each(function (el) {
- if (xui.events[type]) {
- var id = _getEventID(el),
- responders = _getRespondersForEvent(id, type);
-
- details = details || {};
- details.handler = function (event, data) {
- xui.fn.fire.call(xui(this), type, data);
- };
-
- // trigger the initialiser - only happens the first time around
- if (!responders.length) {
- xui.events[type].call(el, details);
- }
- }
- el.addEventListener(type, _createResponder(el, type, fn), false);
- });
- },
-
-/**
- un
- --
-
- Unregisters a specific callback, or if no specific callback is passed in,
- unregisters all event callbacks of a specific type.
-
- ### syntax ###
-
- Unregister the given function, for the given type, on all button elements:
-
- x$( 'button' ).un( type, fn );
-
- Unregisters all callbacks of the given type, on all button elements:
-
- x$( 'button' ).un( type );
-
- ### arguments ###
-
- - type `String` is the event to unsubscribe (e.g. _load_, _click_, _touchstart_, etc).
- - fn `Function` is the callback function to unsubscribe _(optional)_.
-
- ### example ###
-
- // First, create a click event that display an alert message
- x$('button').on('click', function() {
- alert('hi!');
- });
-
- // Now unsubscribe all functions that response to click on all button elements
- x$('button').un('click');
-
- or
-
- var greeting = function() { alert('yo!'); };
-
- x$('button').on('click', greeting);
- x$('button').on('click', function() {
- alert('hi!');
- });
-
- // When any button is clicked, the 'hi!' message will fire, but not the 'yo!' message.
- x$('button').un('click', greeting);
-*/
- un: function(type, fn) {
- return this.each(function (el) {
- var id = _getEventID(el), responders = _getRespondersForEvent(id, type), i = responders.length;
-
- while (i--) {
- if (fn === undefined || fn.guid === responders[i].guid) {
- el.removeEventListener(type, responders[i], false);
- removex(cache[id][type], i, 1);
- }
- }
-
- if (cache[id][type].length === 0) delete cache[id][type];
- for (var t in cache[id]) {
- return;
- }
- delete cache[id];
- });
- },
-
-/**
- fire
- ----
-
- Triggers a specific event on the xui collection.
-
- ### syntax ###
-
- x$( selector ).fire( type, data );
-
- ### arguments ###
-
- - type `String` is the event to fire (e.g. _load_, _click_, _touchstart_, etc).
- - data `Object` is a JSON object to use as the event's `data` property.
-
- ### example ###
-
- x$('button#reset').fire('click', { died:true });
-
- x$('.target').fire('touchstart');
-*/
- fire: function (type, data) {
- return this.each(function (el) {
- if (el == document && !el.dispatchEvent)
- el = document.documentElement;
-
- var event = document.createEvent('HTMLEvents');
- event.initEvent(type, true, true);
- event.data = data || {};
- event.eventName = type;
-
- el.dispatchEvent(event);
- });
- }
-});
-
-"click load submit touchstart touchmove touchend touchcancel gesturestart gesturechange gestureend orientationchange".split(' ').forEach(function (event) {
- xui.fn[event] = function(action) { return function (fn) { return fn ? this.on(action, fn) : this.fire(action); }; }(event);
-});
-
-// patched orientation support - Andriod 1 doesn't have native onorientationchange events
-xui(window).on('load', function() {
- if (!('onorientationchange' in document.body)) {
- (function (w, h) {
- xui(window).on('resize', function () {
- var portraitSwitch = (window.innerWidth < w && window.innerHeight > h) && (window.innerWidth < window.innerHeight),
- landscapeSwitch = (window.innerWidth > w && window.innerHeight < h) && (window.innerWidth > window.innerHeight);
- if (portraitSwitch || landscapeSwitch) {
- window.orientation = portraitSwitch ? 0 : 90; // what about -90? Some support is better than none
- xui('body').fire('orientationchange'); // will this bubble up?
- w = window.innerWidth;
- h = window.innerHeight;
- }
- });
- })(window.innerWidth, window.innerHeight);
- }
-});
-
-// this doesn't belong on the prototype, it belongs as a property on the xui object
-xui.touch = (function () {
- try{
- return !!(document.createEvent("TouchEvent").initTouchEvent)
- } catch(e) {
- return false;
- };
-})();
-
-/**
- ready
- ----
-
- Event handler for when the DOM is ready. Thank you [domready](http://www.github.com/ded/domready)!
-
- ### syntax ###
-
- x$.ready(handler);
-
- ### arguments ###
-
- - handler `Function` event handler to be attached to the "dom is ready" event.
-
- ### example ###
-
- x$.ready(function() {
- alert('mah doms are ready');
- });
-
- xui.ready(function() {
- console.log('ready, set, go!');
- });
-*/
-xui.ready = function(handler) {
- domReady(handler);
-}
-
-// lifted from Prototype's (big P) event model
-function _getEventID(element) {
- if (element._xuiEventID) return element._xuiEventID;
- return element._xuiEventID = ++_getEventID.id;
-}
-
-_getEventID.id = 1;
-
-function _getRespondersForEvent(id, eventName) {
- var c = cache[id] = cache[id] || {};
- return c[eventName] = c[eventName] || [];
-}
-
-function _createResponder(element, eventName, handler) {
- var id = _getEventID(element), r = _getRespondersForEvent(id, eventName);
-
- var responder = function(event) {
- if (handler.call(element, event) === false) {
- event.preventDefault();
- event.stopPropagation();
- }
- };
-
- responder.guid = handler.guid = handler.guid || ++_getEventID.id;
- responder.handler = handler;
- r.push(responder);
- return responder;
-}
-/**
- Fx
- ==
-
- Animations, transforms, and transitions for getting the most out of hardware accelerated CSS.
-
-*/
-
-xui.extend({
-
-/**
- Tween
- -----
-
- Transforms a CSS property's value.
-
- ### syntax ###
-
- x$( selector ).tween( properties, callback );
-
- ### arguments ###
-
- - properties `Object` or `Array` of CSS properties to tween.
- - `Object` is a JSON object that defines the CSS properties.
- - `Array` is a `Object` set that is tweened sequentially.
- - callback `Function` to be called when the animation is complete. _(optional)_.
-
- ### properties ###
-
- A property can be any CSS style, referenced by the JavaScript notation.
-
- A property can also be an option from [emile.js](https://github.com/madrobby/emile):
-
- - duration `Number` of the animation in milliseconds.
- - after `Function` is called after the animation is finished.
- - easing `Function` allows for the overriding of the built-in animation function.
-
- // Receives one argument `pos` that indicates position
- // in time between animation's start and end.
- function(pos) {
- // return the new position
- return (-Math.cos(pos * Math.PI) / 2) + 0.5;
- }
-
- ### example ###
-
- // one JSON object
- x$('#box').tween({ left:'100px', backgroundColor:'blue' });
- x$('#box').tween({ left:'100px', backgroundColor:'blue' }, function() {
- alert('done!');
- });
-
- // array of two JSON objects
- x$('#box').tween([{left:'100px', backgroundColor:'green', duration:.2 }, { right:'100px' }]);
-*/
- tween: function( props, callback ) {
-
- // creates an options obj for emile
- var emileOpts = function(o) {
- var options = {};
- "duration after easing".split(' ').forEach( function(p) {
- if (props[p]) {
- options[p] = props[p];
- delete props[p];
- }
- });
- return options;
- }
-
- // serialize the properties into a string for emile
- var serialize = function(props) {
- var serialisedProps = [], key;
- if (typeof props != string) {
- for (key in props) {
- serialisedProps.push(cssstyle(key) + ':' + props[key]);
- }
- serialisedProps = serialisedProps.join(';');
- } else {
- serialisedProps = props;
- }
- return serialisedProps;
- };
-
- // queued animations
- /* wtf is this?
- if (props instanceof Array) {
- // animate each passing the next to the last callback to enqueue
- props.forEach(function(a){
-
- });
- }
- */
- // this branch means we're dealing with a single tween
- var opts = emileOpts(props);
- var prop = serialize(props);
-
- return this.each(function(e){
- emile(e, prop, opts, callback);
- });
- }
-});
-/**
- Style
- =====
-
- Everything related to appearance. Usually, this is CSS.
-
-*/
-function hasClass(el, className) {
- return getClassRegEx(className).test(el.className);
-}
-
-// Via jQuery - used to avoid el.className = ' foo';
-// Used for trimming whitespace
-var rtrim = /^(\s|\u00A0)+|(\s|\u00A0)+$/g;
-
-function trim(text) {
- return (text || "").replace( rtrim, "" );
-}
-
-xui.extend({
-/**
- setStyle
- --------
-
- Sets the value of a single CSS property.
-
- ### syntax ###
-
- x$( selector ).setStyle( property, value );
-
- ### arguments ###
-
- - property `String` is the name of the property to modify.
- - value `String` is the new value of the property.
-
- ### example ###
-
- x$('.flash').setStyle('color', '#000');
- x$('.button').setStyle('backgroundColor', '#EFEFEF');
-*/
- setStyle: function(prop, val) {
- prop = domstyle(prop);
- return this.each(function(el) {
- el.style[prop] = val;
- });
- },
-
-/**
- getStyle
- --------
-
- Returns the value of a single CSS property. Can also invoke a callback to perform more specific processing tasks related to the property value.
- Please note that the return type is always an Array of strings. Each string corresponds to the CSS property value for the element with the same index in the xui collection.
-
- ### syntax ###
-
- x$( selector ).getStyle( property, callback );
-
- ### arguments ###
-
- - property `String` is the name of the CSS property to get.
- - callback `Function` is called on each element in the collection and passed the property _(optional)_.
-
- ### example ###
-
-
- x$('ul#nav li.trunk').getStyle('font-size'); // returns ['12px']
- x$('ul#nav li.trunk').getStyle('fontSize'); // returns ['12px']
- x$('ul#nav li').getStyle('font-size'); // returns ['12px', '14px']
-
- x$('ul#nav li.trunk').getStyle('backgroundColor', function(prop) {
- alert(prop); // alerts 'blue'
- });
-*/
- getStyle: function(prop, callback) {
- // shortcut getComputedStyle function
- var s = function(el, p) {
- // this *can* be written to be smaller - see below, but in fact it doesn't compress in gzip as well, the commented
- // out version actually *adds* 2 bytes.
- // return document.defaultView.getComputedStyle(el, "").getPropertyValue(p.replace(/([A-Z])/g, "-$1").toLowerCase());
- return document.defaultView.getComputedStyle(el, "").getPropertyValue(cssstyle(p));
- }
- if (callback === undefined) {
- var styles = [];
- this.each(function(el) {styles.push(s(el, prop))});
- return styles;
- } else return this.each(function(el) { callback(s(el, prop)); });
- },
-
-/**
- addClass
- --------
-
- Adds a class to all of the elements in the collection.
-
- ### syntax ###
-
- x$( selector ).addClass( className );
-
- ### arguments ###
-
- - className `String` is the name of the CSS class to add.
-
- ### example ###
-
- x$('.foo').addClass('awesome');
-*/
- addClass: function(className) {
- var cs = className.split(' ');
- return this.each(function(el) {
- cs.forEach(function(clazz) {
- if (hasClass(el, clazz) === false) {
- el.className = trim(el.className + ' ' + clazz);
- }
- });
- });
- },
-
-/**
- hasClass
- --------
-
- Checks if the class is on _all_ elements in the xui collection.
-
- ### syntax ###
-
- x$( selector ).hasClass( className, fn );
-
- ### arguments ###
-
- - className `String` is the name of the CSS class to find.
- - fn `Function` is a called for each element found and passed the element _(optional)_.
-
- // `element` is the HTMLElement that has the class
- function(element) {
- console.log(element);
- }
-
- ### example ###
-
-
-
-
- // returns true
- x$('#foo').hasClass('awesome');
-
- // returns false (not all elements with class 'foo' have class 'awesome'),
- // but the callback gets invoked with the elements that did match the 'awesome' class
- x$('.foo').hasClass('awesome', function(element) {
- console.log('Hey, I found: ' + element + ' with class "awesome"');
- });
-
- // returns true (all DIV elements have the 'foo' class)
- x$('div').hasClass('foo');
-*/
- hasClass: function(className, callback) {
- var self = this,
- cs = className.split(' ');
- return this.length && (function() {
- var hasIt = true;
- self.each(function(el) {
- cs.forEach(function(clazz) {
- if (hasClass(el, clazz)) {
- if (callback) callback(el);
- } else hasIt = false;
- });
- });
- return hasIt;
- })();
- },
-
-/**
- removeClass
- -----------
-
- Removes the specified class from all elements in the collection. If no class is specified, removes all classes from the collection.
-
- ### syntax ###
-
- x$( selector ).removeClass( className );
-
- ### arguments ###
-
- - className `String` is the name of the CSS class to remove. If not specified, then removes all classes from the matched elements. _(optional)_
-
- ### example ###
-
- x$('.foo').removeClass('awesome');
-*/
- removeClass: function(className) {
- if (className === undefined) this.each(function(el) { el.className = ''; });
- else {
- var cs = className.split(' ');
- this.each(function(el) {
- cs.forEach(function(clazz) {
- el.className = trim(el.className.replace(getClassRegEx(clazz), '$1'));
- });
- });
- }
- return this;
- },
-
-/**
- toggleClass
- -----------
-
- Removes the specified class if it exists on the elements in the xui collection, otherwise adds it.
-
- ### syntax ###
-
- x$( selector ).toggleClass( className );
-
- ### arguments ###
-
- - className `String` is the name of the CSS class to toggle.
-
- ### example ###
-
-
- x$('.foo').toggleClass('awesome'); // div above loses its awesome class.
-*/
- toggleClass: function(className) {
- var cs = className.split(' ');
- return this.each(function(el) {
- cs.forEach(function(clazz) {
- if (hasClass(el, clazz)) el.className = trim(el.className.replace(getClassRegEx(clazz), '$1'));
- else el.className = trim(el.className + ' ' + clazz);
- });
- });
- },
-
-/**
- css
- ---
-
- Set multiple CSS properties at once.
-
- ### syntax ###
-
- x$( selector ).css( properties );
-
- ### arguments ###
-
- - properties `Object` is a JSON object that defines the property name/value pairs to set.
-
- ### example ###
-
- x$('.foo').css({ backgroundColor:'blue', color:'white', border:'2px solid red' });
-*/
- css: function(o) {
- for (var prop in o) {
- this.setStyle(prop, o[prop]);
- }
- return this;
- }
-});
-
-// RS: now that I've moved these out, they'll compress better, however, do these variables
-// need to be instance based - if it's regarding the DOM, I'm guessing it's better they're
-// global within the scope of xui
-
-// -- private methods -- //
-var reClassNameCache = {},
- getClassRegEx = function(className) {
- var re = reClassNameCache[className];
- if (!re) {
- // Preserve any leading whitespace in the match, to be used when removing a class
- re = new RegExp('(^|\\s+)' + className + '(?:\\s+|$)');
- reClassNameCache[className] = re;
- }
- return re;
- };
-/**
- XHR
- ===
-
- Everything related to remote network connections.
-
- */
-xui.extend({
-/**
- xhr
- ---
-
- The classic `XMLHttpRequest` sometimes also known as the Greek hero: _Ajax_. Not to be confused with _AJAX_ the cleaning agent.
-
- ### detail ###
-
- This method has a few new tricks.
-
- It is always invoked on an element collection and uses the behaviour of `html`.
-
- If there is no callback, then the `responseText` will be inserted into the elements in the collection.
-
- ### syntax ###
-
- x$( selector ).xhr( location, url, options )
-
- or accept a url with a default behavior of inner:
-
- x$( selector ).xhr( url, options );
-
- or accept a url with a callback:
-
- x$( selector ).xhr( url, fn );
-
- ### arguments ###
-
- - location `String` is the location to insert the `responseText`. See `html` for values.
- - url `String` is where to send the request.
- - fn `Function` is called on status 200 (i.e. success callback).
- - options `Object` is a JSON object with one or more of the following:
- - method `String` can be _get_, _put_, _delete_, _post_. Default is _get_.
- - async `Boolean` enables an asynchronous request. Defaults to _false_.
- - data `String` is a url encoded string of parameters to send.
- - error `Function` is called on error or status that is not 200. (i.e. failure callback).
- - callback `Function` is called on status 200 (i.e. success callback).
- - headers `Object` is a JSON object with key:value pairs that get set in the request's header set.
-
- ### response ###
-
- - The response is available to the callback function as `this`.
- - The response is not passed into the callback.
- - `this.reponseText` will have the resulting data from the file.
-
- ### example ###
-
- x$('#status').xhr('inner', '/status.html');
- x$('#status').xhr('outer', '/status.html');
- x$('#status').xhr('top', '/status.html');
- x$('#status').xhr('bottom','/status.html');
- x$('#status').xhr('before','/status.html');
- x$('#status').xhr('after', '/status.html');
-
- or
-
- // same as using 'inner'
- x$('#status').xhr('/status.html');
-
- // define a callback, enable async execution and add a request header
- x$('#left-panel').xhr('/panel', {
- async: true,
- callback: function() {
- alert("The response is " + this.responseText);
- },
- headers:{
- 'Mobile':'true'
- }
- });
-
- // define a callback with the shorthand syntax
- x$('#left-panel').xhr('/panel', function() {
- alert("The response is " + this.responseText);
- });
-*/
- xhr:function(location, url, options) {
-
- // this is to keep support for the old syntax (easy as that)
- if (!/^(inner|outer|top|bottom|before|after)$/.test(location)) {
- options = url;
- url = location;
- location = 'inner';
- }
-
- var o = options ? options : {};
-
- if (typeof options == "function") {
- // FIXME kill the console logging
- // console.log('we been passed a func ' + options);
- // console.log(this);
- o = {};
- o.callback = options;
- };
-
- var that = this,
- req = new XMLHttpRequest(),
- method = o.method || 'get',
- async = (typeof o.async != 'undefined'?o.async:true),
- params = o.data || null,
- key;
-
- req.queryString = params;
- req.open(method, url, async);
-
- // Set "X-Requested-With" header
- req.setRequestHeader('X-Requested-With','XMLHttpRequest');
-
- if (method.toLowerCase() == 'post') req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
-
- for (key in o.headers) {
- if (o.headers.hasOwnProperty(key)) {
- req.setRequestHeader(key, o.headers[key]);
- }
- }
-
- req.handleResp = (o.callback != null) ? o.callback : function() { that.html(location, req.responseText); };
- req.handleError = (o.error && typeof o.error == 'function') ? o.error : function () {};
- function hdl(){
- if(req.readyState==4) {
- delete(that.xmlHttpRequest);
- if(req.status===0 || req.status==200) req.handleResp();
- if((/^[45]/).test(req.status)) req.handleError();
- }
- }
- if(async) {
- req.onreadystatechange = hdl;
- this.xmlHttpRequest = req;
- }
- req.send(params);
- if(!async) hdl();
-
- return this;
- }
-});
-// emile.js (c) 2009 Thomas Fuchs
-// Licensed under the terms of the MIT license.
-
-(function(emile, container){
- var parseEl = document.createElement('div'),
- props = ('backgroundColor borderBottomColor borderBottomWidth borderLeftColor borderLeftWidth '+
- 'borderRightColor borderRightWidth borderSpacing borderTopColor borderTopWidth bottom color fontSize '+
- 'fontWeight height left letterSpacing lineHeight marginBottom marginLeft marginRight marginTop maxHeight '+
- 'maxWidth minHeight minWidth opacity outlineColor outlineOffset outlineWidth paddingBottom paddingLeft '+
- 'paddingRight paddingTop right textIndent top width wordSpacing zIndex').split(' ');
-
- function interpolate(source,target,pos){ return (source+(target-source)*pos).toFixed(3); }
- function s(str, p, c){ return str.substr(p,c||1); }
- function color(source,target,pos){
- var i = 2, j, c, tmp, v = [], r = [];
- while(j=3,c=arguments[i-1],i--)
- if(s(c,0)=='r') { c = c.match(/\d+/g); while(j--) v.push(~~c[j]); } else {
- if(c.length==4) c='#'+s(c,1)+s(c,1)+s(c,2)+s(c,2)+s(c,3)+s(c,3);
- while(j--) v.push(parseInt(s(c,1+j*2,2), 16)); }
- while(j--) { tmp = ~~(v[j+3]+(v[j]-v[j+3])*pos); r.push(tmp<0?0:tmp>255?255:tmp); }
- return 'rgb('+r.join(',')+')';
- }
-
- function parse(prop){
- var p = parseFloat(prop), q = prop.replace(/^[\-\d\.]+/,'');
- return isNaN(p) ? { v: q, f: color, u: ''} : { v: p, f: interpolate, u: q };
- }
-
- function normalize(style){
- var css, rules = {}, i = props.length, v;
- parseEl.innerHTML = '
';
- css = parseEl.childNodes[0].style;
- while(i--) if(v = css[props[i]]) rules[props[i]] = parse(v);
- return rules;
- }
-
- container[emile] = function(el, style, opts, after){
- el = typeof el == 'string' ? document.getElementById(el) : el;
- opts = opts || {};
- var target = normalize(style), comp = el.currentStyle ? el.currentStyle : getComputedStyle(el, null),
- prop, current = {}, start = +new Date, dur = opts.duration||200, finish = start+dur, interval,
- easing = opts.easing || function(pos){ return (-Math.cos(pos*Math.PI)/2) + 0.5; };
- for(prop in target) current[prop] = parse(comp[prop]);
- interval = setInterval(function(){
- var time = +new Date, pos = time>finish ? 1 : (time-start)/dur;
- for(prop in target)
- el.style[prop] = target[prop].f(current[prop].v,target[prop].v,easing(pos)) + target[prop].u;
- if(time>finish) { clearInterval(interval); opts.after && opts.after(); after && setTimeout(after,1); }
- },10);
- }
-})('emile', this);
-!function (context, doc) {
- var fns = [], ol, fn, f = false,
- testEl = doc.documentElement,
- hack = testEl.doScroll,
- domContentLoaded = 'DOMContentLoaded',
- addEventListener = 'addEventListener',
- onreadystatechange = 'onreadystatechange',
- loaded = /^loade|c/.test(doc.readyState);
-
- function flush(i) {
- loaded = 1;
- while (i = fns.shift()) { i() }
- }
- doc[addEventListener] && doc[addEventListener](domContentLoaded, fn = function () {
- doc.removeEventListener(domContentLoaded, fn, f);
- flush();
- }, f);
-
-
- hack && doc.attachEvent(onreadystatechange, (ol = function () {
- if (/^c/.test(doc.readyState)) {
- doc.detachEvent(onreadystatechange, ol);
- flush();
- }
- }));
-
- context['domReady'] = hack ?
- function (fn) {
- self != top ?
- loaded ? fn() : fns.push(fn) :
- function () {
- try {
- testEl.doScroll('left');
- } catch (e) {
- return setTimeout(function() { context['domReady'](fn) }, 50);
- }
- fn();
- }()
- } :
- function (fn) {
- loaded ? fn() : fns.push(fn);
- };
-
-}(this, document);
-})();
-
-xui.extend({
- /**
- * Adds more DOM nodes to the existing element list.
- */
- add: function(q) {
- [].push.apply(this, slice(xui(q)));
- return this.set(this.reduce());
- },
-
- /**
- * Pops the last selector from XUI
- */
- end: function () {
- return this.set(this.cache || []);
- },
- /**
- * Sets the `display` CSS property to `block`.
- */
- show:function() {
- return this.setStyle('display','block');
- },
- /**
- * Sets the `display` CSS property to `none`.
- */
- hide:function() {
- return this.setStyle('display','none');
- }
-});
-
-xui.extend({
- fade:function(to, callback) {
- var target = 0;
- if (typeof to == 'string' && to == 'in') target = 1;
- else if (typeof to == 'number') target = to;
- return this.tween({opacity:target,duration:.2}, callback);
- }
-});
-
-if(typeof(Ur) == "undefined") {
- Ur = {
- QuickLoaders: {},
- WindowLoaders: {},
- Widgets: {},
- onLoadCallbacks: [],
- // Make an easy function that initializes all widgets for a given fragment:
- setup: function(fragment) {
- // Hacky:
- Ur.initialize({type: "DOMContentLoaded"}, fragment);
-
- if(Ur.loaded) {
- // These widgets _cant_ be initialized till page load
- Ur.initialize({type: "load"}, fragment);
- } else {
- window.addEventListener("load", function(e) { Ur.initialize(e, fragment)}, false);
- }
- },
- initialize: function(event, fragment) {
- var Loaders = (event.type == "DOMContentLoaded") ? Ur.QuickLoaders : Ur.WindowLoaders;
- if(fragment === undefined) {
- fragment = document.body;
- }
-
- for(var name in Loaders) {
- var widget = new Loaders[name];
- widget.initialize(fragment);
- }
-
- if(event.type == "load") {
- Ur.loaded = true;
- Ur._onLoad();
- }
- },
- error: function(msg) {
- console.error("Uranium: " + msg);
- },
- warn: function(msg) {
- console.warn("Uranium: " + msg);
- },
- // TODO: Make private
- _onLoad: function() {
- //iterate through the callbacks
- x$().iterate(
- Ur.onLoadCallbacks,
- function(callback) {
- callback();
- }
- );
- },
- loaded: false
- };
-}
-
-// This event is compatible with FF/Webkit
-
-window.addEventListener("load", Ur.initialize, false);
-window.addEventListener("DOMContentLoaded", Ur.initialize, false);
-
-// Do this? OR just initialize as widgets are defined (and have uranium included at the bottom --- but that has limitations in inline JS using all of our x$() mixins) --> I think thats reason enough to try this for now
-
-
-// Here's an example of initializing a fragment manually:
-// Ur.setup("div.test");
-// You have to be careful what you select since it searches within for components -- if your selector just matches the components individually, this will fail
-
-// Now, you can re-initialize html fragments like so (After I refactor the widget initializers to search within fragments)
-// x$(elem).on('click', Ur.Loaders['zoom-preview'].intialize(fragment));
-// or
-// x$(elem).on('click', Ur.initialize(fragment));
-
-var mixins = {
- // Grabbed this from xui's forEach defn
- iterate: function(stuff, fn) {
- if (stuff === undefined) {
- return;
- }
- var len = stuff.length || 0,
- i = 0,
- that = arguments[1];
-
- if (typeof fn == "function") {
- for (; i < len; i++) {
- fn.call(that, stuff[i], i, stuff);
- }
- }
- },
- offset: function(elm) {
- if (elm == undefined)
- elm = this[0];
-
- var cumulative_top = 0, cumulative_left = 0;
- while (elm.offsetParent) {
- cumulative_top += elm.offsetTop;
- cumulative_left += elm.offsetLeft;
- elm = elm.offsetParent;
- }
- return {left: cumulative_left, top: cumulative_top};
- },
-
- // TODO: Make private:
- findNextAncestor: function(elem, type) {
- //check to make sure there's still a parent:
- if (elem.parentNode != window.document) {
- return x$().findSetAncestor(elem.parentNode, type);
- } else {
- return null;
- }
- },
-
- findSetAncestor: function(elem, type) {
- var set_name = x$(elem).attr("data-ur-set")[0];
- if (set_name !== undefined && (type == undefined || set_name == type))
- return elem;
- return x$().findNextAncestor(elem, type);
- },
-
- get_unique_uranium_id: (function() {
- var count = 0;
- return function get_id() {
- count += 1;
- return count;
- }
- })(),
-
- findElements: function(type, component_constructors) {
- var groups = {};
-
- this.each(
- (function(type, constructors, groups) {
- return function() {x$().helper_find(this, type, constructors, groups)};
- })(type, component_constructors, groups));
-
- return groups;
- },
- // TODO: Make helper_find() private since its just a helper function
- helper_find: function(fragment, type, component_constructors, groups) {
- var all_elements = x$(fragment).find("*[data-ur-" + type + "-component]");
-
- all_elements.each(function() {
-
- var valid_component = true;
-
- ///////// Resolve this component to its set ///////////
-
- // Check if this has the data-ur-id attribute
- var my_set_id = x$(this).attr("data-ur-id")[0];
-
- if (my_set_id !== undefined) {
- if ( groups[my_set_id] === undefined) {
- groups[my_set_id] = {};
- }
- }
- else {
- //Find any set ancestors
- var my_ancestor = x$().findSetAncestor(this, type);
-
- var widget_disabled = x$(my_ancestor).attr("data-ur-state")[0];
- if (widget_disabled === "disabled" && Ur.loaded == false) {
- return;
- }
-
- if (my_ancestor !== null) {
- // Check if the set has an id ... if not, 'set' it up -- HA
-
- my_set_id = x$(my_ancestor).attr("data-ur-id")[0];
-
- if (my_set_id === undefined) {
- //generate ID
- my_set_id = x$().get_unique_uranium_id();
- x$(my_ancestor).attr("data-ur-id", my_set_id);
- }
-
- if (groups[my_set_id] === undefined) {
- //setup group
- groups[my_set_id] = {};
- }
-
- groups[my_set_id]["set"] = my_ancestor;
-
- }
- else {
- // we're screwed ... report an error
- Ur.error("couldn't find associated ur-set for component:");
- console.log(this);
- valid_component = false;
- }
- }
-
- //////////// Add this component to its set /////////////
-
- var component_type = x$(this).attr("data-ur-" + type + "-component");
-
- if (component_type === undefined) {
- valid_component = false;
- }
-
- if (valid_component) {
- // This is widget specific behavior
- // -- For toggler, it makes sense for content to be multiple things
- // -- For select-lists, it doesn't
- if (component_constructors !== undefined && component_constructors[component_type] !== undefined)
- component_constructors[component_type](groups[my_set_id], this, component_type);
- else
- groups[my_set_id][component_type] = this;
- }
- });
-
- return groups;
- }
-}
-
-xui.extend(mixins);
-
-/* Carousel *
- * * * * * * *
- * The carousel is a widget to allow for horizontally scrolling
- * (with touch or buttons) between a set of items.
- *
- * The only assumption is about the items' style -- they must be
- * float: left; so that the real width can be accurately totalled.
- */
-
-Ur.WindowLoaders["carousel"] = (function() {
-
- function Carousel(components) {
- this.container = components["view_container"];
- this.items = components["scroll_container"];
- if (this.items.length == 0) {
- Ur.error("carousel missing item components");
- return false;
- }
-
- // Optionally:
- this.button = components["button"] === undefined ? {} : components["button"];
- this.count = components["count"];
- this.dots = components["dots"];
-
- this.initialize();
- this.onSlideCallbacks = [];
- }
-
- // Private/Helper methods
-
- function sign(num) {
- return num < 0 ? -1 : 1;
- }
-
- function zeroCeil(num) {
- return num <= 0 ? Math.floor(num) : Math.ceil(num);
- }
-
- function zeroFloor(num) {
- return num >= 0 ? Math.floor(num) : Math.ceil(num);
- }
-
- function stifle(e) {
- e.preventDefault();
- e.stopPropagation();
- }
-
- function getTranslateX(obj) {
- var style = getComputedStyle(obj);
- var transform = style["webkitTransform"] || style["MozTransform"] || style["oTransform"] || style["transform"];
- if (transform != "none") {
- if (window.WebKitCSSMatrix)
- return new WebKitCSSMatrix(transform).m41;
- else
- return parseInt(transform.split(",")[4]);
- }
- else {
- Ur.error("no transform found");
- return 0;
- }
- }
-
- //// Public Methods ////
-
- Carousel.prototype = {
- initialize: function() {
- // TODO:
- // add an internal event handler to handle all events on the container:
- // x$(this.container).on("event", this.handleEvent);
-
- this.flag = {click: false, increment: false, loop: false, lock: null, timeoutId: null, touched: false};
- this.options = {
- autoscroll: true,
- autoscrollDelay: 5000,
- autoscrollForward: true,
- cloneLength: 1,
- infinite: true,
- maps: false,
- transform3d: true,
- touch: true,
- verticalScroll: true
- };
-
- this.readAttributes();
-
- if (this.options.touch) {
- var hasTouch = document.ontouchstart !== undefined;
- var start = hasTouch ? "touchstart" : "mousedown";
- var move = hasTouch ? "touchmove" : "mousemove";
- var end = hasTouch ? "touchend" : "mouseup";
- var target = (this.options.maps && hasTouch) ? document : this.items;
- x$(target).on(start, function(obj){return function(e){obj.startSwipe(e)};}(this));
- x$(target).on(move, function(obj){return function(e){obj.continueSwipe(e)};}(this));
- x$(target).on(end, function(obj){return function(e){obj.finishSwipe(e)};}(this));
- x$(this.items).click(function(obj){return function(e){if (!obj.click) stifle(e);}}(this));
- }
-
- x$(this.button["prev"]).click(function(obj){return function(){obj.moveTo(obj.magazineCount);}}(this));
- x$(this.button["next"]).click(function(obj){return function(){obj.moveTo(-obj.magazineCount);}}(this));
-
- this.preCoords = {x: 0, y: 0};
-
- this.itemIndex = 0;
- this.magazineCount = 1;
-
- if (this.options.infinite) {
- var items = x$(this.items).find("[data-ur-carousel-component='item']");
- this.realItemCount = items.length;
- this.itemIndex = this.options.cloneLength;
- this.clones = []; // probaby useless
- for (var i = 0; i < this.options.cloneLength; i++) {
- var clone = items[i].cloneNode(true);
- this.clones.push(clone);
- x$(clone).attr("data-ur-clone", i).attr("data-ur-state", "inactive");
- items[items.length - 1].parentNode.appendChild(clone);
- }
-
- for (var i = items.length - this.options.cloneLength; i < items.length; i++) {
- var clone = items[i].cloneNode(true);
- this.clones.push(clone);
- x$(clone).attr("data-ur-clone", i).attr("data-ur-state", "inactive");
- items[0].parentNode.insertBefore(clone, items[0]);
- }
- }
-
- this.adjustSpacing();
-
- if (!this.options.infinite)
- this.realItemCount = this.itemCount;
-
- if (this.dots) {
- var existing = x$(this.dots).find("[data-ur-carousel-component='dot']");
- for (var i = existing.length; i < this.realItemCount; i++) {
- var new_dot = document.createElement("div");
- x$(new_dot).attr("data-ur-carousel-component", "dot");
- if (i == 0)
- x$(new_dot).attr("data-ur-state", "active");
- this.dots.appendChild(new_dot);
- }
- }
-
- this.updateIndex(this.options.infinite ? this.options.cloneLength : 0);
-
- // Expose this function globally: (this will work on webkit / FF)
- this.jumpToIndex = (function(obj) { return function(idx) { obj.__proto__.moveToIndex.call(obj, idx); };})(this);
-
- x$(window).orientationchange(function(obj){return function(){obj.resize();}}(this));
- // orientationchange isn't supported on some androids
- x$(window).on("resize", function(obj) { return function() {
- obj.resize();
- setTimeout(function(){obj.resize()}, 100);
- }}(this));
- //window.setInterval(function(obj){return function(){obj.resize();}}(this),1000);
-
- this.autoscrollStart();
- },
-
- readAttributes: function() {
- var $container = x$(this.container);
-
- // translate3d is disabled on Android by default because it often causes problems
- // however, on some pages translate3d will work fine so the data-ur-android3d
- // attribute can be set to "enabled" to use translate3d since it can be smoother
- // on some Android devices
-
- var oldAndroid = /Android [12]/.test(navigator.userAgent);
- if (oldAndroid && $container.attr("data-ur-android3d")[0] != "enabled")
- this.options.transform3d = false;
-
- this.options.verticalScroll = $container.attr("data-ur-vertical-scroll")[0] != "disabled";
- $container.attr("data-ur-vertical-scroll", this.options.verticalScroll ? "enabled" : "disabled");
-
- this.options.touch = $container.attr("data-ur-touch")[0] != "disabled";
- $container.attr("data-ur-touch", this.options.touch ? "enabled" : "disabled");
-
- this.options.maps = $container.attr("data-ur-maps")[0] == "enabled";
- $container.attr("data-ur-maps", this.options.maps ? "enabled" : "disabled");
-
- this.options.infinite = $container.attr("data-ur-infinite")[0] != "disabled";
- $container.attr("data-ur-infinite", this.options.infinite ? "enabled" : "disabled");
-
- var cloneLength = parseInt($container.attr("data-ur-clones"));
- if (cloneLength > 0)
- this.options.cloneLength = cloneLength;
- $container.attr("data-ur-clones", this.options.cloneLength);
-
- this.options.autoscroll = $container.attr("data-ur-autoscroll")[0] == "enabled";
- $container.attr("data-ur-autoscroll", this.options.autoscroll ? "enabled" : "disabled");
-
- var autoscrollDelay = parseInt($container.attr("data-ur-autoscroll-delay"));
- if (autoscrollDelay >= 0)
- this.options.autoscrollDelay = autoscrollDelay;
- $container.attr("data-ur-autoscroll-delay", this.options.autoscrollDelay);
-
- this.options.autoscrollForward = $container.attr("data-ur-autoscroll-dir")[0] != "prev";
- $container.attr("data-ur-autoscroll-dir", this.options.autoscrollForward ? "next" : "prev");
- },
-
- resize: function() {
- if (this.snapWidth != this.container.offsetWidth)
- this.adjustSpacing();
- },
-
- adjustSpacing: function() {
- // Will need to be called if the container's size changes --> orientation change
- var visibleWidth = this.container.offsetWidth;
-
- if (this.oldWidth !== undefined && this.oldWidth == visibleWidth)
- return;
- var oldSnapWidth = this.snapWidth;
- this.oldWidth = visibleWidth;
-
- var cumulativeOffset = 0;
- var items = x$(this.items).find("[data-ur-carousel-component='item']");
- this.itemCount = items.length;
-
- // Adjust the container to be the necessary width.
- // I have to do this because the alternative is assuming the container expands to its full width (display:table-row) which is non-standard if the container isn't a
- var totalWidth = 0;
-
- for (var i = 0; i < items.length; i++)
- totalWidth += items[i].offsetWidth;
-
- this.items.style.width = totalWidth + "px";
-
- this.snapWidth = visibleWidth;
-
- this.lastIndex = this.itemCount - 1;
-
- this.itemIndex = (this.lastIndex < this.itemIndex) ? this.lastIndex : this.itemIndex;
-
- cumulativeOffset -= items[this.itemIndex].offsetLeft; // initial offset
- if (this.options.infinite) {
- var centerOffset = parseInt((this.snapWidth - items[0].offsetWidth)/2);
- cumulativeOffset += centerOffset; // CHECK
- }
- if (oldSnapWidth)
- this.destinationOffset = cumulativeOffset;
-
- this.translate(cumulativeOffset);
- },
-
- autoscrollStart: function() {
- if (!this.options.autoscroll)
- return;
-
- var self = this;
- self.flag.timeoutId = setTimeout(function() {
- if (!self.options.infinite && self.itemIndex == self.lastIndex && self.options.autoscrollForward)
- self.jumpToIndex(0);
- else if (!self.options.infinite && self.itemIndex == 0 && !self.options.autoscrollForward)
- self.jumpToIndex(self.lastIndex);
- else
- self.moveTo(self.options.autoscrollForward ? -self.magazineCount : self.magazineCount);
- }, self.options.autoscrollDelay);
- },
-
- autoscrollStop: function() {
- clearTimeout(this.flag.timeoutId);
- },
-
- getEventCoords: function(event) {
- if (event.touches && event.touches.length > 0)
- return {x: event.touches[0].clientX, y: event.touches[0].clientY};
- else
- return {x: event.clientX, y: event.clientY};
- return null;
- },
-
- updateButtons: function() {
- x$(this.button["prev"]).attr("data-ur-state", this.itemIndex == 0 ? "disabled" : "enabled")
- x$(this.button["next"]).attr("data-ur-state", this.itemIndex == this.lastIndex ? "disabled" : "enabled")
- },
-
- getNewIndex: function(direction) {
- var newIndex = this.itemIndex - direction;
-
- if (!this.options.infinite) {
- if (newIndex > this.lastIndex)
- newIndex = this.lastIndex;
- else if (newIndex < 0)
- newIndex = 0;
- }
-
- return newIndex;
- },
-
- updateIndex: function(newIndex) {
- if (newIndex === undefined)
- return;
-
- this.itemIndex = newIndex;
- if (this.itemIndex < 0)
- this.itemIndex = 0;
- else if (this.itemIndex > this.lastIndex)
- this.itemIndex = this.lastIndex - 1;
-
- var realIndex = this.itemIndex;
- if (this.options.infinite)
- realIndex = (this.realItemCount + this.itemIndex - this.options.cloneLength) % this.realItemCount;
- if (this.count !== undefined)
- this.count.innerHTML = realIndex + 1 + " of " + this.realItemCount;
-
- x$(this.items).find("[data-ur-carousel-component='item'][data-ur-state='active']").attr("data-ur-state", "inactive");
- x$(x$(this.items).find("[data-ur-carousel-component='item']")[this.itemIndex]).attr("data-ur-state", "active");
-
- if (this.dots)
- x$(this.dots).find("[data-ur-carousel-component='dot']").attr("data-ur-state", "inactive")[realIndex].setAttribute("data-ur-state", "active");
-
- this.updateButtons();
-
- x$(this.container).fire("slidestart", {index: realIndex});
- },
-
- startSwipe: function(e) {
- console.log("startSwipe");
- if (this.options.maps && !x$(e.target).has("[data-ur-carousel-component='item'], [data-ur-carousel-component='item'] *"))
- return;
- if (!this.options.verticalScroll)
- stifle(e);
- this.autoscrollStop();
-
- this.flag.touched = true; // For non-touch environments
- var coords = this.getEventCoords(e);
- this.preCoords.x = coords.x;
- this.preCoords.y = coords.y;
- this.flag.lock = document.ontouchstart === undefined ? "x" : null;
- this.flag.loop = false;
-
- if (coords !== null) {
- var translateX = getTranslateX(this.items);
-
- if (this.startingOffset === undefined || this.startingOffset === null) {
- this.startingOffset = translateX;
- this.startPos = this.endPos = coords;
- } else {
- // Fast swipe
- this.startingOffset = this.destinationOffset; //Factor incomplete previous swipe
- this.startPos = this.endPos = coords;
- }
- }
- this.flag.click = true;
- },
-
- continueSwipe: function(e) {
- if (!this.flag.touched) // For non-touch environments
- return;
-
- this.flag.click = false;
-
- var coords = this.getEventCoords(e);
-
- if (document.ontouchstart !== undefined && this.options.verticalScroll) {
- var slope = Math.abs((this.preCoords.y - coords.y)/(this.preCoords.x - coords.x));
- if (this.flag.lock) {
- if (this.flag.lock == "y")
- return;
- }
- else if (slope > 1.2) {
- this.flag.lock = "y";
- return;
- }
- else if (slope <= 1.2)
- this.flag.lock = "x";
- else
- return;
- }
- stifle(e);
-
- if (coords !== null) {
- this.endPos = coords;
- var dist = this.swipeDist() + this.startingOffset;
-
- if (this.options.infinite) {
- var items = x$(this.items).find("[data-ur-carousel-component='item']");
- var endLimit = items[this.lastIndex].offsetLeft + items[this.lastIndex].offsetWidth - this.container.offsetWidth;
-
- if (dist > 0) { // at the beginning of carousel
- var srcNode = items[this.realItemCount];
- var offset = srcNode.offsetLeft - items[0].offsetLeft;
- this.startingOffset -= offset;
- dist -= offset;
- this.flag.loop = !this.flag.loop;
- }
- else if (dist < -endLimit) { // at the end of carousel
- var srcNode = items[this.lastIndex - this.realItemCount];
- var offset = srcNode.offsetLeft - items[this.lastIndex].offsetLeft;
- this.startingOffset -= offset;
- dist -= offset;
- this.flag.loop = !this.flag.loop;
- }
- }
-
- this.translate(dist);
- }
- },
-
- finishSwipe: function(e) {
- if (!this.flag.click || this.flag.lock)
- stifle(e);
- else
- x$(e.target).click();
-
- this.flag.touched = false; // For non-touch environments
-
- if (!this.options.verticalScroll || this.flag.lock == "x")
- this.moveHelper(this.getDisplacementIndex());
- else if (this.flag.lock == "y")
- this.autoscrollStart();
- },
- getDisplacementIndex: function() {
- var swipeDistance = this.swipeDist();
- var displacementIndex = zeroCeil(swipeDistance/x$(this.items).find("[data-ur-carousel-component='item']")[0].offsetWidth);
- return displacementIndex;
- },
- snapTo: function(displacement) {
- this.destinationOffset = displacement + this.startingOffset;
- var maxOffset = -1*(this.lastIndex)*this.snapWidth;
- var minOffset = parseInt((this.snapWidth - x$(this.items).find("[data-ur-carousel-component='item']")[0].offsetWidth)/2);
-
- if (this.options.infinite)
- maxOffset = -this.items.offsetWidth;
- if (this.destinationOffset < maxOffset || this.destinationOffset > minOffset) {
- if (Math.abs(this.destinationOffset - maxOffset) < 1) {
- // Hacky -- but there are rounding errors
- // I see this when I'm in multi-mode and using the buttons
- // This only seems to happen on the desktop browser -- ideally its removed at compile time
- this.destinationOffset = maxOffset;
- } else {
- this.destinationOffset = this.startingOffset;
- }
- }
-
- this.momentum();
- },
-
- moveTo: function(direction) {
- // The animation isnt done yet
- if (this.flag.increment)
- return;
-
- this.startingOffset = getTranslateX(this.items);
- this.moveHelper(direction);
- },
-
- moveHelper: function(direction) {
- this.autoscrollStop();
-
- var newIndex = this.getNewIndex(direction);
-
- var items = x$(this.items).find("[data-ur-carousel-component='item']");
-
- if (this.options.infinite) {
- var oldTransform = getTranslateX(this.items);
- var altTransform = oldTransform;
-
- if (newIndex < this.options.cloneLength) { // at the beginning of carousel
- var offset = items[this.options.cloneLength].offsetLeft - items[this.itemCount - this.options.cloneLength].offsetLeft;
- if (!this.flag.loop) {
- altTransform += offset;
- this.translate(altTransform);
- this.startingOffset += offset;
- }
- newIndex += this.realItemCount;
- this.itemIndex = newIndex + direction;
- }
- else if (newIndex > this.lastIndex - this.options.cloneLength) { // at the end of carousel
- var offset = items[this.itemCount - this.options.cloneLength].offsetLeft - items[this.options.cloneLength].offsetLeft;
- if (!this.flag.loop) {
- altTransform += offset;
- this.translate(altTransform);
- this.startingOffset += offset;
- }
- newIndex -= this.realItemCount;
- this.itemIndex = newIndex + direction;
- }
- }
- var newItem = items[newIndex];
- var currentItem = items[this.itemIndex];
- var displacement = currentItem.offsetLeft - newItem.offsetLeft; // CHECK
-
- setTimeout(function(obj) {
- return function() {
- obj.snapTo(displacement);
- obj.updateIndex(newIndex);
- }
- }(this), 6);
- },
-
- moveToIndex: function(index) {
- var direction = this.itemIndex - index;
- this.moveTo(direction);
- },
-
- momentum: function() {
- if (this.flag.touched)
- return;
-
- this.flag.increment = false;
-
- var translateX = getTranslateX(this.items);
- var distance = this.destinationOffset - translateX;
- var increment = distance - zeroFloor(distance / 1.1);
-
- // Hacky -- this is for the desktop browser only -- to fix rounding errors
- // Ideally, this is removed at compile time
- if(Math.abs(increment) < 0.01)
- increment = 0;
-
- var newTransform = increment + translateX;
-
- this.translate(newTransform);
-
- if (increment != 0)
- this.flag.increment = true;
-
- if (this.flag.increment)
- setTimeout(function(obj){return function(){obj.momentum()}}(this), 16);
- else {
- this.startingOffset = null;
- this.autoscrollStart();
-
- var itemIndex = this.itemIndex;
- x$(this.container).fire("slideend", {index: itemIndex});
-
- x$().iterate(this.onSlideCallbacks, function(callback) { callback(); });
- }
- },
-
- swipeDist: function() {
- if (this.endPos === undefined)
- return 0;
- return this.endPos.x - this.startPos.x;
- },
-
- translate: function(x) {
- var container = this.items;
- var translatePrefix = this.options.transform3d ? "translate3d(" : "translate(";
- var translateSuffix = this.options.transform3d ? ", 0px)" : ")";
- ["webkitTransform", "MozTransform", "oTransform", "transform"].forEach(function(i) {
- container.style[i] = translatePrefix + x + "px, 0px" + translateSuffix;
- });
- }
- }
-
- // Private constructors
- var ComponentConstructors = {
- button: function(group, component, type) {
- if (group["button"] === undefined)
- group["button"] = {};
-
- var type = component.getAttribute("data-ur-carousel-button-type");
-
- // Declaration error
- if (type === undefined)
- Ur.error("malformed carousel button type on:" + component.outerHTML);
-
- group["button"][type] = component;
-
- // Maybe in the future I'll make it so any of the items can be the starting item
- x$(component).attr("data-ur-state", type == "prev" ? "disabled" : "enabled");
- }
- };
- function CarouselLoader(){}
-
- CarouselLoader.prototype.initialize = function(fragment) {
- var carousels = x$(fragment).findElements("carousel", ComponentConstructors);
- Ur.Widgets["carousel"] = {};
- for (var name in carousels) {
- var carousel = carousels[name];
- Ur.Widgets["carousel"][name] = new Carousel(carousel);
- x$(carousel["set"]).attr("data-ur-state", "enabled");
- }
- }
-
- return CarouselLoader;
-})();
-
-/* Flex Table *
- * * * * * *
- * The flex table widget will take a full-sized table and make it fit
- * on a variety of different viewport sizes.
- *
- */
-
-Ur.QuickLoaders['flex-table'] = (function(){
-
- // Add an enhanced class to the tables the we'll be modifying
- function addEnhancedClass(tbl) {
- x$(tbl).addClass("enhanced");
- }
-
- function flexTable(aTable, table_index) {
- // TODO :: Add the ability to pass in options
- this.options = {
- idprefix: 'col-', // specify a prefix for the id/headers values
- persist: "persist", // specify a class assigned to column headers (th) that should always be present; the script not create a checkbox for these columns
- checkContainer: null // container element where the hide/show checkboxes will be inserted; if none specified, the script creates a menu
- };
-
- var self = this,
- o = self.options,
- table = aTable.table,
- thead = aTable.head,
- tbody = aTable.body,
- hdrCols = x$(thead).find('th'),
- bodyRows = x$(tbody).find('tr'),
- container = o.checkContainer ? x$(o.checkContainer) : x$('');
-
- addEnhancedClass(table);
-
- hdrCols.each(function(elm, i){
- var th = x$(this),
- id = th.attr('id'),
- classes = th.attr('class');
-
- // assign an id to each header, if none is in the markup
- if (id.length === 0) {
- id = ( o.idprefix ? o.idprefix : "col-" ) + i;
- th.attr('id', id);
- }
-
- // assign matching "headers" attributes to the associated cells
- // TEMP - needs to be edited to accommodate colspans
- bodyRows.each(function(e, j){
- var cells = x$(e).find("th, td");
- cells.each(function(cell, k) {
- if (cell.cellIndex == i) {
- x$(cell).attr('headers', id);
- if (classes.length !== 0) { x$(cell).addClass(classes[0]); };
- }
- });
- });
-
- // create the show/hide toggles
- if ( !th.hasClass(o.persist) ) {
- var toggle = x$(' '
- + th.html() +' ');
- container.find('ul').bottom(toggle);
- var tgl = toggle.find("input");
-
- tgl.on("change", function() {
- var input = x$(this),
- val = input.attr('value'),
- cols = x$("div[data-ur-id='" + table_index + "'] " + "#" + val[0] + ", " +
- "div[data-ur-id='" + table_index + "'] " + "[headers=" + val[0] + "]");
- if (!this.checked) {
- cols.addClass('ur_ft_hide');
- cols.removeClass("ur_ft_show"); }
- else {
- cols.removeClass("ur_ft_hide");
- cols.addClass('ur_ft_show'); }
- });
- tgl.on("updateCheck", function(){
- if ( th.getStyle("display") == "table-cell" || th.getStyle("display") == "inline" ) {
- x$(this).attr("checked", true);
- }
- else {
- x$(this).attr("checked", false);
- }
- });
- tgl.fire("updateCheck");
- }
-
- }); // end hdrCols loop
-
- // Update the inputs' checked status
- x$(window).on('orientationchange', function() {
- container.find('input').fire('updateCheck');
- });
- x$(window).on('resize', function() {
- container.find('input').fire('updateCheck');
- });
-
- // Create a "Display" menu
- if (!o.checkContainer) {
- var menuWrapper = x$(''),
- popupBG = x$('
'),
- menuBtn = x$('');
- menuBtn.click(function(){
- container.toggleClass("table-menu-hidden");
- x$(this).toggleClass("menu-btn-show");
- return false;
- });
- popupBG.click(function(){
- container.toggleClass("table-menu-hidden");
- menuBtn.toggleClass("menu-btn-show");
- return false;
- });
- container.bottom(popupBG);
- menuWrapper.bottom(menuBtn).bottom(container);
- x$(table).before(menuWrapper);
- };
- }
-
- function TableLoader () {}
-
- TableLoader.prototype.initialize = function(fragment) {
- var tables = x$(fragment).findElements('flex-table');
- Ur.Widgets["flex-table"] = {};
-
- for(var table in tables){
- Ur.Widgets["flex-table"][name] = new flexTable(tables[table], table);
- }
- }
-
- return TableLoader;
-})();
-
-/* Font Resizer
- ------------
- Font Resizer displays three components:
- (1) a button which, when pressed, increases the font size of some
- specified page elements
- (2) a button which, when pressed, decreases the font size of some
- specified page elements
- (3) a label which reports the current font size of the aforementioned
- page elements
-*/
-
-Ur.QuickLoaders["font-resizer"] = (function() {
-
- var labelText = "Text Size: ";
- var up = 1, down = -1;
-
- function FontResizer(components) {
- this.increase = components["increase"];
- this.decrease = components["decrease"];
- this.label = components["label"];
- this.content = components["content"];
- this.initialize();
- }
-
- FontResizer.prototype.initialize = function() {
- var content = x$(this.content);
- this.min = parseInt(content.attr("data-ur-font-resizer-min")) || 100;
- this.max = parseInt(content.attr("data-ur-font-resizer-max")) || 200;
- this.delta = parseInt(content.attr("data-ur-font-resizer-delta")) || 20;
- this.size = parseInt(content.attr("data-ur-font-resizer-size")) || this.min;
- this.invert = content.attr("data-ur-font-resizer-invert") == "Bam!" ? true : false;
-
- x$(this.increase).click(function (obj) { return function() { obj.change(up); }; }(this));
- x$(this.decrease).click(function (obj) { return function() { obj.change(down); }; }(this));
-
- if (this.invert) {
- this.size = this.min;
- this.controlSize = this.max;
- this.increase.style["font-size"] = this.controlSize + "%";
- this.decrease.style["font-size"] = this.controlSize + "%";
- this.label.style["font-size"] = this.controlSize + "%";
- }
-
- content[0].style["font-size"] = this.size + "%";
- x$(this.label).inner(labelText + this.size + "%");
-
- }
-
- FontResizer.prototype.change = function(direction) {
- if ((direction == down && this.size > this.min) ||
- (direction == up && this.size < this.max)) {
- this.size += direction * this.delta;
- this.content.style["font-size"] = this.size + "%";
- this.label.innerText = labelText + this.size + "%";
-
- if (this.invert) {
- this.controlSize += -direction * this.delta;
- this.increase.style["font-size"] = this.controlSize + "%";
- this.decrease.style["font-size"] = this.controlSize + "%";
- this.label.style["font-size"] = this.controlSize + "%";
- }
- }
- }
-
- function FontResizerLoader() {}
-
- FontResizerLoader.prototype.initialize = function(fragment) {
- var font_resizers = x$(fragment).findElements('font-resizer');
- for (var name in font_resizers) new FontResizer(font_resizers[name]);
- }
-
- return FontResizerLoader;
-})();
-
-/* Geolocation *
- * * * * * * * * *
- *
- * The Geolocation widget is meant to
- * reverse geocode a position to give back an address and then
- * populate form fields
- *
- */
-
-Ur.QuickLoaders["geocode"] = (function() {
-
- function Geocode(data) {
- this.elements = data;
- this.callback = x$(this.elements.set).attr("data-ur-callback")[0];
- this.errorCallback = x$(this.elements.set).attr("data-ur-error-callback")[0];
-
- UrGeocode = function(obj){return function(){obj.setup_callbacks();};}(this);
- var s = document.createElement('script');
- s.type = "text/javascript";
- s.src = "http://maps.googleapis.com/maps/api/js?sensor=true&callback=UrGeocode";
- x$('body').html('bottom', s);
- }
-
-
- var geocoder;
- var geocodeObj;
- var currentObj;
-
- function selectHelper(elm, value) {
- for (var i=0,j=elm.length; i')
- // Hide it (even though this should be in CSS)
- ex.hide();
- // Inject it
- that.html('after', ex);
-
- ex.on('click', function() {
- // remove text in the box
- that[0].value='';
- });
-
- that.on('focus', function() {
- if (that[0].value != '') {
- ex.show();
- }
- })
- that.on('keydown', function() {
- ex.show();
- });
- that.on('blur', function() {
- // Delay the hide so that the button can be clicked
- setTimeout(function() { ex.hide();}, 100);
- });
- }
-
- function InputClearLoader () {}
-
- InputClearLoader.prototype.initialize = function(fragment) {
- var inputs = x$(fragment).findElements('input-clear');
- e = inputs;
-
- Ur.Widgets["input-clear"] = {};
-
- for(var input in inputs){
- Ur.Widgets["input-clear"][input] = new inputClear(inputs[input]);
- }
- }
-
- return InputClearLoader;
-})();
-
-
-
-/*
- * lateload takes any element that has the data-ur-ll-src or
- * data-ur-ll-href attribute and then once requested, loads that
- * object
- */
-
-(function () {
-
- function late_load (obj) {
-
- var self = this;
- var components = this.components = obj;
- }
-
- late_load.prototype.preferences = {threshold: 300};
-
- late_load.prototype.release_element = function (obj) {
-
- if (obj.hasAttribute("data-ur-ll-src")){
- var type = "src";
- var att = "data-ur-ll-src";
- var loc = obj.getAttribute(att);
- }else if (obj.hasAttribute("data-ur-ll-href")){
- var type = "href";
- var att = "data-ur-ll-href";
- var loc = obj.getAttribute();
- }else{
- //console.warn("Uranium Late Load: non-late-load element provided.");
- return
- }
-
- obj.removeAttribute(att);
- obj.setAttribute(type, loc);
- }
-
- late_load.prototype.components = {};
-
- late_load.prototype.release_group = function (hash) {
- for (var name in hash){
- if (hash[name][1] != "scroll"){
- late_load.prototype.release_element(hash[name][0]);
- }else if (scrollHelper(hash[name][0]) == true){
- late_load.prototype.release_element(hash[name][0]);
- }
- }
- }
-
- var scrollHelper = function (obj) {
- var fold = window.innerHeight + window.pageYOffset;
-
- var findPos = function(obj) {
- var curleft = curtop = 0;curtop;
- if (obj.offsetParent) {
- do {
- curleft += obj.offsetLeft;
- curtop += obj.offsetTop;
- } while (obj = obj.offsetParent);
- }
- return [curleft,curtop];
- }
- var pos = findPos(obj);
- return fold >= pos[1] - obj.offsetHeight - late_load.prototype.preferences.threshold;
- }
-
- var setEvents = function (obj) {
- var components = obj;
-
- for (var temp in components){
-
- switch(temp){
- case "scroll":
- x$(window).on(temp, function (e) {
- late_load.prototype.release_group(components["scroll"], "scroll");
- });
- break;
- case "load":
- x$(window).on(temp, function (e) {
- late_load.prototype.release_group(components["load"]);
- });
- break;
- case "DOMContentLoaded":
- late_load.prototype.release_group(components["DOMContentLoaded"]);
- break;
- case "click": case "touch":
- x$("html").on(temp, function (e) {
- var type = e.target.getAttribute("data-ur-ll-event")
- if (type == "click" || type == "touch") {
- late_load.prototype.release_element(e.target);
- }
- });
- break;
- default:
- break;
- }
- }
- }
-
-
- var find = function () {
- var obj = {};
- var temp = [];
- var group;
-
- x$(document).find('[data-ur-ll-href],[data-ur-ll-src]').each( function () {
- group = this.getAttribute("data-ur-ll-event")
- if (group === null){
- group = "DOMContentLoaded";
- }
- obj[group] = []
- temp.push([this, group]);
- });
-
- for (var element in temp){
- if (temp[element][1] === undefined) {}else{
- obj[temp[element][1]].push(temp[element]);
- }
- }
-
- return obj;
- }
-
- late_load.prototype.initialize = function() {
- var lateObj = find();
- var ll = new late_load(lateObj);
- setEvents(ll.components)
- Ur.Widgets["late_load"] = ll;
- }
-
- return Ur.QuickLoaders['late_load'] = late_load;
-})();
-
-/* Map *
- * * * *
- * The map creates a fully functional google map (API version 3) from addresses.
- *
- * It (will) also support current location / custom icons and callbacks / getting directions.
- *
- */
-
-Ur.QuickLoaders['map'] = (function(){
-
- // -- Private functions --
-
- function ThresholdCallback(threshold, callback) {
- this.threshold = threshold;
- this.count = 0;
- this.callbacks = [];
- if (callback !== undefined) {
- this.callbacks.push(callback);
- }
- }
-
- ThresholdCallback.prototype.finish = function() {
- this.count += 1;
- if (this.count == this.threshold) {
- var callback = this.callbacks.pop();
- while(callback) {
- callback();
- callback = this.callbacks.pop();
- }
- }
- }
-
- // -- End of Private functions --
-
-
-
- function Map(data){
- this.elements = data;
- this.fetch_map(); //This is async -- it calls initialize when done
- }
-
- // NOTE : All this map stuff is async. The execution path goes:
- //
- // fetch_map() ->
- // fetch_coordinates() ->
- // setup_map() ->
- // add_coordinates()
- // setup_user_location()
-
- Map.prototype = {
- marker_clicked: function(map_event, marker_index) {
-
- x$().iterate(
- this.elements["descriptions"],
- function(description, index) {
- if(index == marker_index) {
- x$(description).attr("data-ur-state","enabled");
- } else {
- x$(description).attr("data-ur-state","disabled");
- }
- }
- );
-
- // TODO: I probably want to add the ability to specify your own callback, which would get called here
- },
-
- fetch_coordinates: function(){
- this.coordinates = [];
- this.center = [0,0];
- this.lat_range = {};
- this.lng_range = {};
-
- var geocoder = new google.maps.Geocoder();
- var obj = this;
- var final_callback = new ThresholdCallback(
- this.elements["addresses"].length,
- function(obj){return function(){obj.setup_map();}}(this)
- );
-
- x$(this.elements["addresses"]).each(
- function(address, index) {
- address = address.innerText;
- var cleaned_address = address.match(/(\S.*\S)[$\s]/m)[1];
-
- if(cleaned_address == undefined){
- cleaned_address = address;
- }
-
- geocoder.geocode(
- {"address": cleaned_address},
- function(results, status) {
- var position = null;
-
- if(status === google.maps.GeocoderStatus.OK) {
- position = results[0].geometry.location;
- obj.coordinates[index] = position;
- obj.center[0] += position.lat();
- obj.center[1] += position.lng();
-
- var ne = results[0].geometry.viewport.getNorthEast();
- var sw = results[0].geometry.viewport.getSouthWest();
-
- if ( (obj.lat_range["min"] && obj.lat_range["min"] > sw.lat()) || obj.lat_range["min"] === undefined) {
- obj.lat_range["min"] = sw.lat();
- }
-
- if ( (obj.lat_range["max"] && obj.lat_range["max"] < sw.lat()) || obj.lat_range["max"] === undefined) {
- obj.lat_range["max"] = ne.lat();
- }
-
- if ( (obj.lng_range["min"] && obj.lng_range["min"] > sw.lng()) || obj.lng_range["min"] === undefined) {
- obj.lng_range["min"] = sw.lng();
- }
-
- if ( (obj.lng_range["max"] && obj.lng_range["max"] < sw.lng()) || obj.lng_range["max"] === undefined) {
- obj.lng_range["max"] = ne.lng();
- }
-
- final_callback.finish();
- } else {
- console.error("Error geocoding address: " + address);
- }
-
- }
- );
- }
- );
-
- },
-
- add_coordinates: function() {
- var obj = this;
- var icon_url = x$(this.elements["icon"]).attr("data-ur-url")[0];
-
- var width = x$(this.elements["icon"]).attr("data-ur-width")[0];
- var height = x$(this.elements["icon"]).attr("data-ur-height")[0];
-
- var size = null;
-
- if(width !== undefined && height !== undefined){
- size = new google.maps.Size(parseInt(width), parseInt(height));
- }
-
- x$().iterate(
- obj.coordinates,
- function (point, index) {
- var icon_image = null;
-
- if (icon_url !== undefined) {
- icon_image = new google.maps.MarkerImage(icon_url, null, null, null, size);
- }
-
- var marker = new google.maps.Marker({
- position: point,
- map: obj.map,
- icon: icon_image
- });
-
- google.maps.event.addListener(
- marker,
- 'click',
- function(marker_index){
- return function(map_event){
- obj.marker_clicked(map_event, marker_index);
- };
- }(index)
- );
-
- }
- );
-
- },
-
- setup_user_location: function() {
- var user_location = this.elements["user_location"];
- this.user_location_marker = null;
-
- if(user_location === undefined) {
- return
- }
-
- // Add a listener on the button
-
- var self = this;
-
- x$(user_location).on(
- 'click',
- function(){self.toggle_user_location()}
- );
-
- // Now just determine if I should use it automatically or not
-
- if(x$(user_location).attr("data-ur-state")[0] === "enabled") {
- this.fetch_user_location();
- }
-
- },
-
- fetch_user_location: function() {
-
- var success = function(obj){
- return function(position){
- obj.add_user_location(position);
- }
- }(this);
-
- var failure = function(){
- console.error("Ur : Error getting user location");
- };
-
- if(navigator.geolocation) {
- navigator.geolocation.getCurrentPosition(success, failure);
- } else {
- console.error("Ur : Geolocation services not available");
- }
-
- },
-
- add_user_location: function(point) {
- var google_point = new google.maps.LatLng(point.coords.latitude, point.coords.longitude);
-
- this.user_location_marker = new google.maps.Marker({
- position: google_point,
- map: this.map,
- icon: "//s3.amazonaws.com/moovweb-live-resources/map/dot-blue.png"
- });
- // TODO : Make this a real icon URL
-
- x$(this.elements["user_location"]).attr("data-ur-state","enabled");
- },
-
- toggle_user_location: function() {
-
- if(this.user_location_marker === null || this.user_location_marker === undefined) {
- this.fetch_user_location();
- } else {
- this.user_location_marker.setMap(null);
- delete this.user_location_marker;
- x$(this.elements["user_location"]).attr("data-ur-state","disabled");
- }
-
- },
-
- fetch_map: function() {
- var script = document.createElement("script");
-
- // Note:
- // - There can only be one map per page since I have to pass a global function name as
- // the callback for the map code loading.
- // - The alternative is to generate unique global function names per instance ... but
- // that requires eval() ... and "evals() are bad .... mkay?"
-
- // TODO: Can I at least hide it behind the Ur object?
- setup_uranium_map = function(obj){
- return function() {
- obj.fetch_coordinates();
- }
- }(this);
-
- script.src = "http://maps.googleapis.com/maps/api/js?sensor=true&callback=setup_uranium_map";
-
- this.elements["set"].appendChild(script);
- },
-
- setup_map: function() {
-
- this.center[0] /= this.elements["addresses"].length
- this.center[1] /= this.elements["addresses"].length
-
- var center = new google.maps.LatLng(this.center[0], this.center[1]);
-
- var options = {
- center: center,
- mapTypeId: google.maps.MapTypeId.ROADMAP
- };
-
- this.map = new google.maps.Map(this.elements["canvas"], options);
-
- var cumulative_sw = new google.maps.LatLng(this.lat_range["min"], this.lng_range["min"]);
- var cumulative_ne = new google.maps.LatLng(this.lat_range["max"], this.lng_range["max"]);
-
- var cumulative_bounds = new google.maps.LatLngBounds(cumulative_sw, cumulative_ne);
-
- this.map.fitBounds(cumulative_bounds);
-
- this.add_coordinates();
- this.setup_user_location();
- }
-
- }
-
-
- var ComponentConstructors = {
- "address" : function(group, component, type) {
- if (group["addresses"] === undefined) {
- group["addresses"] = [];
- }
-
- group["addresses"].push(component);
- },
-
- "description" : function(group, component, type) {
- if (group["descriptions"] === undefined) {
- group["descriptions"] = [];
- }
-
- group["descriptions"].push(component);
- }
- }
-
- function MapLoader(){
- }
-
- MapLoader.prototype.initialize = function(fragment) {
- var maps = x$(fragment).findElements('map', ComponentConstructors);
- Ur.Widgets["map"] = {};
-
- for(var name in maps) {
- var map = maps[name];
- Ur.Widgets["map"][name] = new Map(map);
- break;
- // There can only be one for now ...
- // TODO: As long as I make the script adding a singleton process, I can have multiple maps
- }
-
- }
-
- return MapLoader;
-})();
-
-/* Select Buttons *
- * * * * * * * * * *
- * The select-button widget binds two buttons to a to increment/decrement
- * the select's chosen value.
- *
- */
-
-Ur.QuickLoaders['select-buttons'] = (function(){
-
- function SelectButtons(components) {
- this.select = components["select"];
- this.increment = components["increment"];
- this.decrement = components["decrement"];
- this.initialize();
- }
-
- SelectButtons.prototype.initialize = function() {
- x$(this.increment).click(function(obj){return function(evt){obj.trigger_option(evt, 1)};}(this));
- x$(this.decrement).click(function(obj){return function(evt){obj.trigger_option(evt, -1)};}(this));
- }
-
- SelectButtons.prototype.trigger_option = function(event, direction) {
- var button = event.currentTarget;
- if (x$(button).attr("data-ur-state")[0] === "disabled") {
- return false;
- }
- var current_option = {};
- var value = this.select.value;
- var newValue = {"prev":null, "next":null};
-
- x$().iterate(
- this.select.children,
- function(option, index) {
- if(x$(option).attr("value")[0] == value) {
- current_option = {"element": option, "index": index};
- }
-
- if(typeof(current_option["index"]) == "undefined") {
- newValue["prev"] = x$(option).attr("value")[0];
- }
-
- if(index == current_option["index"] + 1) {
- newValue["next"] = x$(option).attr("value")[0];
- }
- }
- );
-
- var child_count = this.select.children.length;
- var new_index = current_option["index"] + direction;
-
- if (new_index == 0) {
- x$(this.decrement).attr("data-ur-state","disabled");
- } else {
- x$(this.decrement).attr("data-ur-state","enabled");
- }
-
- if (new_index == child_count - 1) {
- x$(this.increment).attr("data-ur-state","disabled");
- } else {
- x$(this.increment).attr("data-ur-state","enabled");
- }
-
- if (new_index < 0 || new_index == child_count) {
- return false;
- }
-
- direction = direction == 1 ? "next" : "prev";
- this.select.value = newValue[direction];
-
- return true;
- }
-
-
-
- // Potential bug: (not going to worry about it now)
- // This is a bit tricky since I need to update the classes on the buttons if they're on an extreme/edge
- // If the page can be loaded w any of the options selected, I can't apply these classes till onload
- // -- so the solution i guess is to add the disable classes to the html, and they'll be removed when initialized
-
- function SelectButtonsLoader(){
- }
-
- SelectButtonsLoader.prototype.initialize = function(fragment) {
- var select_buttons = x$(fragment).findElements('select-buttons');
- for (var name in select_buttons) {
- new SelectButtons(select_buttons[name]);
- x$(select_buttons[name]["set"]).attr("data-ur-state","enabled");
- }
- }
-
- return SelectButtonsLoader;
-})();
-/* Select List *
- * * * * * * * *
- * The select-list binds a set of uranium-elements to corresponding
- * elements of a . Clicking the uranium-element sets the 's
- * value to match the corresponding element.
- *
- */
-
-// A concern here is the initial state -- I think the default should be just
-// that there is no initial state -- the user must click to update the state
-// -- the reason is, if there is an initial state, the underlying selector's
-// state may be different on render, and there will be a gap until onload
-// while the states mismatch -- if the user is fast enough to click a form
-// in that time, they will get unexpected results.
-
-Ur.QuickLoaders['select-list'] = (function(){
-
- function SelectList(select_element, list_element){
- this.select = select_element;
- this.list = list_element;
- this.initialize();
- }
-
- SelectList.prototype.initialize = function() {
- x$(this.list).click(function(obj){return function(evt){obj.trigger_option(evt)}}(this));
- }
-
- SelectList.prototype.trigger_option = function(event) {
- var selected_list_option = event.target;
- var self = this;
- var value = iterate(this, selected_list_option);
- // x$(this.select).attr("value",value); //Odd - this doesn't work, but the following line does
- // -- I think 'value' is a special attribute ... its not in the attributes[] property of a node
- this.select.value = value;
-
- return true;
- }
-
- function iterate (obj, selected_obj) {
- var value = "";
- x$().iterate(
- obj.list.children,
- function(element, index){
- var val1 = element.getAttribute("value");
- var val2 = selected_obj.getAttribute("value");
- if(val1 == val2) {
- x$(element).attr("data-ur-state","enabled");
- value = x$(element).attr("value");
- } else {
- x$(element).attr("data-ur-state","disabled");
- }
- }
- );
- return value;
- }
-
- function matchSelected (obj) {
- var active = obj.select.children[obj.select.options.selectedIndex];
- iterate(obj, active);
- }
-
- function SelectListLoader(){
- this.SelectLists = {};
- // Keep instances here because we may need them in the future
- // - In v1 we had to listen for changes on the 's and update appropriately
- // - Sometimes we had to listen for different events
- }
-
-
- SelectListLoader.prototype.initialize = function(fragment) {
- var select_lists = x$(fragment).findElements('select-list');
- var self = this;
- for (var name in select_lists) {
- var select_list = select_lists[name];
- self.SelectLists[name] = new SelectList(select_lists[name]["select"],select_lists[name]["content"]);
- x$(select_list["set"]).attr("data-ur-state","enabled");
- matchSelected(self.SelectLists[name])
- }
- }
-
- return SelectListLoader;
-})();
-
-
-/*
-
-basic structure of swipe toggler
-you must define the swipe toggle name and one active element
-from there this will create the swipe toggle ability.
-
-show this off with a fade in and card deck carousel.
-
-
-item1 itme2 itme3
-
-
-*/
-
-// this is a swipe toggler
-Ur.QuickLoaders['SwipeToggle'] = (function () {
-
- function swipeToggleComponents (group, content_component) {
- // This is a 'collection' of components
- // -- if I see it again, I'll make this abstract
- if(group["slider"] === undefined) {
- group["slider"] = [];
- }
- group["slider"].push(content_component);
- }
-
- function SwipeToggle (swipe_element, name){
- var myName = name;
- var components = swipe_element;
- var self = this;
- var touch = {};
-
- var preferences = this.preferences = { dots: false, axis: "x", swipeUpdate: true, sensitivity: 10, loop: true,
- touchbuffer: 20, tapActive: false, touch: true, jump: 1, loop: true,
- autoSpeed: 500 };
-
-
- this.flags = {touched: false, autoID: null}
- var flags = this.flags;
-
-
- var startPos = endPos = markerPos = {x: 0, y: 0, time: 0};
-
- var loadEvent = function (obj) {
- var event = document.createEvent("Event");
- event.initEvent("loaded", false, true);
- obj.dispatchEvent(event);
- }
-
- var autoScroll = function(mili_sec){
- name = setInterval(function (){
- console.log(name);
- var imageArray = slider.children.length;
-
- if(SwipeToggle.prototype.flags == true){
- window.clearInterval(name);
- wipeToggle.prototype.flags == false;
- }else{
- myCarousel.next(1);
- }
-
- },mili_sec);
- }
-
- var setTouch = function () {
-
- var pef_touch = self.preferences.touch;
-
- slider.addEventListener('touchstart', function (e){
- if (pef_touch == true){
- touch.start(e, this);
- }
- }, false);
-
- slider.addEventListener('touchmove', function (e){
- if (pef_touch == true){
- touch.move(e, this);
- }
- }, false);
-
- slider.addEventListener('touchend', function (e){
- if (pef_touch == true){
- touch.end(e, this);
- }
- }, false);
- }
-
- var swipeDirection = function (){
-
- if (preferences) {
- var buff = preferences.touchbuffer;
- }else{
- var buff = 0;
- }
-
- if(startPos[axis] < endPos[axis] - buff){
- return 1;//right or top >>
- }else if(startPos[axis] > endPos[axis] + buff){
- return 2;//left or bottom <<
- }else{
- return 3;//tap
- }
- }
-
- SwipeToggle.prototype.getActive = function (e) {
- var test = this.components.name;
- var active = x$('[data-ur-id="' + test + '"][data-ur-swipe-toggle-component="slider"] > [data-ur-state="active"]')[0];
- return active;
- }
-
- SwipeToggle.prototype.next = function () {
-
- var activeObj = this.getActive();
- var jump = this.preferences.jump;
- var children = activeObj.parentNode.children;
-
- for(var i = 0; i < jump; i++){
- if(lookAhead(activeObj) == true){
- var update = activeObj.nextElementSibling;
- activeObj = this.setActive(update);
- }else if(lookAhead(activeObj) == false && this.preferences.loop == true){
- this.setActive(children[0])
- }
- }
-
- return activeObj;
- }
-
- SwipeToggle.prototype.prev = function () {
- var activeObj = this.getActive();
- var jump = this.preferences.jump;
- var children = activeObj.parentNode.children;
- var last = children.length -1;
-
- for(var i = 0; i < jump; i++){
- if(lookBehind(activeObj) == true){
- var update = activeObj.previousElementSibling;
- activeObj = this.setActive(update);
- }else if(lookBehind(activeObj) == false && this.preferences.loop == true){
- this.setActive(children[last])
- }
- }
-
- return activeObj;
- }
-
- var touch = {};
-
- touch.start = function (e) {
- flags.touched = true;
-
- markerPos = startPos = {
- x: e.touches[0].clientX,
- y: e.touches[0].clientY,
- time: e.timeStamp
- };
-
- }
-
- touch.move = function (e) {
-
- endPos = {
- x: e.touches[0].clientX,
- y: e.touches[0].clientY
- };
- if(self.preferences.swipeUpdate == true){
- swipeUpdate(e);
- }
-
- var swipeDist = endPos[axis] - startPos[axis];
- }
-
- touch.end = function (e) {
- endPos.time = e.timeStamp;
-
- touchMove(e)
-
- touch.clear();
- }
-
- touch.clear = function () {
- startPos = {};
- endPos = {};
- markerPos = {};
- }
-
- var swipeUpdate = function (e) {
- if(endPos[axis] + self.preferences.sensitivity < markerPos[axis]){
- self.next();
- markerPos = endPos;
- e.stopPropagation();
- e.preventDefault();
- }
- if(endPos[axis] - self.preferences.sensitivity > markerPos[axis]){
- self.prev();
- markerPos = endPos;
- e.stopPropagation();
- e.preventDefault();
- }
- }
-
- var touchMove = function (e) {
- var direction = swipeDirection();
- var target = e.target
- if (direction == 1) {
- self.prev()
- }else if (direction == 2){
- self.next()
- }else{
- if (target.parentNode == slider){
- self.setActive(target);
- }
- }
- }
-
- var activeIndex = function (Element){
- if (Element === undefined) {
- var obj = self.components.slider;
- } else {
- var obj = Element;
- }
-
- var length = obj.children.length;
- var i = 0;
-
- if (length > i) {
- for(i ; i < length; i++){
- if(obj.children[i].getAttribute('data-ur-state') == 'active'){
- break;
- }
- }
- }
-
- return i;
- }
-
- SwipeToggle.prototype.autoScroll = function (direction) {
- var imageArray = this.components.slider.children.length;
- var self = this;
-
- var autoID = name;
-
- window.clearInterval(this.flags.autoID);
- if (direction == "next" || direction == "prev"){}else{
- console.log("swipe_toggle: impropper autoScroll direction setting");
- direction = "next";
- }
-
- this.flags.autoID = autoID = window.setInterval(function (){
- var position = activeIndex();
-
- if((self.preferences.loop == false && position + 1 == imageArray) || flags.touched == true){
- window.clearInterval(self.flags.autoID);
- }else{
- self[direction]()
- }
-
- }, this.preferences.autoSpeed);
- }
-
- SwipeToggle.prototype.dots = function () {
- // create dots for the carousel
-
- var index = activeIndex(this.components.slider);
- var slider_name = this.components.name;
- var slider = this.components.slider;
- var imageLength = x$(slider)[0].children.length -1;
- var dotsDiv = document.createElement('div');
- var attributeName = "mw_swipe_toggle_dot"
-
- dotsDiv.setAttribute("class", "mw_" + slider_name + "_dots mw_swipe_dots")
-
- for(var i = 0; i < imageLength + 1; i++){
- tempDivHolder = document.createElement("div");
- tempDivHolder.id = 'mw_image_dot' + (i+1);
- dotsDiv.appendChild(tempDivHolder);
- }
- if (dotsDiv.children[0] === undefined){} else {
- dotsDiv.children[index].setAttribute(attributeName, "active");
- }
- x$(slider).after(dotsDiv);
-
- slider.addEventListener('update', function (e){
- // make new dot active
- var eventSlider = e.slider;
- var name = slider_name;
- var dots_name = "mw_" + slider_name + "_dots";
-
- var index = activeIndex(e.slider);
-
- for (var i = 0; i < imageLength + 1; i++) {
- dotsDiv.children[i].setAttribute(attributeName, "");
- }
- dotsDiv.children[index].setAttribute(attributeName, "active");
- });
- }
-
- SwipeToggle.prototype.autoPopulate = function (autoPopulateList, append) {
- var location = this.components.slider;
- if (autoPopulateList === undefined) {
- console.warn("Swipe Toggle: no items listed")
- }else if (append == "top" || append == "bottom"){
- for (var items in autoPopulateList) {
- x$(location)[append](autoPopulateList[items]);
- }
- this.setActive(this.components.slider.children[0]);
- }
- }
-
- if(components === undefined){}else{
- this.components = swipe_element;
- var slider = this.components.slider;
-
- x$(swipe_element['next']).on("click", function(e){
- Ur.Widgets.SwipeToggle[self.components.name].next(e);
- });
- x$(swipe_element['prev']).on("click", function(e){
- Ur.Widgets.SwipeToggle[self.components.name].prev(e);
- });
-
- if (this.components.slider.children[0] === undefined) {}else{
- this.setActive(this.getActive());
- }
-
-
- var axis = this.preferences.axis;
- if (axis == "x" || axis == "Y") {
- }else{
- Ur.error("incorrect axis set")
- }
-
- setTouch();
-
- if (this.preferences.dots == true) {
- this.dots()
- }
- loadEvent(this.components.slider);
- }
- }
-
- SwipeToggle.prototype.components = {}
-
- SwipeToggle.prototype.setActive = function (obj) {
-
- var activeChangeEvent = function (obj, parent) {
- var event = document.createEvent("Event");
- event.initEvent("update", false, true);
- event.active = obj;
- event.slider = obj.parentNode;
- event.activeElement = obj;
- parent.dispatchEvent(event);
- }
-
- var i;
- var slider = obj.parentNode;
- var siblings = slider.children.length;
- var previousSibling = obj.previousElementSibling;
- var nextSibling = obj.nextElementSibling;
- var nodeType = obj.nodeType;
-
- if (nodeType == 1 && slider == slider){
- obj.setAttribute("data-ur-state", "active");
-
- for(i=0; i<=siblings; i++){
- if(previousSibling === null || previousSibling === undefined){
- break;
- }else{
- previousSibling.setAttribute("data-ur-state", "prev" + (i+1));
- previousSibling = previousSibling.previousElementSibling;
- }
- }
-
- for(i=0; i<=siblings; i++){
- if(nextSibling === null || nextSibling === undefined){
- break;
- }else{
- nextSibling.setAttribute("data-ur-state", "next" + (i+1));
- nextSibling = nextSibling.nextElementSibling;
- }
- }
- }
-
- activeChangeEvent(obj, slider)
-
- return obj;
- }
-
- var lookAhead = function (obj) {
- if(obj.nextElementSibling === null){
- return false;
- }else{
- return true;
- }
- }
-
- var lookBehind = function (obj) {
- if(obj.previousElementSibling === null){
- return false;
- }else{
- return true;
- }
- }
-
- var find = function(fragment){
- var swipe_group = x$(fragment).findElements('swipe-toggle');
-
- for(var component_id in swipe_group) {
- var carousel_group = swipe_group[component_id];
- carousel_group.name = component_id;
- if (carousel_group["slider"] === undefined) {
- Ur.error("no slider found for toggler with id = " + component_id);
- continue;
- }else if (carousel_group["slider"].children[0] === undefined){
- Ur.warn("no children in slider: " + carousel_group )
- }else{
- carousel_group["slider"]["active"] = x$(carousel_group["slider"]).find("[data-ur-state='active']")[0];
- Ur.warn("no active element found for toggler with id = " + component_id);
- if (carousel_group["slider"]["active"] === undefined) {
- console.log("no active element in slider: " + component_id)
- carousel_group["slider"]["active"] = carousel_group["slider"].children[0];
- carousel_group["slider"]["active"].setAttribute("data-ur-state", "active")
- console.log("set active element")
- continue;
- }
- }
- }
- return swipe_group;
- }
-
- SwipeToggle.prototype.initialize = function (fragment) {
- var swipe_group = find(fragment);
- Ur.Widgets["SwipeToggle"] = {};
-
- var prefEvent = function (obj) {
- var event = document.createEvent("Event");
- event.initEvent("preferences", false, true);
- obj.components.slider.dispatchEvent(event);
- }
-
-
- for(var name in swipe_group){
- Ur.Widgets["SwipeToggle"][name] = new SwipeToggle(swipe_group[name]);
- prefEvent(Ur.Widgets["SwipeToggle"][name]);
- }
-
- return swipe_group;
- }
-
- return new SwipeToggle;
-})
-
-
-
-/* Tabs *
- * * * * * *
- * The tabs are like togglers with state. If one is opened, the others are closed
- *
- * Question: Can I assume order is preserved? Ill use IDs for now
- */
-
-Ur.QuickLoaders['tabs'] = (function(){
- function Tabs(data){
- this.elements = data;
- this.setup_callbacks();
- }
-
- Tabs.prototype.setup_callbacks = function() {
- var default_tab = null;
-
- for(var tab_id in this.elements["buttons"]) {
-
- var button = this.elements["buttons"][tab_id];
- var content = this.elements["contents"][tab_id];
-
- if (default_tab === null) {
- default_tab = tab_id;
- }
-
- if(content === undefined) {
- Ur.error("no matching tab content for tab button");
- return;
- }
-
- var state = x$(button).attr("data-ur-state")[0];
- if(state !== undefined && state == "enabled") {
- default_tab = -1;
- }
-
- var closeable = x$(this.elements["set"]).attr("data-ur-closeable")[0];
- closeable = (closeable !== undefined && closeable == "true") ? true : false;
- var self = this;
- x$(button).on(
- "click",
- function(evt) {
- var firstScrollTop = evt.target.offsetTop - document.body.scrollTop;
- var this_tab_id = x$(evt.currentTarget).attr("data-ur-tab-id")[0];
-
- for(var tab_id in self.elements["buttons"]) {
- var button = self.elements["buttons"][tab_id];
- var content = self.elements["contents"][tab_id];
-
- if (tab_id !== this_tab_id) {
- x$(button).attr("data-ur-state","disabled");
- x$(content).attr("data-ur-state","disabled");
- } else {
- var new_state = "enabled";
- if (closeable) {
- var old_state = x$(button).attr("data-ur-state")[0];
- old_state = (old_state === undefined) ? "disabled" : old_state;
- new_state = (old_state == "enabled") ? "disabled" : "enabled";
- }
- x$(button).attr("data-ur-state", new_state);
- x$(content).attr("data-ur-state", new_state);
- }
- }
- var secondScrollTop = evt.target.offsetTop - document.body.scrollTop;
- if ( secondScrollTop <= 0 ) {
- window.scrollBy(0, secondScrollTop - firstScrollTop);
- }
- }
- );
- }
- }
-
- var ComponentConstructors = {
- "button" : function(group, component, type) {
- if (group["buttons"] === undefined) {
- group["buttons"] = {}
- }
-
- var tab_id = x$(component).attr("data-ur-tab-id")[0];
- if (tab_id === undefined) {
- Ur.error("tab defined without a tab-id");
- return;
- }
-
- group["buttons"][tab_id] = component;
- },
- "content" : function(group, component, type) {
- if (group["contents"] === undefined) {
- group["contents"] = {}
- }
-
- var tab_id = x$(component).attr("data-ur-tab-id")[0];
- if (tab_id === undefined) {
- Ur.error("tab defined without a tab-id");
- return;
- }
-
- group["contents"][tab_id] = component;
- }
- }
-
- function TabsLoader(){
- }
-
- TabsLoader.prototype.initialize = function(fragment) {
- var tabs = x$(fragment).findElements('tabs', ComponentConstructors);
- Ur.Widgets["tabs"] = {};
-
- for(var name in tabs){
- var tab = tabs[name];
- Ur.Widgets["tabs"][name] = new Tabs(tabs[name]);
- }
- }
-
- return TabsLoader;
-})();
-
-/* Toggler *
-* * * * * *
-* The toggler alternates the state of all the content elements bound to the
-* toggler button.
-*
-* If no initial state is provided, the default value 'disabled'
-* is set upon initialization.
-*/
-
-Ur.QuickLoaders['toggler'] = (function(){
- function ToggleContentComponent (group, content_component) {
- // This is a 'collection' of components
- // -- if I see it again, I'll make this abstract
- if(group["content"] === undefined) {
- group["content"] = [];
- }
- group["content"].push(content_component);
- }
-
- function ToggleLoader(){
- this.component_constructors = {
- "content" : ToggleContentComponent
- };
- }
-
- ToggleLoader.prototype.find = function(fragment){
- var togglers = x$(fragment).findElements('toggler', this.component_constructors);
- var self=this;
-
- for(var toggler_id in togglers) {
- var toggler = togglers[toggler_id];
-
- if (toggler["button"] === undefined) {
- Ur.error("no button found for toggler with id=" + toggler_id);
- continue;
- }
-
- var toggler_state = x$(toggler["button"]).attr("data-ur-state")[0];
- if(toggler_state === undefined) {
- x$(toggler["button"]).attr("data-ur-state", 'disabled');
- toggler_state = "disabled";
- }
-
- if (toggler["content"] === undefined) {
- Ur.error("no content found for toggler with id=" + toggler_id);
- continue;
- }
-
- // Make the content state match the button state
- x$().iterate(
- toggler["content"],
- function(content) {
- if (x$(content).attr("data-ur-state")[0] === undefined ) {
- x$(content).attr("data-ur-state", toggler_state)
- }
- }
- );
-
- }
-
- return togglers;
- }
-
- ToggleLoader.prototype.construct_button_callback = function(contents, set) {
- var self = this;
- return function(evt) {
- var button = evt.currentTarget;
- var current_state = x$(button).attr("data-ur-state")[0];
- var new_state = current_state === "enabled" ? "disabled" : "enabled";
-
- x$(button).attr("data-ur-state", new_state);
- x$(set).attr("data-ur-state", new_state);
-
- x$().iterate(
- contents,
- function(content){
- var current_state = x$(content).attr("data-ur-state")[0];
- var new_state = current_state === "enabled" ? "disabled" : "enabled";
- x$(content).attr("data-ur-state", new_state);
- }
- );
- }
- }
-
- ToggleLoader.prototype.initialize = function(fragment) {
- var togglers = this.find(fragment);
- for(var name in togglers){
- var toggler = togglers[name];
- // if (togglers)
- x$(toggler["button"]).click(this.construct_button_callback(toggler["content"], toggler["set"]));
- x$(toggler["set"]).attr("data-ur-state","enabled");
- }
- }
-
- return ToggleLoader;
- })();
-
-/* Zoom Preview *
- * * * * * * * * *
- * The zoom-preview widget provides a thumbnail button that when touched
- * displays and translates the zoom-image.
- *
- */
-
-Ur.QuickLoaders['zoom-preview'] = (function(){
-
- function ZoomPreview(data){
- this.elements = data["elements"];
- this.modifier = {};
-
- if (data["modifier"] !== null) {
- this.modifier = data["modifier"];
- }
- this.dimensions = {};
- this.zoom = false;
-
- this.update();
- this.events = {"start": "touchstart", "move" : "touchmove", "end" : "touchend"};
-
- this.touch = xui.touch;
-
- // Would be cool to compile this out
- if (!this.touch)
- this.events = {"move" : "mousemove", "end" : "mouseout"};
-
- this.initialize();
- console.log("Zoom Preview Loaded");
- }
-
- ZoomPreview.prototype.rewrite_images = function(src, match, replace) {
- if(typeof(src) == "undefined")
- return false;
-
- if(match === undefined && replace === undefined) {
- match = this.modifier["zoom_image"]["match"];
- replace = this.modifier["zoom_image"]["replace"];
- }
-
- this.elements["zoom_image"].src = src.replace(match, replace);
-
- match = replace = null;
-
- if(this.modifier["button"]) {
- match = this.modifier["button"]["match"];
- replace = this.modifier["button"]["replace"];
- }
-
- if(match && replace) {
- this.elements["button"].src = this.elements["zoom_image"].src.replace(match, replace);
- } else {
- this.elements["button"].src = this.elements["zoom_image"].src;
- }
-
- var self = this;
- this.elements["zoom_image"].style.visibility = "hidden";
- x$(this.elements["zoom_image"]).on("load", function(){self.update()});
- x$(this.elements["button"]).on("load", function(){x$(self.elements["button"]).addClass("loaded");});
- // TODO: Make this callback add the 'loaded' state
- }
-
- ZoomPreview.prototype.update = function() {
- var self = this;
- x$().iterate(
- ["button","zoom_image","container"],
- function(elem) {
- self.dimensions[elem] = [self.elements[elem].offsetWidth, self.elements[elem].offsetHeight];
- }
- );
-
- var offset = x$(this.elements["button"]).offset();
- var button_offset = [offset["left"], offset["top"]];
-
- this.button_center = [this.dimensions["button"][0]/2.0 + button_offset[0],
- this.dimensions["button"][1]/2.0 + button_offset[1]];
-
- this.image_origin = [-1.0/2.0*this.dimensions["zoom_image"][0], -1.0/2.0*this.dimensions["zoom_image"][1]];
- }
-
- ZoomPreview.prototype.get_event_coordinates = function(event) {
- if (!this.touch){
- return [event.pageX, event.pageY];
- } else {
- if(event.touches.length == 1)
- {
- return [event.touches[0].pageX, event.touches[0].pageY];
- }
- }
- }
-
- ZoomPreview.prototype.initialize = function() {
- x$(this.elements["button"]).on(this.events["move"],function(obj){return function(evt){obj.scroll_zoom(evt)};}(this));
- x$(this.elements["button"]).on(this.events["end"],function(obj){return function(evt){obj.scroll_end(evt)};}(this));
-
- // To prevent scrolling:
- if(this.events["start"]) {
- x$(this.elements["button"]).on("touchstart",function(obj){return function(evt){evt.preventDefault()};}(this));
- }
-
- var self = this;
- x$(this.elements["thumbnails"]).click(
- function(obj) {
- return function(evt){
- if (evt.target.tagName != "IMG")
- return false;
- obj.rewrite_images(evt.target.src); //, obj.modifier["match"], obj.modifier["replace"]);
- };
- }(self)
- );
-
- // Setup the initial button/zoom image:
- this.normal_image_changed();
-
- }
-
- ZoomPreview.prototype.normal_image_changed = function(new_normal_image) {
- if (new_normal_image !== undefined) {
- this.elements["normal_image"] = new_normal_image;
- }
-
- img = x$(this.elements["normal_image"]);
- this.rewrite_images(img.attr("src")[0], this.modifier["normal_image"]["match"], this.modifier["normal_image"]["replace"]);
- }
-
- ZoomPreview.prototype.scroll_end = function(event) {
- this.elements["zoom_image"].style.visibility = "hidden";
- }
-
- ZoomPreview.prototype.scroll_zoom = function(event) {
- this.elements["zoom_image"].style.visibility = "visible";
-
- var position = this.get_event_coordinates(event);
- if (position === null) {return false};
-
- var percents = [(position[0] - this.button_center[0])/this.dimensions["button"][0],
- (position[1] - this.button_center[1])/this.dimensions["button"][1]];
-
- var delta = [this.dimensions["zoom_image"][0] * percents[0],
- this.dimensions["zoom_image"][1] * percents[1]];
-
- var translate = [this.image_origin[0] - delta[0],
- this.image_origin[1] - delta[1]];
-
- translate = this.check_bounds(translate);
- this.elements["zoom_image"].style.webkitTransform = "translate3d(" + translate[0] + "px," + translate[1] + "px,0px)";
- }
-
- ZoomPreview.prototype.check_bounds = function(translate){
- var min = [this.dimensions["container"][0]-this.dimensions["zoom_image"][0], this.dimensions["container"][1]-this.dimensions["zoom_image"][1]];
-
- x$().iterate(
- [0,1],
- function(index){
- if (translate[index] >= 0)
- translate[index] = 0;
- if (translate[index] <= min[index])
- translate[index] = min[index];
- }
- );
-
- return translate;
- }
-
- var ComponentConstructors = {
- "_modifiers" : function(group, component, type, modifier_prefix) {
- if (group["modifier"] === undefined) {
- group["modifier"] = {};
- }
-
- var prefix = (modifier_prefix === undefined) ? "src" : "zoom";
- console.log("searching for modifier:", prefix, component);
- var match = x$(component).attr("data-ur-" + prefix + "-modifier-match")[0];
- var replace = x$(component).attr("data-ur-" + prefix + "-modifier-replace")[0];
-
- if(typeof(match) != "undefined" && typeof(replace) != "undefined") {
- console.log("found modifiers:",match,replace);
- group["modifier"][type] = {"match":new RegExp(match),"replace":replace};
- }
- },
- "_construct" : function(group, component, type, modifier_prefix) {
- if (group["elements"] === undefined) {
- group["elements"] = {};
- }
- group["elements"][type] = component;
- this._modifiers(group, component, type, modifier_prefix);
- },
- "normal_image" : function(group, component, type) {
- this._construct(group, component, type, "zoom");
- },
- "zoom_image" : function(group, component, type) {
- this._construct(group, component, type);
- },
- "button" : function(group, component, type) {
- this._construct(group, component, type);
- },
- "container" : function(group, component, type) {
- this._construct(group, component, type);
- },
- "thumbnails" : function(group, component, type) {
- this._construct(group, component, type);
- }
- }
-
- function ZoomPreviewLoader(){
- }
-
- ZoomPreviewLoader.prototype.initialize = function(fragment) {
- this.zoom_previews = x$(fragment).findElements('zoom-preview', ComponentConstructors);
- Ur.Widgets["zoom-preview"] = {};
- for (var name in this.zoom_previews) {
- Ur.Widgets["zoom-preview"][name] = new ZoomPreview(this.zoom_previews[name]);
- x$(this.zoom_previews[name]["set"]).attr("data-ur-state","enabled");
- }
- }
-
- return ZoomPreviewLoader;
-})();
\ No newline at end of file
diff --git a/examples/site/stylesheets/base.css b/examples/site/stylesheets/base.css
deleted file mode 100644
index c9d46dd..0000000
--- a/examples/site/stylesheets/base.css
+++ /dev/null
@@ -1,1218 +0,0 @@
-body#carousel_page [data-ur-carousel-component='view_container'] {
- background: #ffd700 url("resources/largeshade.png") no-repeat left bottom;
- border: 1px solid black;
- overflow: hidden;
- position: relative;
- height: 250px; }
-body#carousel_page [data-ur-infinite="enabled"] [data-ur-carousel-component="scroll_container"] {
- margin: auto;
- width: 250px; }
-body#carousel_page [data-ur-carousel-component="scroll_container"] img {
- -webkit-user-drag: none;
- float: left;
- width: 250px;
- height: 250px; }
-body#carousel_page [data-ur-carousel-component="button"] {
- display: inline-block; }
- body#carousel_page [data-ur-carousel-component="button"][data-ur-state="disabled"] {
- opacity: 0.3; }
-body#carousel_page .test [data-ur-carousel-component="view_container"] {
- width: 50%; }
-body#carousel_page [data-ur-carousel-component="dots"] {
- float: right; }
-body#carousel_page [data-ur-carousel-component="dot"] {
- -moz-border-radius: 7px;
- -webkit-border-radius: 7px;
- -o-border-radius: 7px;
- -ms-border-radius: 7px;
- -khtml-border-radius: 7px;
- border-radius: 7px;
- background: black;
- display: inline-block;
- margin: 0 5px;
- opacity: 0.8;
- width: 10px;
- height: 10px; }
- body#carousel_page [data-ur-carousel-component="dot"][data-ur-state="inactive"] {
- opacity: 0.3; }
-body#carousel_page div[name='Three'] img {
- width: 62px !important;
- height: 62px; }
-
-body#compatibility_page th {
- background: silver; }
-body#compatibility_page td {
- text-align: center;
- background: #fafafa; }
-body#compatibility_page td.passed {
- background: #c7e8ad; }
-body#compatibility_page td.failed {
- background: #e8b5ad; }
-body#compatibility_page td.mixed {
- background: #fbf6bb; }
-body#compatibility_page li {
- color: #323232;
- background: #fafafa;
- margin: 10px;
- width: 200px;
- padding: 5px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px; }
-body#compatibility_page li.passed {
- background: #c7e8ad; }
-body#compatibility_page li.failed {
- background: #e8b5ad; }
-body#compatibility_page li.mixed {
- background: #fbf6bb; }
-
-.demonstration h3 {
- color: #323232; }
-.demonstration *[data-ur-tabs-component='button'] {
- opacity: 0.5;
- background: silver;
- border: 1px solid black;
- border-top-left-radius: 5px 5px;
- border-top-right-radius: 5px 5px;
- bottom: -1px;
- display: inline-block;
- margin: 0px 5px;
- padding: 5px;
- position: relative; }
-.demonstration *[data-ur-tabs-component='content'] {
- display: none;
- background: silver; }
-.demonstration *[data-ur-tabs-component='button'][data-ur-state='enabled'] {
- opacity: 1;
- background: silver;
- border-bottom: 1px solid silver; }
-.demonstration *[data-ur-tabs-component='content'][data-ur-state='enabled'] {
- display: block;
- background: silver;
- border: 1px solid black;
- padding: 20px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px; }
-.demonstration *[data-ur-set="tabs"][data-ur-tab-id="html"] {
- text-align: left; }
-.demonstration #tab_widget *[data-ur-set="tabs"] *[data-ur-tabs-component="button"] {
- background: silver; }
-.demonstration #tab_widget *[data-ur-set="tabs"] *[data-ur-tabs-component="content"] {
- background: silver; }
-
-body#geocode_page div[data-ur-carousel-component='view_container'] {
- height: 270px;
- width: 100%;
- overflow-x: hidden;
- border: 1px solid black;
- background-color: #99cc00; }
-body#geocode_page div[data-ur-carousel-component="scroll_container"] {
- display: block; }
- body#geocode_page div[data-ur-carousel-component="scroll_container"] > * {
- display: inline-block;
- float: left; }
-body#geocode_page div[data-ur-carousel-component="button"] {
- display: inline-block; }
- body#geocode_page div[data-ur-carousel-component="button"][data-ur-state="disabled"] {
- opacity: 0.3; }
-body#geocode_page #giant {
- height: 1000px;
- background-color: #ff6600;
- border: 1px solid black;
- margin: 5px;
- padding: 5px; }
-body#geocode_page div[name='Three'] img {
- width: 62px !important;
- height: 62px; }
-
-#blurb {
- text-align: center; }
- #blurb #headline {
- font-size: 50px; }
- #blurb #subline {
- font-style: italic; }
-
-.example {
- border: 2px solid black;
- padding: 10px;
- margin: 5px; }
-
-.demonstration {
- margin: 5px;
- padding: 10px; }
-
-.explanation {
- margin: 5px;
- margin-left: 330px;
- padding: 5px;
- width: 500px;
- border: 1px solid black; }
- .explanation .code {
- border: 1px solid gray;
- border-width: 1px 1px 4px 6px;
- padding: 10px;
- background: #cdcdcd; }
-
-[data-ur-set="toggler"] {
- background: #fafafa;
- color: black;
- padding: 5px;
- border: 1px solid black; }
- [data-ur-set="toggler"] p {
- margin: 0em; }
- [data-ur-set="toggler"] [data-ur-toggler-component="button"] {
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- background: #ffd700 url("resources/largeshade.png") no-repeat left bottom;
- color: black;
- margin: 5px;
- padding: 5px; }
- [data-ur-set="toggler"] [data-ur-toggler-component='content'] {
- display: none; }
- [data-ur-set="toggler"] [data-ur-toggler-component='content'][data-ur-state='enabled'] {
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- display: block;
- margin: 5px;
- padding: 5px;
- background: #ffd700 url("resources/largeshade.png") no-repeat left bottom;
- color: black; }
- [data-ur-set="toggler"] [data-ur-toggler-component='content'][data-ur-state='enabled'] li {
- color: black;
- margin-left: 50px; }
-
-#exselectlist {
- border: 1px solid black;
- background: #fafafa;
- color: black;
- padding: 5px; }
- #exselectlist [data-ur-state='enabled'] {
- background: #ffd700 url("resources/largeshade.png") no-repeat left bottom; }
-
-#excarousel [data-ur-set="carousel"] [data-ur-carousel-component="view_container"] {
- overflow-x: hidden; }
-#excarousel [data-ur-set="carousel"] [data-ur-carousel-component="scroll_container"] {
- margin: auto;
- overflow: hidden;
- position: relative;
- width: 100px;
- height: 100px; }
- #excarousel [data-ur-set="carousel"] [data-ur-carousel-component="scroll_container"] img {
- float: left;
- width: 100px;
- height: 100px; }
-#excarousel [data-ur-set="carousel"] [data-ur-carousel-component="button"][data-ur-state="disabled"] {
- opacity: 0.3; }
-
-*[data-ur-map-component='canvas'] {
- width: 300px;
- height: 300px; }
-*[data-ur-map-component='description'] {
- display: none; }
- *[data-ur-map-component='description'][data-ur-state='enabled'] {
- display: block; }
-*[data-ur-map-component='address'] {
- display: none; }
-*[data-ur-map-component='icon'] {
- position: absolute;
- visibility: hidden; }
-
-body[id*='map'] .attributes {
- display: block;
- background: silver url("resources/largestshade.png") no-repeat left bottom;
- border: 1px solid black;
- padding: 20px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px; }
-
-body.hidden_page [data-ur-set='map'] {
- position: absolute;
- visibility: hidden; }
-body.hidden_page [data-ur-toggler-component='content'][data-ur-state='enabled'] > [data-ur-set='map'] {
- position: relative;
- visibility: visible; }
-
-body#advanced_map_page *[data-ur-set="map"] {
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- display: hidden;
- margin: 5px;
- padding: 5px;
- background: gold url("resources/largeshade.png") no-repeat left bottom;
- color: black;
- width: 300px; }
- body#advanced_map_page *[data-ur-set="map"] *[data-ur-map-component="icon"] img {
- width: 10px;
- height: 10px; }
-
-body#hidden_map_page [data-ur-set="toggler"] {
- background: #323232;
- border: none; }
-
-body#late_load_map_page span#map_button {
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- background: gold url("resources/largeshade.png") no-repeat left bottom;
- color: black;
- margin: 5px;
- padding: 5px; }
-body#late_load_map_page *[data-ur-set="map"] {
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- display: hidden;
- margin: 5px;
- padding: 5px;
- background: gold url("resources/largeshade.png") no-repeat left bottom;
- color: black;
- width: 300px; }
-
-body#font_resizer_page p[data-ur-font-resizer-component="content"] {
- color: black; }
-
-body#font_resizer_page .font_resizer {
- background: silver;
- color: #323232;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- padding: 10px; }
- body#font_resizer_page .font_resizer p {
- color: #323232; }
-
-body#select_buttons_page [data-ur-select-buttons-component] {
- border-radius: 5px;
- display: inline-block;
- width: 30px;
- height: 20px;
- text-align: center;
- margin: 5px; }
-body#select_buttons_page [data-ur-select-buttons-component='select'] {
- width: 100px; }
-body#select_buttons_page [data-ur-select-buttons-component='increment'] {
- background-color: #c7e8ad; }
-body#select_buttons_page [data-ur-select-buttons-component='decrement'] {
- background-color: #e8b5ad; }
-body#select_buttons_page [data-ur-select-buttons-component][data-ur-state='disabled'] {
- opacity: 0.5; }
-
-body#select_list_page .demonstration #select_list_demonstration *[data-ur-set="select-list"] {
- width: 230px;
- height: 150px;
- background: #fafafa url("resources/largeshade.png") no-repeat left bottom;
- padding: 6px;
- padding-left: 10px;
- padding-right: 10px;
- margin: auto;
- margin-top: 30px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px; }
- body#select_list_page .demonstration #select_list_demonstration *[data-ur-set="select-list"] select {
- width: 100%; }
- body#select_list_page .demonstration #select_list_demonstration *[data-ur-set="select-list"] ul {
- padding: 0px; }
- body#select_list_page .demonstration #select_list_demonstration *[data-ur-set="select-list"] ul li {
- color: #323232;
- font-size: 18px;
- font-family: Rockwell;
- text-align: center;
- list-style: none; }
-body#select_list_page [data-ur-set="select-list"] {
- text-align: center; }
-body#select_list_page [data-ur-id="MyUIDSelectList"][data-ur-select-list-component="content"] {
- color: #fafafa;
- text-align: left;
- background: silver;
- width: 250px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px; }
- body#select_list_page [data-ur-id="MyUIDSelectList"][data-ur-select-list-component="content"] [data-ur-state="enabled"] {
- background-color: #ffd700 url("resources/largeshade.png") no-repeat left bottom; }
- body#select_list_page [data-ur-id="MyUIDSelectList"][data-ur-select-list-component="content"] span {
- margin: 10px;
- padding-left: 10px;
- padding-right: 10px; }
-
-body#styling_page *[data-ur-toggler-component='button'][data-ur-id='LazyPopup'] {
- border-radius: 5px;
- background: #ffd700;
- opacity: 0.5;
- padding: 5px;
- display: inline;
- margin: 0px 5px; }
- body#styling_page *[data-ur-toggler-component='button'][data-ur-id='LazyPopup'][data-ur-state='enabled'] {
- opacity: 1; }
-body#styling_page *[data-ur-toggler-component='content'][data-ur-id='LazyPopup'] {
- display: none;
- position: absolute;
- border-radius: 5px;
- background-color: #aaaaaa;
- width: 300px;
- height: 350px;
- left: 200px;
- bottom: -50px;
- text-align: center;
- padding-top: 30px; }
- body#styling_page *[data-ur-toggler-component='content'][data-ur-id='LazyPopup'][data-ur-state='enabled'] {
- display: block; }
-body#styling_page .popup_content {
- position: absolute;
- border-radius: 5px;
- background-color: #aaaaaa;
- bottom: -600px;
- text-align: center;
- padding: 30px;
- z-index: 1; }
-body#styling_page .popup_button {
- border-radius: 5px;
- background: blue;
- opacity: 1;
- padding: 5px;
- display: inline;
- margin: 0px 5px; }
- body#styling_page .popup_button > span {
- border-radius: 5px;
- background: blue;
- opacity: 1;
- padding: 5px;
- display: inline;
- margin: 0px 5px; }
-body#styling_page *[data-ur-id="ProperPopup"] {
- background: #323232;
- border: none; }
-body#styling_page *[data-ur-id='ProperPopup'] *[data-ur-toggler-component='button'] {
- background: #64953d; }
- body#styling_page *[data-ur-id='ProperPopup'] *[data-ur-toggler-component='button'][data-ur-state='disabled'] {
- background: #ffd700;
- opacity: 0.5; }
- body#styling_page *[data-ur-id='ProperPopup'] *[data-ur-toggler-component='button'][data-ur-state='enabled'] {
- background: #ffd700;
- opacity: 1; }
-body#styling_page *[data-ur-id='ProperPopup'] *[data-ur-toggler-component='content'][data-ur-state='disabled'] {
- display: none;
- opacity: 0.5; }
-body#styling_page *[data-ur-id='ProperPopup'] *[data-ur-toggler-component='content'][data-ur-state='enabled'] {
- display: inline-block;
- opacity: 1; }
-
-body#grouping_page [data-ur-set="toggler"] {
- background: none;
- border: none; }
-body#grouping_page [data-ur-toggler-component="button"] {
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- background: gold url("{{site.url}}resources/largeshade.png") no-repeat left bottom;
- color: black;
- margin: 5px;
- padding: 5px;
- width: 300px;
- border: none; }
-body#grouping_page [data-ur-toggler-component="content"] {
- display: none; }
-body#grouping_page [data-ur-toggler-component="content"][data-ur-state="enabled"] {
- webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- display: block;
- margin: 5px;
- padding: 5px;
- background: gold url("{{site.url}}resources/largeshade.png") no-repeat left bottom;
- color: black;
- width: 300px; }
- body#grouping_page [data-ur-toggler-component="content"][data-ur-state="enabled"] li {
- margin-left: 50px;
- color: black; }
-body#grouping_page img {
- border: 3px dashed #3c3c3c;
- padding: 5px;
- display: block;
- margin-left: auto;
- margin-right: auto; }
-
-body#who_page [data-ur-set="toggler"] {
- background: none;
- border: none; }
- body#who_page [data-ur-set="toggler"] [data-ur-toggler-component="button"] {
- width: 250px; }
- body#who_page [data-ur-set="toggler"] [data-ur-toggler-component="content"] {
- display: none;
- width: 250px; }
- body#who_page [data-ur-set="toggler"] [data-ur-toggler-component="content"][data-ur-state="enabled"] {
- display: block; }
-
-body#tabs_page *[data-ur-tabs-component='button'] {
- background-color: silver;
- border: 1px solid black;
- border-top-left-radius: 5px 5px;
- border-top-right-radius: 5px 5px;
- bottom: -1px;
- display: inline-block;
- margin: 0px 5px;
- padding: 5px;
- position: relative; }
- body#tabs_page *[data-ur-tabs-component='button']#babutton {
- padding-top: 6px;
- padding-bottom: 0px;
- padding-left: 0px;
- padding-right: 0px;
- margin: 0; }
- body#tabs_page *[data-ur-tabs-component='button']#babutton[data-ur-state="disabled"] {
- background: #ffd700;
- color: #323232;
- opacity: 0.2; }
- body#tabs_page *[data-ur-tabs-component='button']#babutton[data-ur-state="enabled"] {
- color: #323232;
- background: #ffd700; }
- body#tabs_page *[data-ur-tabs-component='button']#babutton[data-ur-tab-id="advancedpage"] {
- margin-right: 100px;
- margin-left: 0px;
- margin-top: 0px;
- margin-bottom: 0px; }
-body#tabs_page *[data-ur-tabs-component='content'] {
- display: none;
- background-color: silver; }
-body#tabs_page *[data-ur-tabs-component='button'][data-ur-state='disabled'] {
- opacity: 0.5; }
-body#tabs_page *[data-ur-tabs-component='button'][data-ur-state='enabled'] {
- opacity: 1;
- border-bottom: 1px solid silver; }
-body#tabs_page *[data-ur-tabs-component='content'][data-ur-state='enabled'] {
- display: block;
- background-color: silver;
- border: 1px solid black;
- padding: 20px; }
-body#tabs_page *[data-ur-set="tabs"][data-ur-tab-id="html"] {
- text-align: left; }
-body#tabs_page #tab_widget *[data-ur-set="tabs"] *[data-ur-tabs-component="button"] {
- background: #ffd700; }
-body#tabs_page #tab_widget *[data-ur-set="tabs"] *[data-ur-tabs-component="button"][data-ur-state="enabled"] {
- background: #ffd700;
- border-bottom: 1px solid #ffd700; }
-body#tabs_page #tab_widget *[data-ur-set="tabs"] *[data-ur-tabs-component="content"] {
- background: #ffd700; }
-body#tabs_page div[name='accordions'] *[data-ur-tabs-component='button'] {
- display: block;
- border: 1px solid blue;
- background-color: white; }
-body#tabs_page div[name='accordions'] *[data-ur-tabs-component='content'] {
- background-color: white;
- margin: 0px 20px; }
-body#tabs_page #tabs_examples_page *[data-ur-tabs-component='button'] {
- opacity: 0.5;
- background-color: #ffd700;
- border: 1px solid black;
- border-top-left-radius: 5px 5px;
- border-top-right-radius: 5px 5px;
- bottom: -1px;
- display: inline-block;
- margin: 0px 5px;
- padding: 5px;
- position: relative; }
-body#tabs_page #tabs_examples_page *[data-ur-tabs-component='content'] {
- display: none;
- background-color: #ffd700;
- border-radius: 5px; }
-body#tabs_page #tabs_examples_page *[data-ur-tabs-component='button'][data-ur-state='enabled'] {
- opacity: 1;
- border-bottom: 1px solid #ffd700; }
-body#tabs_page #tabs_examples_page *[data-ur-tabs-component='content'][data-ur-state='enabled'] {
- display: block;
- background-color: #ffd700;
- border: 1px solid black;
- padding: 20px; }
-body#tabs_page #tabs_examples_page *[data-ur-set="tabs"][data-ur-tab-id="html"] {
- text-align: left; }
-body#tabs_page #tabs_examples_page #tab_widget *[data-ur-set="tabs"] *[data-ur-tabs-component="button"] {
- background: #ffd700; }
-body#tabs_page #tabs_examples_page #tab_widget *[data-ur-set="tabs"] *[data-ur-tabs-component="content"] {
- background: #ffd700; }
-body#tabs_page #tabs_examples_page div[name='accordions'] *[data-ur-tabs-component='button'] {
- display: block;
- border: 1px solid black;
- background-color: #ffd700;
- border-radius: 5px; }
-body#tabs_page #tabs_examples_page div[name='accordions'] *[data-ur-tabs-component='content'] {
- background-color: #ffd700;
- margin: 0px 20px; }
-
-li[data-ur-set="toggler"] [data-ur-toggler-component='button'] {
- background-color: #a3e2f5; }
-li[data-ur-set="toggler"] [data-ur-toggler-component='content'] {
- display: none;
- background-color: #d0e9f0; }
- li[data-ur-set="toggler"] [data-ur-toggler-component='content'][data-ur-state="enabled"] {
- display: block; }
-
-#adv_btn, #basic_btn {
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- -o-border-radius: 5px;
- -ms-border-radius: 5px;
- -khtml-border-radius: 5px;
- border-radius: 5px;
- background: #ffd700;
- color: #323232;
- width: 98px;
- height: 25px;
- padding-top: 6px;
- font-size: 15px;
- text-align: center;
- float: right;
- display: inline-block;
- border-left: 1.5px solid #505050;
- border-right: 1.5px solid black; }
- #adv_btn[data-ur-state="disabled"], #basic_btn[data-ur-state="disabled"] {
- opacity: 0.2; }
-
-#adv_btn {
- margin-right: 100px; }
-
-.components li {
- color: #323232; }
-
-.components *[data-ur-toggler-component="button"], .components *[data-ur-flex-table-component] {
- color: #323232;
- background: none;
- font-weight: bold;
- margin-bottom: 5px;
- padding: 5px;
- border: 2px dashed #fafafa;
- display: inline-block;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px; }
-
-.attributes {
- margin-bottom: 15px; }
-
-.attributes h3 {
- color: #323232; }
-
-.attributes *[data-ur-tabs-component="content"] li {
- color: #323232; }
-
-.attributes .inline_code {
- background: none;
- color: #323232; }
-
-.attributes .set_name {
- padding: 5px;
- font-weight: bold;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- display: inline-block;
- border: 2px dashed #fafafa;
- margin-bottom: 10px;
- margin-left: 25px; }
-
-.attributes *[data-ur-tabs-component="content"] li *[data-ur-toggler-component="content"] li [data-ur-state="enabled"] {
- color: #323232; }
-
-.attributes *[data-ur-tabs-component='button'] {
- opacity: 0.5;
- background: silver url("resources/largeshade.png") no-repeat left bottom;
- border: 1px solid black;
- border-top-left-radius: 5px 5px;
- border-top-right-radius: 5px 5px;
- bottom: -1px;
- display: inline-block;
- margin: 0px 5px;
- padding: 5px;
- position: relative; }
-
-.attributes *[data-ur-tabs-component='content'] {
- display: none;
- background: silver; }
-
-.attributes *[data-ur-tabs-component='button'][data-ur-state='enabled'] {
- opacity: 1;
- background: #fafafa;
- border-bottom: 1px solid #fafafa; }
-
-.attributes *[data-ur-tabs-component='content'][data-ur-state='enabled'] {
- display: block;
- background: silver url("resources/largestshade.png") no-repeat left bottom;
- padding: 20px;
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- -o-border-radius: 5px;
- -ms-border-radius: 5px;
- -khtml-border-radius: 5px;
- border-radius: 5px; }
-
-.attributes *[data-ur-set="tabs"][data-ur-tab-id="html"] {
- text-align: left; }
-
-.attributes #tab_widget *[data-ur-set="tabs"] *[data-ur-tabs-component="button"] {
- background: silver; }
-
-.attributes #tab_widget *[data-ur-set="tabs"] *[data-ur-tabs-component="content"] {
- background: silver; }
-
-.attributes .advanced_tab ul {
- list-style-type: none;
- margin-bottom: 10px; }
-
-.attributes li[data-ur-set="toggler"] {
- padding: 10px; }
-
-.attributes li[data-ur-set="toggler"] [data-ur-toggler-component='button'] {
- background: none;
- color: #323232;
- padding: none;
- border: 1px dashed #fafafa;
- border-raduis: none; }
-
-.attributes li[data-ur-set="toggler"] [data-ur-toggler-component='content'] {
- display: none; }
-
-.attributes li[data-ur-set="toggler"] [data-ur-toggler-component='content'][data-ur-state="enabled"] {
- display: block;
- background: none;
- width: 100%;
- color: #323232; }
-
-.attributes li[data-ur-set="toggler"] [data-ur-toggler-component='content'][data-ur-state="enabled"] li {
- color: #323232; }
-
-.attributes p.instance {
- color: #323232; }
-
-body#togglers_page *[data-ur-set="toggler"] {
- border: none;
- background: silver; }
-body#togglers_page *[data-ur-toggler-component='button'] {
- background-color: #ffd700; }
-body#togglers_page *[data-ur-toggler-component='content'] {
- display: none;
- background-color: #ffd700; }
-body#togglers_page *[data-ur-toggler-component='button'][data-ur-state='enabled'] {
- opacity: 1; }
-body#togglers_page *[data-ur-toggler-component='content'][data-ur-state='enabled'] {
- display: block; }
-body#togglers_page .components [data-ur-toggler-component='button'] {
- background: none; }
-body#togglers_page div[name='Dialog'] *[data-ur-toggler-component='button'] {
- border-radius: 5px;
- background-color: #ffd700;
- opacity: 1;
- padding: 5px; }
-body#togglers_page div[name='Dialog'] *[data-ur-toggler-component='content'] {
- display: none;
- position: absolute;
- border-radius: 5px;
- background-color: #aaaaaa;
- width: 500px;
- height: 500px;
- left: 200px;
- bottom: 50px;
- text-align: center;
- padding-top: 30px; }
- body#togglers_page div[name='Dialog'] *[data-ur-toggler-component='content'][data-ur-state='enabled'] {
- display: block; }
-body#togglers_page .popup_button {
- border-radius: 5px;
- background-color: #ffd700;
- opacity: 1;
- padding: 5px;
- display: inline;
- margin: 0px 5px; }
- body#togglers_page .popup_button > span {
- border-radius: 5px;
- background-color: #ffd700;
- opacity: 1;
- padding: 5px;
- display: inline;
- margin: 0px 5px; }
-body#togglers_page .popup_content {
- position: absolute;
- border-radius: 5px;
- background-color: #aaaaaa;
- left: 200px;
- text-align: center;
- padding: 30px; }
- body#togglers_page .popup_content[data-ur-state='disabled'] {
- display: none;
- opacity: 0.5; }
- body#togglers_page .popup_content[data-ur-state='enabled'] {
- display: inline-block;
- opacity: 1; }
- body#togglers_page .popup_content[data-ur-state='enabled'] img {
- width: 200px;
- height: 200px; }
-body#togglers_page [name='MultipleContents'] .buttons {
- background-color: white;
- opacity: 1; }
-body#togglers_page .buttons[data-ur-state="enabled"] span:last-child, body#togglers_page .buttons[data-ur-state="disabled"] span:first-child {
- opacity: 0.5; }
-body#togglers_page [name='MultipleContents'] .popup_content {
- position: relative;
- width: 250px;
- height: 250px;
- padding: 20px; }
- body#togglers_page [name='MultipleContents'] .popup_content img {
- width: 200px;
- height: 200px; }
-body#togglers_page [name='MultipleContents'] [data-ur-toggler-component="content"] {
- display: inline-block; }
-
-body#togglers_page *[data-ur-toggler-component='button'] {
- opacity: 0.5;
- border-radius: 5px;
- background-color: #ffd700;
- opacity: 1;
- padding: 5px;
- width: 190px;
- height: 30px;
- margin: auto;
- margin-top: 15px;
- padding-top: 10px;
- color: #323232;
- font-size: 18px;
- font-family: Rockwell;
- text-align: center;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px; }
-body#togglers_page *[data-ur-toggler-component='content'] {
- display: none;
- background-color: #ffd700;
- border-radius: 5px;
- opacity: 1;
- padding: 5px;
- width: 190px;
- margin: auto;
- margin-top: 15px;
- padding-top: 10px;
- color: black;
- font-size: 18px;
- font-family: Rockwell;
- text-align: center;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px; }
- body#togglers_page *[data-ur-toggler-component='content'] li {
- color: black;
- margin-left: 30px; }
- body#togglers_page *[data-ur-toggler-component='content'] li[data-ur-set="toggler"] {
- border: none;
- background: #fafafa; }
- body#togglers_page *[data-ur-toggler-component='content'] li[data-ur-set="toggler"] [data-ur-toggler-component="button"] {
- background: #fafafa;
- padding-top: 0px; }
- body#togglers_page *[data-ur-toggler-component='content'] li[data-ur-set="toggler"] [data-ur-toggler-component="content"][data-ur-state="enabled"] {
- background: #fafafa;
- width: 100px; }
-body#togglers_page *[data-ur-toggler-component='button'][data-ur-state='enabled'] {
- opacity: 1; }
-body#togglers_page *[data-ur-toggler-component='content'][data-ur-state='enabled'] {
- display: block; }
-body#togglers_page div[name='Dialog'] *[data-ur-toggler-component='button'] {
- border-radius: 5px;
- background-color: #ffd700;
- opacity: 1;
- padding: 5px;
- width: 190px;
- height: 30px;
- margin: auto;
- margin-top: 15px;
- padding-top: 10px;
- color: #323232;
- font-size: 18px;
- font-family: Rockwell;
- text-align: center;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px; }
-body#togglers_page div[name='Dialog'] *[data-ur-toggler-component='content'] {
- display: none;
- position: absolute;
- border-radius: 5px;
- background-color: #aaaaaa;
- width: 500px;
- height: 500px;
- left: 200px;
- bottom: 50px;
- text-align: center;
- padding-top: 30px; }
- body#togglers_page div[name='Dialog'] *[data-ur-toggler-component='content'][data-ur-state='enabled'] {
- display: block; }
-body#togglers_page .popup_button {
- border-radius: 5px;
- background-color: #ffd700;
- opacity: 1;
- padding: 5px;
- display: inline;
- margin: 0px 5px; }
- body#togglers_page .popup_button > span {
- border-radius: 5px;
- background-color: #ffd700;
- opacity: 1;
- padding: 5px;
- display: inline;
- margin: 0px 5px; }
-body#togglers_page .popup_content {
- position: absolute;
- border-radius: 5px;
- background-color: #aaaaaa;
- left: 270px;
- text-align: center;
- padding: 30px; }
- body#togglers_page .popup_content[data-ur-state='disabled'] {
- display: none;
- opacity: 0.5; }
- body#togglers_page .popup_content[data-ur-state='enabled'] {
- display: inline-block;
- opacity: 1;
- z-index: 10; }
- body#togglers_page .popup_content[data-ur-state='enabled'] img {
- width: 200px;
- height: 200px; }
-body#togglers_page [name='MultipleContents'] .buttons[data-ur-state="enabled"] span:last-child, body#togglers_page [name='MultipleContents'] .buttons[data-ur-state="disabled"] span:first-child {
- opacity: 0.5; }
-body#togglers_page [name='MultipleContents'] .popup_content {
- position: relative;
- width: 220px;
- height: 200px;
- padding: 20px; }
- body#togglers_page [name='MultipleContents'] .popup_content [data-ur-toggler-component="content"][data-ur-state="disabled"] img {
- display: none; }
- body#togglers_page [name='MultipleContents'] .popup_content [data-ur-toggler-component="content"][data-ur-state="enabled"] img {
- display: block; }
- body#togglers_page [name='MultipleContents'] .popup_content img {
- width: 200px;
- height: 200px; }
-body#togglers_page #disabled {
- background: #323232;
- border: none; }
-body#togglers_page div[data-ur-id='MyToggler'].buttons {
- background-color: #ffd700 !important; }
-
-body#tutorial_page *[data-ur-tabs-component='content'] {
- display: none; }
- body#tutorial_page *[data-ur-tabs-component='content'][data-ur-state='enabled'] {
- display: block; }
-body#tutorial_page *[data-ur-set="toggler"] {
- background: #323232;
- border: none; }
-body#tutorial_page #end_product *[data-ur-toggler-component='button'] {
- background: #ffd700;
- cursor: hand;
- cursor: pointer;
- width: 200px; }
-body#tutorial_page #end_product *[data-ur-toggler-component='content'][data-ur-state='enabled'] {
- display: block;
- background: #ffd700;
- width: 200px; }
-body#tutorial_page #end_product *[data-ur-toggler-component='content'][data-ur-state="disabled"] {
- display: none; }
-
-body#zoom_preview_page [data-ur-zoom-preview-component='container'] {
- width: 204px;
- height: 204px;
- overflow: hidden;
- border: 1px solid black;
- position: relative; }
-body#zoom_preview_page [data-ur-zoom-preview-component='zoom_image'] {
- position: absolute;
- z-index: 20; }
-body#zoom_preview_page [data-ur-zoom-preview-component='button'] {
- z-index: 30;
- border: 1px solid black;
- width: 62px;
- height: 62px;
- position: absolute;
- right: 2px;
- bottom: 2px;
- background-color: #bbbbbb; }
-body#zoom_preview_page [data-ur-zoom-preview-component='thumbnails'] {
- height: auto; }
- body#zoom_preview_page [data-ur-zoom-preview-component='thumbnails'] > li {
- display: inline-block; }
-body#zoom_preview_page .normal_image {
- width: 200px;
- height: 200px;
- margin: 2px; }
- body#zoom_preview_page .normal_image img {
- width: 200px;
- height: 200px; }
-
-body#zoom_preview_examples_page [data-ur-zoom-preview-component='container'] {
- width: 204px;
- height: 204px;
- overflow: hidden;
- border: 1px solid black;
- position: relative; }
-body#zoom_preview_examples_page [data-ur-zoom-preview-component='zoom_image'] {
- position: absolute;
- z-index: 20; }
-body#zoom_preview_examples_page [data-ur-zoom-preview-component='button'] {
- z-index: 30;
- border: 1px solid black;
- width: 62px;
- height: 62px;
- position: absolute;
- right: 2px;
- bottom: 2px;
- background-color: #bbbbbb; }
-body#zoom_preview_examples_page [data-ur-zoom-preview-component='thumbnails'] {
- height: auto; }
- body#zoom_preview_examples_page [data-ur-zoom-preview-component='thumbnails'] > li {
- display: inline-block; }
-body#zoom_preview_examples_page .normal_image {
- width: 200px;
- height: 200px;
- margin: 2px; }
- body#zoom_preview_examples_page .normal_image img {
- width: 200px;
- height: 200px; }
-
-#widget_list_page #widget_detail li {
- padding-bottom: 5px; }
-
-body#more_page [data-ur-set="toggler"] {
- background: none;
- border: none; }
- body#more_page [data-ur-set="toggler"] [data-ur-toggler-component="button"] {
- width: 250px; }
- body#more_page [data-ur-set="toggler"] [data-ur-toggler-component="content"] {
- display: none;
- width: 250px; }
- body#more_page [data-ur-set="toggler"] [data-ur-toggler-component="content"][data-ur-state="enabled"] {
- display: block; }
- body#more_page [data-ur-set="toggler"] .bio {
- background: #323232;
- padding: 5px;
- margin: 10px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px; }
- body#more_page [data-ur-set="toggler"] .bio p {
- color: silver; }
- body#more_page [data-ur-set="toggler"] img {
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- display: block;
- margin-left: auto;
- margin-right: auto; }
-
-#flex_table_page {
- /* Table styles */ }
- #flex_table_page .table-wrapper {
- position: relative; }
- #flex_table_page .table-menu > ul {
- position: absolute;
- z-index: 100;
- background-color: white;
- padding: 10px;
- border: 1px solid #cccccc;
- width: 12em;
- right: 0;
- left: auto;
- top: -7px;
- list-style: none; }
- #flex_table_page .table-menu > ul li {
- color: black; }
- #flex_table_page .table-background-element {
- position: fixed;
- left: 0px;
- top: 0px;
- z-index: 99;
- height: 100%;
- width: 100% !important; }
- #flex_table_page .table-menu-hidden {
- display: none;
- left: -999em;
- right: auto; }
- #flex_table_page .table-menu-btn {
- text-decoration: none;
- color: #333333;
- background: #eeeeee;
- padding: 0.4em 10px 0.4em 5px;
- border: 1px solid #cccccc;
- position: absolute;
- z-index: 100;
- top: -40px;
- right: 0; }
- #flex_table_page a.table-menu-btn, #flex_table_page a.table-menu-btn:hover {
- color: #333333;
- text-decoration: none; }
- #flex_table_page .table-menu-btn-icon {
- width: 0px;
- height: 0px;
- font-size: 0px;
- line-height: 0px;
- border: 6px solid;
- margin-right: 5px;
- margin-top: 4px;
- vertical-align: middle;
- border-image: initial;
- display: inline-block;
- border-color: gray transparent transparent transparent; }
- #flex_table_page .menu-btn-show > .table-menu-btn-icon {
- border-color: transparent transparent gray transparent;
- margin-top: -8px; }
- #flex_table_page .table-menu li {
- padding: 0.3em 0; }
- #flex_table_page table {
- width: 100%; }
- #flex_table_page .enhanced th,
- #flex_table_page .enhanced td {
- display: none; }
- #flex_table_page .enhanced th.essential,
- #flex_table_page .enhanced td.essential {
- display: table-cell; }
- #flex_table_page .enhanced .ur_ft_hide {
- display: none !important; }
- #flex_table_page .enhanced .ur_ft_show {
- display: table-cell !important; }
- @media screen and (min-width: 480px) {
- #flex_table_page .enhanced th.optional,
- #flex_table_page .enhanced td.optional {
- display: table-cell; } }
- @media screen and (min-width: 800px) {
- #flex_table_page .enhanced th,
- #flex_table_page .enhanced td {
- display: table-cell; } }
- #flex_table_page table {
- font-size: 0.9em; }
- #flex_table_page .table-wrapper {
- margin: 10px;
- margin-top: 40px;
- margin-bottom: 70px; }
- #flex_table_page thead th {
- white-space: nowrap;
- border-bottom: 1px solid #cccccc;
- color: #888888;
- padding: 10px 5px; }
- #flex_table_page th, #flex_table_page td {
- padding: 2px 5px;
- background-color: white;
- text-align: right; }
- #flex_table_page th:first-child,
- #flex_table_page td:first-child {
- text-align: left; }
- #flex_table_page tbody th, #flex_table_page td {
- border-bottom: 1px solid #e6e6e6; }
- #flex_table_page .co-name {
- display: block;
- font-size: 0.7em;
- opacity: 0.4; }
-
-#input_clear_page *[data-ur-set='input-clear'] {
- position: relative; }
- #input_clear_page *[data-ur-set='input-clear'] input[data-ur-input-clear-component='input'] {
- width: 100%;
- min-height: 30px;
- position: relative;
- -moz-box-sizing: border-box;
- -webkit-box-sizing: border-box;
- -ms-box-sizing: border-box;
- box-sizing: border-box; }
- #input_clear_page *[data-ur-set='input-clear'] .data-ur-input-clear-ex {
- position: absolute;
- display: none;
- background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAKQ2lDQ1BJQ0MgcHJvZmlsZQAAeNqdU3dYk/cWPt/3ZQ9WQtjwsZdsgQAiI6wIyBBZohCSAGGEEBJAxYWIClYUFRGcSFXEgtUKSJ2I4qAouGdBiohai1VcOO4f3Ke1fXrv7e371/u855zn/M55zw+AERImkeaiagA5UoU8Otgfj09IxMm9gAIVSOAEIBDmy8JnBcUAAPADeXh+dLA//AGvbwACAHDVLiQSx+H/g7pQJlcAIJEA4CIS5wsBkFIAyC5UyBQAyBgAsFOzZAoAlAAAbHl8QiIAqg0A7PRJPgUA2KmT3BcA2KIcqQgAjQEAmShHJAJAuwBgVYFSLALAwgCgrEAiLgTArgGAWbYyRwKAvQUAdo5YkA9AYACAmUIszAAgOAIAQx4TzQMgTAOgMNK/4KlfcIW4SAEAwMuVzZdL0jMUuJXQGnfy8ODiIeLCbLFCYRcpEGYJ5CKcl5sjE0jnA0zODAAAGvnRwf44P5Dn5uTh5mbnbO/0xaL+a/BvIj4h8d/+vIwCBAAQTs/v2l/l5dYDcMcBsHW/a6lbANpWAGjf+V0z2wmgWgrQevmLeTj8QB6eoVDIPB0cCgsL7SViob0w44s+/zPhb+CLfvb8QB7+23rwAHGaQJmtwKOD/XFhbnauUo7nywRCMW735yP+x4V//Y4p0eI0sVwsFYrxWIm4UCJNx3m5UpFEIcmV4hLpfzLxH5b9CZN3DQCshk/ATrYHtctswH7uAQKLDljSdgBAfvMtjBoLkQAQZzQyefcAAJO/+Y9AKwEAzZek4wAAvOgYXKiUF0zGCAAARKCBKrBBBwzBFKzADpzBHbzAFwJhBkRADCTAPBBCBuSAHAqhGJZBGVTAOtgEtbADGqARmuEQtMExOA3n4BJcgetwFwZgGJ7CGLyGCQRByAgTYSE6iBFijtgizggXmY4EImFINJKApCDpiBRRIsXIcqQCqUJqkV1II/ItchQ5jVxA+pDbyCAyivyKvEcxlIGyUQPUAnVAuagfGorGoHPRdDQPXYCWomvRGrQePYC2oqfRS+h1dAB9io5jgNExDmaM2WFcjIdFYIlYGibHFmPlWDVWjzVjHVg3dhUbwJ5h7wgkAouAE+wIXoQQwmyCkJBHWExYQ6gl7CO0EroIVwmDhDHCJyKTqE+0JXoS+cR4YjqxkFhGrCbuIR4hniVeJw4TX5NIJA7JkuROCiElkDJJC0lrSNtILaRTpD7SEGmcTCbrkG3J3uQIsoCsIJeRt5APkE+S+8nD5LcUOsWI4kwJoiRSpJQSSjVlP+UEpZ8yQpmgqlHNqZ7UCKqIOp9aSW2gdlAvU4epEzR1miXNmxZDy6Qto9XQmmlnafdoL+l0ugndgx5Fl9CX0mvoB+nn6YP0dwwNhg2Dx0hiKBlrGXsZpxi3GS+ZTKYF05eZyFQw1zIbmWeYD5hvVVgq9ip8FZHKEpU6lVaVfpXnqlRVc1U/1XmqC1SrVQ+rXlZ9pkZVs1DjqQnUFqvVqR1Vu6k2rs5Sd1KPUM9RX6O+X/2C+mMNsoaFRqCGSKNUY7fGGY0hFsYyZfFYQtZyVgPrLGuYTWJbsvnsTHYF+xt2L3tMU0NzqmasZpFmneZxzQEOxrHg8DnZnErOIc4NznstAy0/LbHWaq1mrX6tN9p62r7aYu1y7Rbt69rvdXCdQJ0snfU6bTr3dQm6NrpRuoW623XP6j7TY+t56Qn1yvUO6d3RR/Vt9KP1F+rv1u/RHzcwNAg2kBlsMThj8MyQY+hrmGm40fCE4agRy2i6kcRoo9FJoye4Ju6HZ+M1eBc+ZqxvHGKsNN5l3Gs8YWJpMtukxKTF5L4pzZRrmma60bTTdMzMyCzcrNisyeyOOdWca55hvtm82/yNhaVFnMVKizaLx5balnzLBZZNlvesmFY+VnlW9VbXrEnWXOss623WV2xQG1ebDJs6m8u2qK2brcR2m23fFOIUjynSKfVTbtox7PzsCuya7AbtOfZh9iX2bfbPHcwcEh3WO3Q7fHJ0dcx2bHC866ThNMOpxKnD6VdnG2ehc53zNRemS5DLEpd2lxdTbaeKp26fesuV5RruutK10/Wjm7ub3K3ZbdTdzD3Ffav7TS6bG8ldwz3vQfTw91jicczjnaebp8LzkOcvXnZeWV77vR5Ps5wmntYwbcjbxFvgvct7YDo+PWX6zukDPsY+Ap96n4e+pr4i3z2+I37Wfpl+B/ye+zv6y/2P+L/hefIW8U4FYAHBAeUBvYEagbMDawMfBJkEpQc1BY0FuwYvDD4VQgwJDVkfcpNvwBfyG/ljM9xnLJrRFcoInRVaG/owzCZMHtYRjobPCN8Qfm+m+UzpzLYIiOBHbIi4H2kZmRf5fRQpKjKqLupRtFN0cXT3LNas5Fn7Z72O8Y+pjLk722q2cnZnrGpsUmxj7Ju4gLiquIF4h/hF8ZcSdBMkCe2J5MTYxD2J43MC52yaM5zkmlSWdGOu5dyiuRfm6c7Lnnc8WTVZkHw4hZgSl7I/5YMgQlAvGE/lp25NHRPyhJuFT0W+oo2iUbG3uEo8kuadVpX2ON07fUP6aIZPRnXGMwlPUit5kRmSuSPzTVZE1t6sz9lx2S05lJyUnKNSDWmWtCvXMLcot09mKyuTDeR55m3KG5OHyvfkI/lz89sVbIVM0aO0Uq5QDhZML6greFsYW3i4SL1IWtQz32b+6vkjC4IWfL2QsFC4sLPYuHhZ8eAiv0W7FiOLUxd3LjFdUrpkeGnw0n3LaMuylv1Q4lhSVfJqedzyjlKD0qWlQyuCVzSVqZTJy26u9Fq5YxVhlWRV72qX1VtWfyoXlV+scKyorviwRrjm4ldOX9V89Xlt2treSrfK7etI66Trbqz3Wb+vSr1qQdXQhvANrRvxjeUbX21K3nShemr1js20zcrNAzVhNe1bzLas2/KhNqP2ep1/XctW/a2rt77ZJtrWv913e/MOgx0VO97vlOy8tSt4V2u9RX31btLugt2PGmIbur/mft24R3dPxZ6Pe6V7B/ZF7+tqdG9s3K+/v7IJbVI2jR5IOnDlm4Bv2pvtmne1cFoqDsJB5cEn36Z8e+NQ6KHOw9zDzd+Zf7f1COtIeSvSOr91rC2jbaA9ob3v6IyjnR1eHUe+t/9+7zHjY3XHNY9XnqCdKD3x+eSCk+OnZKeenU4/PdSZ3Hn3TPyZa11RXb1nQ8+ePxd07ky3X/fJ897nj13wvHD0Ivdi2yW3S609rj1HfnD94UivW2/rZffL7Vc8rnT0Tes70e/Tf/pqwNVz1/jXLl2feb3vxuwbt24m3Ry4Jbr1+Hb27Rd3Cu5M3F16j3iv/L7a/eoH+g/qf7T+sWXAbeD4YMBgz8NZD+8OCYee/pT/04fh0kfMR9UjRiONj50fHxsNGr3yZM6T4aeypxPPyn5W/3nrc6vn3/3i+0vPWPzY8Av5i8+/rnmp83Lvq6mvOscjxx+8znk98ab8rc7bfe+477rfx70fmSj8QP5Q89H6Y8en0E/3Pud8/vwv94Tz+4A5JREAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfcAx8WHyF/aorvAAABgUlEQVRIx8WWsXnCQAyFf5smHZR0oUwXynS5EWADsgEbyNqADUKZdB4BbwAbmDIdbJBGzmc7d+eD8BGVZ1nv9PSkU0aiicgjMAMmdnQCalU9pvyfJQRfAwsD8VkNlMAmBpoFAMZAYSCX2AYoVPU8CCQiz8AWmHOd7YGVqh6CQAaya9XhWjsBrg2W9eja/SETX2auoTFvfShuCILFKjoZmbrqyE+lqW7uuXVtqgzZTFWPTUYxdW1VdQk4C9ynZmniCdm6TV3oRqWqvgEY1w1Yh3/zKQMxFgDZAG2dgC3R4DmLCWmWicirOZEK5mnuIbW6PDJa2urZNZlcAUJToxN3sBSgIHU9gQwC1ZeAiMi4TWMiWJ3baA+B1QF17TxgsRg/DRvsARF59xS+IxDzWUSmyv1G0Aigqqqzc24CvAScn4Cp53xq34IPoap++qb3/oaK3v+a3vd4+PJeXxxS+yKhJTpP+ajvVVXVl3PuA3iI1Cy2nKx829D/rlsDCyRWw4sWyG+u+8N6uRUsuAAAAABJRU5ErkJggg==) no-repeat;
- height: 27px;
- width: 27px;
- top: 4px;
- right: 2px; }
-
-.highlight {
- color: #f8f8f2;
- background-color: #282828;
- border: 3px dashed #3c3c3c;
- padding: 0 10px;
- -moz-border-radius: 10px;
- -webkit-border-radius: 10px;
- -o-border-radius: 10px;
- -ms-border-radius: 10px;
- -khtml-border-radius: 10px;
- border-radius: 10px;
- overflow: scroll; }
- .highlight .hll {
- background-color: #49483e; }
- .highlight .c {
- color: #75715e; }
- .highlight .err {
- color: #960050;
- background-color: #1e0010; }
- .highlight .k {
- color: #66d9ef; }
- .highlight .l {
- color: #ae81ff; }
- .highlight .n {
- color: #f8f8f2; }
- .highlight .o {
- color: #f92672; }
- .highlight .p {
- color: #f8f8f2; }
- .highlight .cm, .highlight .cp, .highlight .c1, .highlight .cs {
- color: #75715e; }
- .highlight .ge {
- font-style: italic; }
- .highlight .gs {
- font-weight: bold; }
- .highlight .kc, .highlight .kd {
- color: #66d9ef; }
- .highlight .kn {
- color: #f92672; }
- .highlight .kp, .highlight .kr, .highlight .kt {
- color: #66d9ef; }
- .highlight .ld {
- color: #e6db74; }
- .highlight .m {
- color: #ae81ff; }
- .highlight .s {
- color: #e6db74; }
- .highlight .na {
- color: #a6e22e; }
- .highlight .nb {
- color: #f8f8f2; }
- .highlight .nc {
- color: #a6e22e; }
- .highlight .no {
- color: #66d9ef; }
- .highlight .nd {
- color: #a6e22e; }
- .highlight .ni {
- color: #f8f8f2; }
- .highlight .ne, .highlight .nf {
- color: #a6e22e; }
- .highlight .nl, .highlight .nn {
- color: #f8f8f2; }
- .highlight .nx {
- color: #a6e22e; }
- .highlight .py {
- color: #f8f8f2; }
- .highlight .nt {
- color: #f92672; }
- .highlight .nv {
- color: #f8f8f2; }
- .highlight .ow {
- color: #f92672; }
- .highlight .w {
- color: #f8f8f2; }
- .highlight .mf, .highlight .mh, .highlight .mi, .highlight .mo {
- color: #ae81ff; }
- .highlight .sb, .highlight .sc, .highlight .sd, .highlight .s2 {
- color: #e6db74; }
- .highlight .se {
- color: #ae81ff; }
- .highlight .sh, .highlight .si, .highlight .sx, .highlight .sr, .highlight .s1, .highlight .ss {
- color: #e6db74; }
- .highlight .bp, .highlight .vc, .highlight .vg, .highlight .vi {
- color: #f8f8f2; }
- .highlight .il {
- color: #ae81ff; }
diff --git a/examples/site/stylesheets/resources/BW_AmCancer.png b/examples/site/stylesheets/resources/BW_AmCancer.png
deleted file mode 100644
index 6a961d8..0000000
Binary files a/examples/site/stylesheets/resources/BW_AmCancer.png and /dev/null differ
diff --git a/examples/site/stylesheets/resources/BW_RS.png b/examples/site/stylesheets/resources/BW_RS.png
deleted file mode 100644
index 0526402..0000000
Binary files a/examples/site/stylesheets/resources/BW_RS.png and /dev/null differ
diff --git a/examples/site/stylesheets/resources/BW_barenecessities.png b/examples/site/stylesheets/resources/BW_barenecessities.png
deleted file mode 100644
index 688f106..0000000
Binary files a/examples/site/stylesheets/resources/BW_barenecessities.png and /dev/null differ
diff --git a/examples/site/stylesheets/resources/BW_belk.png b/examples/site/stylesheets/resources/BW_belk.png
deleted file mode 100644
index 29f2f38..0000000
Binary files a/examples/site/stylesheets/resources/BW_belk.png and /dev/null differ
diff --git a/examples/site/stylesheets/resources/BW_macys.png b/examples/site/stylesheets/resources/BW_macys.png
deleted file mode 100644
index 07cade3..0000000
Binary files a/examples/site/stylesheets/resources/BW_macys.png and /dev/null differ
diff --git a/examples/site/stylesheets/resources/blacktopshadow.png b/examples/site/stylesheets/resources/blacktopshadow.png
deleted file mode 100755
index 37ef052..0000000
Binary files a/examples/site/stylesheets/resources/blacktopshadow.png and /dev/null differ
diff --git a/examples/site/stylesheets/resources/greyuraniumlogo.png b/examples/site/stylesheets/resources/greyuraniumlogo.png
deleted file mode 100755
index f27b922..0000000
Binary files a/examples/site/stylesheets/resources/greyuraniumlogo.png and /dev/null differ
diff --git a/examples/site/stylesheets/resources/largeshade.png b/examples/site/stylesheets/resources/largeshade.png
deleted file mode 100755
index f520a36..0000000
Binary files a/examples/site/stylesheets/resources/largeshade.png and /dev/null differ
diff --git a/examples/site/stylesheets/resources/largestshade.png b/examples/site/stylesheets/resources/largestshade.png
deleted file mode 100644
index 0e7c731..0000000
Binary files a/examples/site/stylesheets/resources/largestshade.png and /dev/null differ
diff --git a/examples/site/stylesheets/resources/logo1.png b/examples/site/stylesheets/resources/logo1.png
deleted file mode 100755
index c2db8a1..0000000
Binary files a/examples/site/stylesheets/resources/logo1.png and /dev/null differ
diff --git a/examples/site/stylesheets/resources/logo2.png b/examples/site/stylesheets/resources/logo2.png
deleted file mode 100755
index 3e3d701..0000000
Binary files a/examples/site/stylesheets/resources/logo2.png and /dev/null differ
diff --git a/examples/site/stylesheets/resources/logo_ACS.jpg b/examples/site/stylesheets/resources/logo_ACS.jpg
deleted file mode 100644
index d1d82ee..0000000
Binary files a/examples/site/stylesheets/resources/logo_ACS.jpg and /dev/null differ
diff --git a/examples/site/stylesheets/resources/logo_bare.gif b/examples/site/stylesheets/resources/logo_bare.gif
deleted file mode 100644
index f22ca6f..0000000
Binary files a/examples/site/stylesheets/resources/logo_bare.gif and /dev/null differ
diff --git a/examples/site/stylesheets/resources/logo_belk.jpg b/examples/site/stylesheets/resources/logo_belk.jpg
deleted file mode 100644
index b0af74a..0000000
Binary files a/examples/site/stylesheets/resources/logo_belk.jpg and /dev/null differ
diff --git a/examples/site/stylesheets/resources/logo_macys.jpeg b/examples/site/stylesheets/resources/logo_macys.jpeg
deleted file mode 100644
index 59e5cd6..0000000
Binary files a/examples/site/stylesheets/resources/logo_macys.jpeg and /dev/null differ
diff --git a/examples/site/stylesheets/resources/logo_ross-simons.jpg b/examples/site/stylesheets/resources/logo_ross-simons.jpg
deleted file mode 100644
index 004b497..0000000
Binary files a/examples/site/stylesheets/resources/logo_ross-simons.jpg and /dev/null differ
diff --git a/examples/site/stylesheets/resources/moov1.JPG b/examples/site/stylesheets/resources/moov1.JPG
deleted file mode 100644
index fc386d0..0000000
Binary files a/examples/site/stylesheets/resources/moov1.JPG and /dev/null differ
diff --git a/examples/site/stylesheets/resources/moov10.jpg b/examples/site/stylesheets/resources/moov10.jpg
deleted file mode 100644
index bd22bff..0000000
Binary files a/examples/site/stylesheets/resources/moov10.jpg and /dev/null differ
diff --git a/examples/site/stylesheets/resources/moov2.JPG b/examples/site/stylesheets/resources/moov2.JPG
deleted file mode 100644
index 46fff44..0000000
Binary files a/examples/site/stylesheets/resources/moov2.JPG and /dev/null differ
diff --git a/examples/site/stylesheets/resources/moov3.JPG b/examples/site/stylesheets/resources/moov3.JPG
deleted file mode 100644
index d4bfe83..0000000
Binary files a/examples/site/stylesheets/resources/moov3.JPG and /dev/null differ
diff --git a/examples/site/stylesheets/resources/moov4.JPG b/examples/site/stylesheets/resources/moov4.JPG
deleted file mode 100644
index cc74ee6..0000000
Binary files a/examples/site/stylesheets/resources/moov4.JPG and /dev/null differ
diff --git a/examples/site/stylesheets/resources/moov5.JPG b/examples/site/stylesheets/resources/moov5.JPG
deleted file mode 100644
index d231b09..0000000
Binary files a/examples/site/stylesheets/resources/moov5.JPG and /dev/null differ
diff --git a/examples/site/stylesheets/resources/moov6.jpg b/examples/site/stylesheets/resources/moov6.jpg
deleted file mode 100644
index 07caeeb..0000000
Binary files a/examples/site/stylesheets/resources/moov6.jpg and /dev/null differ
diff --git a/examples/site/stylesheets/resources/moov7.jpg b/examples/site/stylesheets/resources/moov7.jpg
deleted file mode 100644
index 7143a37..0000000
Binary files a/examples/site/stylesheets/resources/moov7.jpg and /dev/null differ
diff --git a/examples/site/stylesheets/resources/moov8.jpg b/examples/site/stylesheets/resources/moov8.jpg
deleted file mode 100644
index fcfb27b..0000000
Binary files a/examples/site/stylesheets/resources/moov8.jpg and /dev/null differ
diff --git a/examples/site/stylesheets/resources/moov9.png b/examples/site/stylesheets/resources/moov9.png
deleted file mode 100644
index 3813690..0000000
Binary files a/examples/site/stylesheets/resources/moov9.png and /dev/null differ
diff --git a/examples/site/stylesheets/resources/moovweblogo1.png b/examples/site/stylesheets/resources/moovweblogo1.png
deleted file mode 100755
index 6c1285c..0000000
Binary files a/examples/site/stylesheets/resources/moovweblogo1.png and /dev/null differ
diff --git a/examples/site/stylesheets/resources/photo1.png b/examples/site/stylesheets/resources/photo1.png
deleted file mode 100755
index 1fd7fcd..0000000
Binary files a/examples/site/stylesheets/resources/photo1.png and /dev/null differ
diff --git a/examples/site/stylesheets/resources/rightshadow.png b/examples/site/stylesheets/resources/rightshadow.png
deleted file mode 100755
index d9539e3..0000000
Binary files a/examples/site/stylesheets/resources/rightshadow.png and /dev/null differ
diff --git a/examples/site/stylesheets/resources/sample_uranium.png b/examples/site/stylesheets/resources/sample_uranium.png
deleted file mode 100755
index 4ba2863..0000000
Binary files a/examples/site/stylesheets/resources/sample_uranium.png and /dev/null differ
diff --git a/examples/site/stylesheets/resources/sample_uranium2.png b/examples/site/stylesheets/resources/sample_uranium2.png
deleted file mode 100755
index 6527853..0000000
Binary files a/examples/site/stylesheets/resources/sample_uranium2.png and /dev/null differ
diff --git a/examples/site/stylesheets/resources/shade50.png b/examples/site/stylesheets/resources/shade50.png
deleted file mode 100755
index e0f2b9f..0000000
Binary files a/examples/site/stylesheets/resources/shade50.png and /dev/null differ
diff --git a/examples/site/stylesheets/resources/topshadow.png b/examples/site/stylesheets/resources/topshadow.png
deleted file mode 100755
index ebc04ae..0000000
Binary files a/examples/site/stylesheets/resources/topshadow.png and /dev/null differ
diff --git a/examples/site/stylesheets/resources/uraniumicon.png b/examples/site/stylesheets/resources/uraniumicon.png
deleted file mode 100644
index 672d359..0000000
Binary files a/examples/site/stylesheets/resources/uraniumicon.png and /dev/null differ
diff --git a/examples/site/stylesheets/resources/uraniumlogo.png b/examples/site/stylesheets/resources/uraniumlogo.png
deleted file mode 100755
index 06be6cf..0000000
Binary files a/examples/site/stylesheets/resources/uraniumlogo.png and /dev/null differ
diff --git a/examples/site/stylesheets/scss/_carousel.scss b/examples/site/stylesheets/scss/_carousel.scss
deleted file mode 100644
index 0079bc4..0000000
--- a/examples/site/stylesheets/scss/_carousel.scss
+++ /dev/null
@@ -1,48 +0,0 @@
-body#carousel_page {
- [data-ur-carousel-component='view_container'] {
- background: #FFD700 url('resources/largeshade.png') no-repeat left bottom;
- border: 1px solid black;
- overflow: hidden;
- position: relative;
- height: 250px;
- }
- [data-ur-infinite="enabled"] [data-ur-carousel-component="scroll_container"] {
- margin: auto;
- width: 250px;
- }
- [data-ur-carousel-component="scroll_container"] img {
- -webkit-user-drag: none;
- float: left;
- width: 250px;
- height: 250px;
- }
- [data-ur-carousel-component="button"] {
- display: inline-block;
- &[data-ur-state="disabled"] {
- opacity: 0.3;
- }
- }
- .test [data-ur-carousel-component="view_container"] {
- width: 50%;
- }
- [data-ur-carousel-component="dots"] {
- float: right;
- }
- [data-ur-carousel-component="dot"] {
- @include border-radius(7px);
- background: black;
- display: inline-block;
- margin: 0 5px;
- opacity: 0.8;
- width: 10px;
- height: 10px;
- &[data-ur-state="inactive"] {
- opacity: 0.3;
- }
- }
- div[name='Three'] img {
- width: 62px !important;
- // on iphone without the important, it doesn't work!!
- height: 62px;
- }
-}
diff --git a/examples/site/stylesheets/scss/_compatibility.scss b/examples/site/stylesheets/scss/_compatibility.scss
deleted file mode 100644
index 3ad03eb..0000000
--- a/examples/site/stylesheets/scss/_compatibility.scss
+++ /dev/null
@@ -1,27 +0,0 @@
-body#compatibility_page {
- th {
- background: silver; }
- td {
- text-align: center;
- background: #fafafa; }
- td.passed {
- background: #c7e8ad; }
- td.failed {
- background: #e8b5ad; }
- td.mixed {
- background: #fbf6bb; }
- li {
- color: #323232;
- background: #fafafa;
- margin: 10px;
- width: 200px;
- padding: 5px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px; }
- li.passed {
- background: #c7e8ad; }
- li.failed {
- background: #e8b5ad; }
- li.mixed {
- background: #fbf6bb; } }
diff --git a/examples/site/stylesheets/scss/_demonstration.scss b/examples/site/stylesheets/scss/_demonstration.scss
deleted file mode 100644
index e9be330..0000000
--- a/examples/site/stylesheets/scss/_demonstration.scss
+++ /dev/null
@@ -1,37 +0,0 @@
-.demonstration {
- h3 {
- color: #323232; }
- * {
- &[data-ur-tabs-component='button'] {
- opacity: 0.5;
- background: silver;
- border: 1px solid black;
- border-top-left-radius: 5px 5px;
- border-top-right-radius: 5px 5px;
- bottom: -1px;
- display: inline-block;
- margin: 0px 5px;
- padding: 5px;
- position: relative; }
- &[data-ur-tabs-component='content'] {
- display: none;
- background: silver; }
- &[data-ur-tabs-component='button'][data-ur-state='enabled'] {
- opacity: 1;
- background: silver;
- border-bottom: 1px solid silver; }
- &[data-ur-tabs-component='content'][data-ur-state='enabled'] {
- display: block;
- background: silver;
- border: 1px solid black;
- padding: 20px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px; }
- &[data-ur-set="tabs"][data-ur-tab-id="html"] {
- text-align: left; } }
- #tab_widget *[data-ur-set="tabs"] * {
- &[data-ur-tabs-component="button"] {
- background: silver; }
- &[data-ur-tabs-component="content"] {
- background: silver; } } }
diff --git a/examples/site/stylesheets/scss/_flex_table.scss b/examples/site/stylesheets/scss/_flex_table.scss
deleted file mode 100644
index 6ed51cb..0000000
--- a/examples/site/stylesheets/scss/_flex_table.scss
+++ /dev/null
@@ -1,110 +0,0 @@
-#flex_table_page {
- // Essential Styles
- // Include these in your style sheets.
- .table-wrapper {
- position: relative; }
- .table-menu {
- > ul {
- position: absolute;
- z-index: 100;
- background-color: white;
- padding: 10px;
- border: 1px solid #cccccc;
- width: 12em;
- right: 0;
- left: auto;
- top: -7px;
- list-style: none;
- li {
- color: black; } } }
- .table-background-element {
- position: fixed;
- left: 0px;
- top: 0px;
- z-index: 99;
- height: 100%;
- width: 100% !important; }
- .table-menu-hidden {
- display: none;
- left: -999em;
- right: auto; }
- .table-menu-btn {
- text-decoration: none;
- color: #333333;
- background: #eeeeee;
- padding: 0.4em 10px 0.4em 5px;
- border: 1px solid #cccccc;
- position: absolute;
- z-index: 100;
- top: -40px;
- right: 0; }
- a.table-menu-btn, a.table-menu-btn:hover {
- color: #333333;
- text-decoration: none; }
- .table-menu-btn-icon {
- width: 0px;
- height: 0px;
- font-size: 0px;
- line-height: 0px;
- border: 6px solid;
- margin-right: 5px;
- margin-top: 4px;
- vertical-align: middle;
- border-image: initial;
- display: inline-block;
- border-color: gray transparent transparent transparent; }
- .menu-btn-show > .table-menu-btn-icon {
- border-color: transparent transparent gray transparent;
- margin-top: -8px; }
- .table-menu li {
- padding: 0.3em 0; }
- table {
- width: 100%; }
- .enhanced th,
- .enhanced td {
- display: none; }
- .enhanced th.essential,
- .enhanced td.essential {
- display: table-cell; }
- .enhanced .ur_ft_hide {
- display: none !important; }
- .enhanced .ur_ft_show {
- display: table-cell !important; }
- // Change this width to alter the switch state
- // for the optional classes
- @media screen and (min-width: 480px) {
- .enhanced th.optional,
- .enhanced td.optional {
- display: table-cell; } }
- // Change this width to alter the switch state
- // to show all columns
- @media screen and (min-width: 800px) {
- .enhanced th,
- .enhanced td {
- display: table-cell; } }
- // End Essential Styles
- /* Table styles */
- table {
- font-size: 0.9em; }
- .table-wrapper {
- margin: 10px;
- margin-top: 40px;
- margin-bottom: 70px; }
- thead th {
- white-space: nowrap;
- border-bottom: 1px solid #cccccc;
- color: #888888;
- padding: 10px 5px; }
- th, td {
- padding: 2px 5px;
- background-color: white;
- text-align: right; }
- th:first-child,
- td:first-child {
- text-align: left; }
- tbody th, td {
- border-bottom: 1px solid #e6e6e6; }
- .co-name {
- display: block;
- font-size: 0.7em;
- opacity: 0.4; } }
diff --git a/examples/site/stylesheets/scss/_geocode.scss b/examples/site/stylesheets/scss/_geocode.scss
deleted file mode 100644
index 2f4d6af..0000000
--- a/examples/site/stylesheets/scss/_geocode.scss
+++ /dev/null
@@ -1,31 +0,0 @@
-body#geocode_page {
- div {
- &[data-ur-carousel-component='view_container'] {
- height: 270px;
- width: 100%;
- overflow-x: hidden;
- border: 1px solid black;
- background-color: #99cc00; }
- &[data-ur-carousel-component="scroll_container"] {
- display: block;
- > * {
- display: inline-block;
- float: left;
- // This is important -- otherwise, the carousel can't calculate the accurate total width
- // background-color: #3CC;
- } }
- &[data-ur-carousel-component="button"] {
- display: inline-block;
- &[data-ur-state="disabled"] {
- opacity: 0.3; } } }
- // Non essential styling
- #giant {
- height: 1000px;
- background-color: #ff6600;
- border: 1px solid black;
- margin: 5px;
- padding: 5px; }
- div[name='Three'] img {
- width: 62px !important;
- // on iphone without the important, it doesn't work!!
- height: 62px; } }
diff --git a/examples/site/stylesheets/scss/_highlight_code.scss b/examples/site/stylesheets/scss/_highlight_code.scss
deleted file mode 100644
index c466014..0000000
--- a/examples/site/stylesheets/scss/_highlight_code.scss
+++ /dev/null
@@ -1,82 +0,0 @@
-.highlight {
- color: #f8f8f2;
- background-color: rgb(40, 40, 40);
- border: 3px dashed rgb(60, 60, 60);
- padding: 0 10px;
- @include border-radius(10px);
- overflow: scroll;
- .hll {
- background-color: #49483e; }
- .c {
- color: #75715e; }
- .err {
- color: #960050;
- background-color: #1e0010; }
- .k {
- color: #66d9ef; }
- .l {
- color: #ae81ff; }
- .n {
- color: #f8f8f2; }
- .o {
- color: #f92672; }
- .p {
- color: #f8f8f2; }
- .cm, .cp, .c1, .cs {
- color: #75715e; }
- .ge {
- font-style: italic; }
- .gs {
- font-weight: bold; }
- .kc, .kd {
- color: #66d9ef; }
- .kn {
- color: #f92672; }
- .kp, .kr, .kt {
- color: #66d9ef; }
- .ld {
- color: #e6db74; }
- .m {
- color: #ae81ff; }
- .s {
- color: #e6db74; }
- .na {
- color: #a6e22e; }
- .nb {
- color: #f8f8f2; }
- .nc {
- color: #a6e22e; }
- .no {
- color: #66d9ef; }
- .nd {
- color: #a6e22e; }
- .ni {
- color: #f8f8f2; }
- .ne, .nf {
- color: #a6e22e; }
- .nl, .nn {
- color: #f8f8f2; }
- .nx {
- color: #a6e22e; }
- .py {
- color: #f8f8f2; }
- .nt {
- color: #f92672; }
- .nv {
- color: #f8f8f2; }
- .ow {
- color: #f92672; }
- .w {
- color: #f8f8f2; }
- .mf, .mh, .mi, .mo {
- color: #ae81ff; }
- .sb, .sc, .sd, .s2 {
- color: #e6db74; }
- .se {
- color: #ae81ff; }
- .sh, .si, .sx, .sr, .s1, .ss {
- color: #e6db74; }
- .bp, .vc, .vg, .vi {
- color: #f8f8f2; }
- .il {
- color: #ae81ff; } }
diff --git a/examples/site/stylesheets/scss/_input_clear.scss b/examples/site/stylesheets/scss/_input_clear.scss
deleted file mode 100644
index 637ca84..0000000
--- a/examples/site/stylesheets/scss/_input_clear.scss
+++ /dev/null
@@ -1,21 +0,0 @@
-#input_clear_page {
- *[data-ur-set='input-clear'] {
- position: relative;
- input[data-ur-input-clear-component='input'] {
- width: 100%;
- min-height: 30px;
- position: relative;
- @include box-sizing(border-box); }
- .data-ur-input-clear-ex {
- // absolute to allow for center positioning in the text field
- position: absolute;
- display: none;
- // created from the glyphicons circle_remove icon
- // image included such that it can be modified to be smaller or the color changed if desired
- background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAKQ2lDQ1BJQ0MgcHJvZmlsZQAAeNqdU3dYk/cWPt/3ZQ9WQtjwsZdsgQAiI6wIyBBZohCSAGGEEBJAxYWIClYUFRGcSFXEgtUKSJ2I4qAouGdBiohai1VcOO4f3Ke1fXrv7e371/u855zn/M55zw+AERImkeaiagA5UoU8Otgfj09IxMm9gAIVSOAEIBDmy8JnBcUAAPADeXh+dLA//AGvbwACAHDVLiQSx+H/g7pQJlcAIJEA4CIS5wsBkFIAyC5UyBQAyBgAsFOzZAoAlAAAbHl8QiIAqg0A7PRJPgUA2KmT3BcA2KIcqQgAjQEAmShHJAJAuwBgVYFSLALAwgCgrEAiLgTArgGAWbYyRwKAvQUAdo5YkA9AYACAmUIszAAgOAIAQx4TzQMgTAOgMNK/4KlfcIW4SAEAwMuVzZdL0jMUuJXQGnfy8ODiIeLCbLFCYRcpEGYJ5CKcl5sjE0jnA0zODAAAGvnRwf44P5Dn5uTh5mbnbO/0xaL+a/BvIj4h8d/+vIwCBAAQTs/v2l/l5dYDcMcBsHW/a6lbANpWAGjf+V0z2wmgWgrQevmLeTj8QB6eoVDIPB0cCgsL7SViob0w44s+/zPhb+CLfvb8QB7+23rwAHGaQJmtwKOD/XFhbnauUo7nywRCMW735yP+x4V//Y4p0eI0sVwsFYrxWIm4UCJNx3m5UpFEIcmV4hLpfzLxH5b9CZN3DQCshk/ATrYHtctswH7uAQKLDljSdgBAfvMtjBoLkQAQZzQyefcAAJO/+Y9AKwEAzZek4wAAvOgYXKiUF0zGCAAARKCBKrBBBwzBFKzADpzBHbzAFwJhBkRADCTAPBBCBuSAHAqhGJZBGVTAOtgEtbADGqARmuEQtMExOA3n4BJcgetwFwZgGJ7CGLyGCQRByAgTYSE6iBFijtgizggXmY4EImFINJKApCDpiBRRIsXIcqQCqUJqkV1II/ItchQ5jVxA+pDbyCAyivyKvEcxlIGyUQPUAnVAuagfGorGoHPRdDQPXYCWomvRGrQePYC2oqfRS+h1dAB9io5jgNExDmaM2WFcjIdFYIlYGibHFmPlWDVWjzVjHVg3dhUbwJ5h7wgkAouAE+wIXoQQwmyCkJBHWExYQ6gl7CO0EroIVwmDhDHCJyKTqE+0JXoS+cR4YjqxkFhGrCbuIR4hniVeJw4TX5NIJA7JkuROCiElkDJJC0lrSNtILaRTpD7SEGmcTCbrkG3J3uQIsoCsIJeRt5APkE+S+8nD5LcUOsWI4kwJoiRSpJQSSjVlP+UEpZ8yQpmgqlHNqZ7UCKqIOp9aSW2gdlAvU4epEzR1miXNmxZDy6Qto9XQmmlnafdoL+l0ugndgx5Fl9CX0mvoB+nn6YP0dwwNhg2Dx0hiKBlrGXsZpxi3GS+ZTKYF05eZyFQw1zIbmWeYD5hvVVgq9ip8FZHKEpU6lVaVfpXnqlRVc1U/1XmqC1SrVQ+rXlZ9pkZVs1DjqQnUFqvVqR1Vu6k2rs5Sd1KPUM9RX6O+X/2C+mMNsoaFRqCGSKNUY7fGGY0hFsYyZfFYQtZyVgPrLGuYTWJbsvnsTHYF+xt2L3tMU0NzqmasZpFmneZxzQEOxrHg8DnZnErOIc4NznstAy0/LbHWaq1mrX6tN9p62r7aYu1y7Rbt69rvdXCdQJ0snfU6bTr3dQm6NrpRuoW623XP6j7TY+t56Qn1yvUO6d3RR/Vt9KP1F+rv1u/RHzcwNAg2kBlsMThj8MyQY+hrmGm40fCE4agRy2i6kcRoo9FJoye4Ju6HZ+M1eBc+ZqxvHGKsNN5l3Gs8YWJpMtukxKTF5L4pzZRrmma60bTTdMzMyCzcrNisyeyOOdWca55hvtm82/yNhaVFnMVKizaLx5balnzLBZZNlvesmFY+VnlW9VbXrEnWXOss623WV2xQG1ebDJs6m8u2qK2brcR2m23fFOIUjynSKfVTbtox7PzsCuya7AbtOfZh9iX2bfbPHcwcEh3WO3Q7fHJ0dcx2bHC866ThNMOpxKnD6VdnG2ehc53zNRemS5DLEpd2lxdTbaeKp26fesuV5RruutK10/Wjm7ub3K3ZbdTdzD3Ffav7TS6bG8ldwz3vQfTw91jicczjnaebp8LzkOcvXnZeWV77vR5Ps5wmntYwbcjbxFvgvct7YDo+PWX6zukDPsY+Ap96n4e+pr4i3z2+I37Wfpl+B/ye+zv6y/2P+L/hefIW8U4FYAHBAeUBvYEagbMDawMfBJkEpQc1BY0FuwYvDD4VQgwJDVkfcpNvwBfyG/ljM9xnLJrRFcoInRVaG/owzCZMHtYRjobPCN8Qfm+m+UzpzLYIiOBHbIi4H2kZmRf5fRQpKjKqLupRtFN0cXT3LNas5Fn7Z72O8Y+pjLk722q2cnZnrGpsUmxj7Ju4gLiquIF4h/hF8ZcSdBMkCe2J5MTYxD2J43MC52yaM5zkmlSWdGOu5dyiuRfm6c7Lnnc8WTVZkHw4hZgSl7I/5YMgQlAvGE/lp25NHRPyhJuFT0W+oo2iUbG3uEo8kuadVpX2ON07fUP6aIZPRnXGMwlPUit5kRmSuSPzTVZE1t6sz9lx2S05lJyUnKNSDWmWtCvXMLcot09mKyuTDeR55m3KG5OHyvfkI/lz89sVbIVM0aO0Uq5QDhZML6greFsYW3i4SL1IWtQz32b+6vkjC4IWfL2QsFC4sLPYuHhZ8eAiv0W7FiOLUxd3LjFdUrpkeGnw0n3LaMuylv1Q4lhSVfJqedzyjlKD0qWlQyuCVzSVqZTJy26u9Fq5YxVhlWRV72qX1VtWfyoXlV+scKyorviwRrjm4ldOX9V89Xlt2treSrfK7etI66Trbqz3Wb+vSr1qQdXQhvANrRvxjeUbX21K3nShemr1js20zcrNAzVhNe1bzLas2/KhNqP2ep1/XctW/a2rt77ZJtrWv913e/MOgx0VO97vlOy8tSt4V2u9RX31btLugt2PGmIbur/mft24R3dPxZ6Pe6V7B/ZF7+tqdG9s3K+/v7IJbVI2jR5IOnDlm4Bv2pvtmne1cFoqDsJB5cEn36Z8e+NQ6KHOw9zDzd+Zf7f1COtIeSvSOr91rC2jbaA9ob3v6IyjnR1eHUe+t/9+7zHjY3XHNY9XnqCdKD3x+eSCk+OnZKeenU4/PdSZ3Hn3TPyZa11RXb1nQ8+ePxd07ky3X/fJ897nj13wvHD0Ivdi2yW3S609rj1HfnD94UivW2/rZffL7Vc8rnT0Tes70e/Tf/pqwNVz1/jXLl2feb3vxuwbt24m3Ry4Jbr1+Hb27Rd3Cu5M3F16j3iv/L7a/eoH+g/qf7T+sWXAbeD4YMBgz8NZD+8OCYee/pT/04fh0kfMR9UjRiONj50fHxsNGr3yZM6T4aeypxPPyn5W/3nrc6vn3/3i+0vPWPzY8Av5i8+/rnmp83Lvq6mvOscjxx+8znk98ab8rc7bfe+477rfx70fmSj8QP5Q89H6Y8en0E/3Pud8/vwv94Tz+4A5JREAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfcAx8WHyF/aorvAAABgUlEQVRIx8WWsXnCQAyFf5smHZR0oUwXynS5EWADsgEbyNqADUKZdB4BbwAbmDIdbJBGzmc7d+eD8BGVZ1nv9PSkU0aiicgjMAMmdnQCalU9pvyfJQRfAwsD8VkNlMAmBpoFAMZAYSCX2AYoVPU8CCQiz8AWmHOd7YGVqh6CQAaya9XhWjsBrg2W9eja/SETX2auoTFvfShuCILFKjoZmbrqyE+lqW7uuXVtqgzZTFWPTUYxdW1VdQk4C9ynZmniCdm6TV3oRqWqvgEY1w1Yh3/zKQMxFgDZAG2dgC3R4DmLCWmWicirOZEK5mnuIbW6PDJa2urZNZlcAUJToxN3sBSgIHU9gQwC1ZeAiMi4TWMiWJ3baA+B1QF17TxgsRg/DRvsARF59xS+IxDzWUSmyv1G0Aigqqqzc24CvAScn4Cp53xq34IPoap++qb3/oaK3v+a3vd4+PJeXxxS+yKhJTpP+ajvVVXVl3PuA3iI1Cy2nKx829D/rlsDCyRWw4sWyG+u+8N6uRUsuAAAAABJRU5ErkJggg==) no-repeat;
- // if you alter the size of the image, the dimensions
- // and layout position will need to be changed as well
- height: 27px;
- width: 27px;
- top: 4px;
- right: 2px; } } }
diff --git a/examples/site/stylesheets/scss/_intro.scss b/examples/site/stylesheets/scss/_intro.scss
deleted file mode 100644
index d115ee9..0000000
--- a/examples/site/stylesheets/scss/_intro.scss
+++ /dev/null
@@ -1,94 +0,0 @@
-body#index_page {}
-
-#blurb {
- text-align: center;
- #headline {
- font-size: 50px; }
- #subline {
- font-style: italic; } }
-
-.example {
- border: 2px solid black;
- padding: 10px;
- margin: 5px; }
-
-.demonstration {
- margin: 5px;
- padding: 10px; }
-
-.explanation {
- margin: 5px;
- margin-left: 330px;
- padding: 5px;
- width: 500px;
- border: 1px solid black;
- .code {
- border: 1px solid gray;
- border-width: 1px 1px 4px 6px;
- padding: 10px;
- background: #cdcdcd; } }
-
-// Toggler Styling
-
-[data-ur-set="toggler"] {
- background: #fafafa;
- color: black;
- padding: 5px;
- border: 1px solid black;
- p {
- margin: 0em; }
- [data-ur-toggler-component="button"] {
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- background: #ffd700 url("resources/largeshade.png") no-repeat left bottom;
- color: black;
- margin: 5px;
- padding: 5px; }
- [data-ur-toggler-component='content'] {
- display: none;
- &[data-ur-state='enabled'] {
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- display: block;
- margin: 5px;
- padding: 5px;
- background: #ffd700 url("resources/largeshade.png") no-repeat left bottom;
- color: black;
- li {
- color: black;
- margin-left: 50px; } } } }
-
-// Select-List Styling
-
-#exselectlist {
- border: 1px solid black;
- background: #fafafa;
- color: black;
- padding: 5px;
- [data-ur-state='enabled'] {
- background: #ffd700 url("resources/largeshade.png") no-repeat left bottom; } }
-
-// Carousel Styling
-
-#excarousel [data-ur-set="carousel"] {
- [data-ur-carousel-component="view_container"] {
- overflow-x: hidden;
- }
- [data-ur-carousel-component="scroll_container"] {
- margin: auto;
- overflow: hidden;
- position: relative;
- width: 100px;
- height: 100px;
- img {
- float: left;
- width: 100px;
- height: 100px;
- }
- }
- [data-ur-carousel-component="button"][data-ur-state="disabled"] {
- opacity: 0.3;
- }
-}
diff --git a/examples/site/stylesheets/scss/_map.scss b/examples/site/stylesheets/scss/_map.scss
deleted file mode 100644
index 82416f1..0000000
--- a/examples/site/stylesheets/scss/_map.scss
+++ /dev/null
@@ -1,74 +0,0 @@
-* {
- &[data-ur-map-component='canvas'] {
- width: 300px;
- height: 300px; }
- &[data-ur-map-component='description'] {
- display: none;
- &[data-ur-state='enabled'] {
- display: block; } }
- &[data-ur-map-component='address'] {
- display: none; }
- &[data-ur-map-component='icon'] {
- position: absolute;
- visibility: hidden; } }
-
-body[id*='map'] {
- .attributes {
- display: block;
- background: silver url("resources/largestshade.png") no-repeat left bottom;
- border: 1px solid black;
- padding: 20px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px; } }
-
-// Hidden example
-
-body.hidden_page {
- [data-ur-set='map'] {
- position: absolute;
- visibility: hidden; }
- [data-ur-toggler-component='content'][data-ur-state='enabled'] > [data-ur-set='map'] {
- position: relative;
- visibility: visible; } }
-
-body#advanced_map_page {
- *[data-ur-set="map"] {
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- display: hidden;
- margin: 5px;
- padding: 5px;
- background: gold url("resources/largeshade.png") no-repeat left bottom;
- color: black;
- width: 300px;
- *[data-ur-map-component="icon"] {
- img {
- width: 10px;
- height: 10px; } } } }
-
-body#hidden_map_page {
- [data-ur-set="toggler"] {
- background: #323232;
- border: none; } }
-
-body#late_load_map_page {
- span#map_button {
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- background: gold url("resources/largeshade.png") no-repeat left bottom;
- color: black;
- margin: 5px;
- padding: 5px; }
- *[data-ur-set="map"] {
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- display: hidden;
- margin: 5px;
- padding: 5px;
- background: gold url("resources/largeshade.png") no-repeat left bottom;
- color: black;
- width: 300px; } }
diff --git a/examples/site/stylesheets/scss/_more.scss b/examples/site/stylesheets/scss/_more.scss
deleted file mode 100644
index d9a700f..0000000
--- a/examples/site/stylesheets/scss/_more.scss
+++ /dev/null
@@ -1,26 +0,0 @@
-body#more_page [data-ur-set="toggler"] {
- background: none;
- border: none;
- [data-ur-toggler-component="button"] {
- width: 250px; }
- [data-ur-toggler-component="content"] {
- display: none;
- width: 250px;
- &[data-ur-state="enabled"] {
- display: block; } }
- .bio {
- background: #323232;
- padding: 5px;
- margin: 10px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- p {
- color: silver; } }
- img {
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- display: block;
- margin-left: auto;
- margin-right: auto; } }
diff --git a/examples/site/stylesheets/scss/_resizer.scss b/examples/site/stylesheets/scss/_resizer.scss
deleted file mode 100644
index 4e1f0f4..0000000
--- a/examples/site/stylesheets/scss/_resizer.scss
+++ /dev/null
@@ -1,14 +0,0 @@
-body#font_resizer_page {
- p[data-ur-font-resizer-component="content"] {
- color: black; } }
-
-body#font_resizer_page {
- .font_resizer {
- background: silver;
- color: #323232;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- padding: 10px;
- p {
- color: #323232; } } }
diff --git a/examples/site/stylesheets/scss/_select_buttons.scss b/examples/site/stylesheets/scss/_select_buttons.scss
deleted file mode 100644
index eea42c5..0000000
--- a/examples/site/stylesheets/scss/_select_buttons.scss
+++ /dev/null
@@ -1,16 +0,0 @@
-body#select_buttons_page {
- [data-ur-select-buttons-component] {
- border-radius: 5px;
- display: inline-block;
- width: 30px;
- height: 20px;
- text-align: center;
- margin: 5px; }
- [data-ur-select-buttons-component='select'] {
- width: 100px; }
- [data-ur-select-buttons-component='increment'] {
- background-color: #c7e8ad; }
- [data-ur-select-buttons-component='decrement'] {
- background-color: #e8b5ad; }
- [data-ur-select-buttons-component][data-ur-state='disabled'] {
- opacity: 0.5; } }
diff --git a/examples/site/stylesheets/scss/_select_lists.scss b/examples/site/stylesheets/scss/_select_lists.scss
deleted file mode 100644
index 5dbf377..0000000
--- a/examples/site/stylesheets/scss/_select_lists.scss
+++ /dev/null
@@ -1,41 +0,0 @@
-body#select_list_page {
- .demonstration {
- #select_list_demonstration {
- *[data-ur-set="select-list"] {
- width: 230px;
- height: 150px;
- background: rgb(250, 250, 250) url("resources/largeshade.png") no-repeat left bottom;
- padding: 6px;
- padding-left: 10px;
- padding-right: 10px;
- margin: auto;
- margin-top: 30px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- select {
- width: 100%; }
- ul {
- padding: 0px;
- li {
- color: #323232;
- font-size: 18px;
- font-family: Rockwell;
- text-align: center;
- list-style: none; } } } } }
- [data-ur-set="select-list"] {
- text-align: center; }
- [data-ur-id="MyUIDSelectList"][data-ur-select-list-component="content"] {
- color: #fafafa;
- text-align: left;
- background: silver;
- width: 250px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- [data-ur-state="enabled"] {
- background-color: #ffd700 url("resources/largeshade.png") no-repeat left bottom; }
- span {
- margin: 10px;
- padding-left: 10px;
- padding-right: 10px; } } }
diff --git a/examples/site/stylesheets/scss/_styling.scss b/examples/site/stylesheets/scss/_styling.scss
deleted file mode 100644
index 6131932..0000000
--- a/examples/site/stylesheets/scss/_styling.scss
+++ /dev/null
@@ -1,130 +0,0 @@
-body#styling_page {
- // Lazy styling
- * {
- &[data-ur-toggler-component='button'][data-ur-id='LazyPopup'] {
- border-radius: 5px;
- background: #ffd700;
- opacity: 0.5;
- padding: 5px;
- display: inline;
- margin: 0px 5px;
- &[data-ur-state='enabled'] {
- opacity: 1; } }
- &[data-ur-toggler-component='content'][data-ur-id='LazyPopup'] {
- display: none;
- position: absolute;
- border-radius: 5px;
- background-color: #aaaaaa;
- width: 300px;
- height: 350px;
- left: 200px;
- bottom: -50px;
- text-align: center;
- padding-top: 30px;
- &[data-ur-state='enabled'] {
- display: block; } } }
- // Proper Styling
- //.popup_button, .popup_button > span{
- // border-radius: 5px;
- // background-color: #6495ED;
- // opacity: 1.0;
- // padding: 5px;
- // display: inline;
- // margin: 0px 5px;
- //}
- .popup_content {
- position: absolute;
- border-radius: 5px;
- background-color: #aaaaaa;
- bottom: -600px;
- //height: 500px;
- //left: 200px;
- text-align: center;
- padding: 30px;
- z-index: +1; }
- .popup_button {
- border-radius: 5px;
- background: blue;
- opacity: 1;
- padding: 5px;
- display: inline;
- margin: 0px 5px;
- > span {
- border-radius: 5px;
- background: blue;
- opacity: 1;
- padding: 5px;
- display: inline;
- margin: 0px 5px; } }
- *[data-ur-id="ProperPopup"] {
- background: #323232;
- border: none; }
- *[data-ur-id='ProperPopup'] * {
- &[data-ur-toggler-component='button'] {
- background: #64953d;
- &[data-ur-state='disabled'] {
- background: #ffd700;
- opacity: 0.5; }
- &[data-ur-state='enabled'] {
- background: #ffd700;
- opacity: 1; } }
- &[data-ur-toggler-component='content'] {
- &[data-ur-state='disabled'] {
- display: none;
- opacity: 0.5; }
- &[data-ur-state='enabled'] {
- display: inline-block;
- opacity: 1; } } }
- //[data-ur-toggler-component='content'][data-ur-state='enabled'][data-ur-id='ProperPopup'] img{
- // width: 200px;
- // height: 200px;
- //}
-}
-
-body#grouping_page {
- [data-ur-set="toggler"] {
- background: none;
- border: none; }
- [data-ur-toggler-component="button"] {
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- background: gold url("{{site.url}}resources/largeshade.png") no-repeat left bottom;
- color: black;
- margin: 5px;
- padding: 5px;
- width: 300px;
- border: none; }
- [data-ur-toggler-component="content"] {
- display: none; }
- [data-ur-toggler-component="content"][data-ur-state="enabled"] {
- webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- display: block;
- margin: 5px;
- padding: 5px;
- background: gold url("{{site.url}}resources/largeshade.png") no-repeat left bottom;
- color: black;
- width: 300px;
- li {
- margin-left: 50px;
- color: black; } }
- img {
- border: 3px dashed rgb(60, 60, 60);
- padding: 5px;
- display: block;
- margin-left: auto;
- margin-right: auto; } }
-
-body#who_page {
- [data-ur-set="toggler"] {
- background: none;
- border: none;
- [data-ur-toggler-component="button"] {
- width: 250px; }
- [data-ur-toggler-component="content"] {
- display: none;
- width: 250px; }
- [data-ur-toggler-component="content"][data-ur-state="enabled"] {
- display: block; } } }
diff --git a/examples/site/stylesheets/scss/_swipe_toggle.scss b/examples/site/stylesheets/scss/_swipe_toggle.scss
deleted file mode 100644
index 23596b9..0000000
--- a/examples/site/stylesheets/scss/_swipe_toggle.scss
+++ /dev/null
@@ -1 +0,0 @@
-#swipe_toggle_page {}
diff --git a/examples/site/stylesheets/scss/_tabs.scss b/examples/site/stylesheets/scss/_tabs.scss
deleted file mode 100644
index d8317f5..0000000
--- a/examples/site/stylesheets/scss/_tabs.scss
+++ /dev/null
@@ -1,107 +0,0 @@
-// Tabs Page
-
-body#tabs_page {
- * {
- &[data-ur-tabs-component='button'] {
- background-color: silver;
- border: 1px solid black;
- border-top-left-radius: 5px 5px;
- border-top-right-radius: 5px 5px;
- bottom: -1px;
- display: inline-block;
- margin: 0px 5px;
- padding: 5px;
- position: relative;
- babutton {
- padding-top: 6px;
- padding-bottom: 0px;
- padding-left: 0px;
- padding-right: 0px;
- margin: 0; }
- babutton[data-ur-state="disabled"] {
- background: #ffd700;
- color: #323232;
- opacity: 0.2; }
- babutton[data-ur-state="enabled"] {
- color: #323232;
- background: #ffd700; }
- babutton[data-ur-tab-id="advancedpage"] {
- margin-right: 100px;
- margin-left: 0px;
- margin-top: 0px;
- margin-bottom: 0px; } }
- &[data-ur-tabs-component='content'] {
- display: none;
- background-color: silver; }
- &[data-ur-tabs-component='button'][data-ur-state='disabled'] {
- opacity: 0.5; }
- &[data-ur-tabs-component='button'][data-ur-state='enabled'] {
- opacity: 1;
- border-bottom: 1px solid silver; }
- &[data-ur-tabs-component='content'][data-ur-state='enabled'] {
- display: block;
- background-color: silver;
- border: 1px solid black;
- padding: 20px; }
- &[data-ur-set="tabs"][data-ur-tab-id="html"] {
- text-align: left; } }
- #tab_widget *[data-ur-set="tabs"] * {
- &[data-ur-tabs-component="button"] {
- background: #ffd700; }
- &[data-ur-tabs-component="button"][data-ur-state="enabled"] {
- background: #ffd700;
- border-bottom: 1px solid #ffd700; }
- &[data-ur-tabs-component="content"] {
- background: #ffd700; } }
- // Accordions w state
- div[name='accordions'] * {
- &[data-ur-tabs-component='button'] {
- display: block;
- border: 1px solid blue;
- background-color: white; }
- &[data-ur-tabs-component='content'] {
- background-color: white;
- margin: 0px 20px; } }
- // Further examples
- #tabs_examples_page {
- * {
- &[data-ur-tabs-component='button'] {
- opacity: 0.5;
- background-color: #ffd700;
- border: 1px solid black;
- border-top-left-radius: 5px 5px;
- border-top-right-radius: 5px 5px;
- bottom: -1px;
- display: inline-block;
- margin: 0px 5px;
- padding: 5px;
- position: relative; }
- &[data-ur-tabs-component='content'] {
- display: none;
- background-color: #ffd700;
- border-radius: 5px; }
- &[data-ur-tabs-component='button'][data-ur-state='enabled'] {
- opacity: 1;
- border-bottom: 1px solid #ffd700; }
- &[data-ur-tabs-component='content'][data-ur-state='enabled'] {
- display: block;
- background-color: #ffd700;
- border: 1px solid black;
- padding: 20px; }
- &[data-ur-set="tabs"][data-ur-tab-id="html"] {
- text-align: left; } }
- #tab_widget *[data-ur-set="tabs"] * {
- &[data-ur-tabs-component="button"] {
- background: #ffd700; }
- &[data-ur-tabs-component="content"] {
- background: #ffd700; } }
- // Accordions w state
- div[name='accordions'] * {
- &[data-ur-tabs-component='button'] {
- display: block;
- border: 1px solid black;
- background-color: #ffd700;
- border-radius: 5px; }
- &[data-ur-tabs-component='content'] {
- background-color: #ffd700;
- margin: 0px 20px; } } } }
diff --git a/examples/site/stylesheets/scss/_test.scss b/examples/site/stylesheets/scss/_test.scss
deleted file mode 100644
index c7b4cb6..0000000
--- a/examples/site/stylesheets/scss/_test.scss
+++ /dev/null
@@ -1,137 +0,0 @@
-li[data-ur-set="toggler"] {
- [data-ur-toggler-component='button'] {
- background-color: #a3e2f5; }
- [data-ur-toggler-component='content'] {
- display: none;
- background-color: #d0e9f0;
- &[data-ur-state="enabled"] {
- display: block; } } }
-
-#adv_btn, #basic_btn {
- @include border-radius(5px);
- background: #ffd700;
- color: #323232;
- width: 98px;
- height: 25px;
- padding-top: 6px;
- font-size: 15px;
- text-align: center;
- float: right;
- display: inline-block;
- border-left: 1.5px solid rgb(80, 80, 80);
- border-right: 1.5px solid rgb(0, 0, 0);
- &[data-ur-state="disabled"] {
- opacity: 0.2;
- }
-}
-
-#adv_btn {
- margin-right: 100px;
-}
-
-.components li {
- color: #323232; }
-
-.components *[data-ur-toggler-component="button"], .components *[data-ur-flex-table-component] {
- color: #323232;
- background: none;
- font-weight: bold;
- margin-bottom: 5px;
- padding: 5px;
- border: 2px dashed #fafafa;
- display: inline-block;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px; }
-
-.attributes {
- margin-bottom: 15px; }
-
-.attributes h3 {
- color: #323232; }
-
-.attributes *[data-ur-tabs-component="content"] li {
- color: #323232; }
-
-.attributes .inline_code {
- background: none;
- color: #323232; }
-
-.attributes .set_name {
- padding: 5px;
- font-weight: bold;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- display: inline-block;
- border: 2px dashed #fafafa;
- margin-bottom: 10px;
- margin-left: 25px; }
-
-.attributes *[data-ur-tabs-component="content"] li *[data-ur-toggler-component="content"] li [data-ur-state="enabled"] {
- color: #323232; }
-
-.attributes *[data-ur-tabs-component='button'] {
- opacity: 0.5;
- background: silver url("resources/largeshade.png") no-repeat left bottom;
- border: 1px solid black;
- border-top-left-radius: 5px 5px;
- border-top-right-radius: 5px 5px;
- bottom: -1px;
- display: inline-block;
- margin: 0px 5px;
- padding: 5px;
- position: relative; }
-
-.attributes *[data-ur-tabs-component='content'] {
- display: none;
- background: silver; }
-
-.attributes *[data-ur-tabs-component='button'][data-ur-state='enabled'] {
- opacity: 1;
- background: #fafafa;
- border-bottom: 1px solid #fafafa; }
-
-.attributes *[data-ur-tabs-component='content'][data-ur-state='enabled'] {
- display: block;
- background: silver url("resources/largestshade.png") no-repeat left bottom;
- padding: 20px;
- @include border-radius(5px); }
-
-.attributes *[data-ur-set="tabs"][data-ur-tab-id="html"] {
- text-align: left; }
-
-.attributes #tab_widget *[data-ur-set="tabs"] *[data-ur-tabs-component="button"] {
- background: silver; }
-
-.attributes #tab_widget *[data-ur-set="tabs"] *[data-ur-tabs-component="content"] {
- background: silver; }
-
-.attributes .advanced_tab ul {
- list-style-type: none;
- margin-bottom: 10px; }
-
-.attributes li[data-ur-set="toggler"] {
- padding: 10px; }
-
-.attributes li[data-ur-set="toggler"] [data-ur-toggler-component='button'] {
- background: none;
- color: #323232;
- padding: none;
- border: 1px dashed #fafafa;
- border-raduis: none; }
-
-.attributes li[data-ur-set="toggler"] [data-ur-toggler-component='content'] {
- display: none; }
-
-.attributes li[data-ur-set="toggler"] [data-ur-toggler-component='content'][data-ur-state="enabled"] {
- display: block;
- background: none;
- width: 100%;
- color: #323232; }
-
-.attributes li[data-ur-set="toggler"] [data-ur-toggler-component='content'][data-ur-state="enabled"] li {
- color: #323232; }
-
-.attributes p.instance {
- color: #323232; }
diff --git a/examples/site/stylesheets/scss/_toggler.scss b/examples/site/stylesheets/scss/_toggler.scss
deleted file mode 100644
index 54ba931..0000000
--- a/examples/site/stylesheets/scss/_toggler.scss
+++ /dev/null
@@ -1,239 +0,0 @@
-body#togglers_page {
- * {
- &[data-ur-set="toggler"] {
- border: none;
- background: silver; }
- &[data-ur-toggler-component='button'] {
- background-color: #ffd700; }
- &[data-ur-toggler-component='content'] {
- display: none;
- background-color: #ffd700; }
- &[data-ur-toggler-component='button'][data-ur-state='enabled'] {
- opacity: 1; }
- &[data-ur-toggler-component='content'][data-ur-state='enabled'] {
- display: block; } }
- .components {
- [data-ur-toggler-component='button'] {
- background: none; } }
- // Popup examples
- // Lazy styling
- div[name='Dialog'] * {
- &[data-ur-toggler-component='button'] {
- border-radius: 5px;
- background-color: #ffd700;
- opacity: 1;
- padding: 5px; }
- &[data-ur-toggler-component='content'] {
- display: none;
- position: absolute;
- border-radius: 5px;
- background-color: #aaaaaa;
- width: 500px;
- height: 500px;
- left: 200px;
- bottom: 50px;
- text-align: center;
- padding-top: 30px;
- &[data-ur-state='enabled'] {
- display: block; } } }
- // Proper Styling
- .popup_button {
- border-radius: 5px;
- background-color: #ffd700;
- opacity: 1;
- padding: 5px;
- display: inline;
- margin: 0px 5px;
- > span {
- border-radius: 5px;
- background-color: #ffd700;
- opacity: 1;
- padding: 5px;
- display: inline;
- margin: 0px 5px; } }
- .popup_content {
- position: absolute;
- border-radius: 5px;
- background-color: #aaaaaa;
- // width: 500px
- // //height: 500px
- left: 200px;
- // bottom: 50px
- text-align: center;
- padding: 30px;
- &[data-ur-state='disabled'] {
- display: none;
- opacity: 0.5; }
- &[data-ur-state='enabled'] {
- display: inline-block;
- opacity: 1;
- img {
- width: 200px;
- height: 200px; } } }
- // multiple example
- [name='MultipleContents'] .buttons {
- background-color: white;
- opacity: 1;
- // override lazy styling from above
- }
- .buttons {
- &[data-ur-state="enabled"] span:last-child, &[data-ur-state="disabled"] span:first-child {
- opacity: 0.5; } }
- [name='MultipleContents'] {
- .popup_content {
- position: relative;
- width: 250px;
- height: 250px;
- padding: 20px;
- img {
- width: 200px;
- height: 200px; } }
- [data-ur-toggler-component="content"] {
- display: inline-block; } } }
-
-body#togglers_page {
- * {
- &[data-ur-toggler-component='button'] {
- opacity: 0.5;
- border-radius: 5px;
- background-color: #ffd700;
- opacity: 1;
- padding: 5px;
- width: 190px;
- height: 30px;
- margin: auto;
- margin-top: 15px;
- padding-top: 10px;
- color: rgb(50, 50, 50);
- font-size: 18px;
- font-family: Rockwell;
- text-align: center;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px; }
- &[data-ur-toggler-component='content'] {
- display: none;
- background-color: #ffd700;
- border-radius: 5px;
- opacity: 1;
- padding: 5px;
- width: 190px;
- margin: auto;
- margin-top: 15px;
- padding-top: 10px;
- color: black;
- font-size: 18px;
- font-family: Rockwell;
- text-align: center;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- li {
- color: black;
- margin-left: 30px; }
- li[data-ur-set="toggler"] {
- border: none;
- background: #fafafa;
- [data-ur-toggler-component="button"] {
- background: #fafafa;
- padding-top: 0px; }
- [data-ur-toggler-component="content"][data-ur-state="enabled"] {
- background: #fafafa;
- width: 100px; } } }
- &[data-ur-toggler-component='button'][data-ur-state='enabled'] {
- opacity: 1; }
- &[data-ur-toggler-component='content'][data-ur-state='enabled'] {
- display: block; } }
- // Popup examples
- // Lazy styling
- div[name='Dialog'] * {
- &[data-ur-toggler-component='button'] {
- border-radius: 5px;
- background-color: #ffd700;
- opacity: 1;
- padding: 5px;
- width: 190px;
- height: 30px;
- margin: auto;
- margin-top: 15px;
- padding-top: 10px;
- color: rgb(50, 50, 50);
- font-size: 18px;
- font-family: Rockwell;
- text-align: center;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px; }
- &[data-ur-toggler-component='content'] {
- display: none;
- position: absolute;
- border-radius: 5px;
- background-color: #aaaaaa;
- width: 500px;
- height: 500px;
- left: 200px;
- bottom: 50px;
- text-align: center;
- padding-top: 30px;
- &[data-ur-state='enabled'] {
- display: block; } } }
- // Proper Styling
- .popup_button {
- border-radius: 5px;
- background-color: #ffd700;
- opacity: 1;
- padding: 5px;
- display: inline;
- margin: 0px 5px;
- > span {
- border-radius: 5px;
- background-color: #ffd700;
- opacity: 1;
- padding: 5px;
- display: inline;
- margin: 0px 5px; } }
- .popup_content {
- position: absolute;
- border-radius: 5px;
- background-color: #aaaaaa;
- // width: 500px
- // //height: 500px
- left: 270px;
- // bottom: 50px
- text-align: center;
- padding: 30px;
- &[data-ur-state='disabled'] {
- display: none;
- opacity: 0.5; }
- &[data-ur-state='enabled'] {
- display: inline-block;
- opacity: 1;
- z-index: 10;
- img {
- width: 200px;
- height: 200px; } } }
- // multiple example
- [name='MultipleContents'] {
- .buttons {
- &[data-ur-state="enabled"] span:last-child, &[data-ur-state="disabled"] span:first-child {
- opacity: 0.5; } } }
- [name='MultipleContents'] {
- .popup_content {
- position: relative;
- width: 220px;
- height: 200px;
- padding: 20px;
- [data-ur-toggler-component="content"][data-ur-state="disabled"] {
- img {
- display: none; } }
- [data-ur-toggler-component="content"][data-ur-state="enabled"] {
- img {
- display: block; } }
- img {
- width: 200px;
- height: 200px; } } }
- #disabled {
- background: #323232;
- border: none; }
- div[data-ur-id='MyToggler'].buttons {
- background-color: #ffd700 !important; } }
diff --git a/examples/site/stylesheets/scss/_tutorial.scss b/examples/site/stylesheets/scss/_tutorial.scss
deleted file mode 100644
index 3309527..0000000
--- a/examples/site/stylesheets/scss/_tutorial.scss
+++ /dev/null
@@ -1,22 +0,0 @@
-body#tutorial_page {
- *[data-ur-tabs-component='content'] {
- &[data-ur-state='enabled'] {
- display: block; }
- display: none; }
- *[data-ur-set="toggler"] {
- background: #323232;
- border: none; }
- #end_product * {
- &[data-ur-toggler-component='button'] {
- background: #ffd700;
- &:hover {}
- cursor: hand;
- cursor: pointer;
- width: 200px; }
- &[data-ur-toggler-component='content'] {
- &[data-ur-state='enabled'] {
- display: block;
- background: #ffd700;
- width: 200px; }
- &[data-ur-state="disabled"] {
- display: none; } } } }
diff --git a/examples/site/stylesheets/scss/_widget_list.scss b/examples/site/stylesheets/scss/_widget_list.scss
deleted file mode 100644
index dea1da2..0000000
--- a/examples/site/stylesheets/scss/_widget_list.scss
+++ /dev/null
@@ -1,4 +0,0 @@
-#widget_list_page {
- #widget_detail {
- li {
- padding-bottom: 5px; } } }
diff --git a/examples/site/stylesheets/scss/_yellow_toggler.scss b/examples/site/stylesheets/scss/_yellow_toggler.scss
deleted file mode 100644
index a0663e1..0000000
--- a/examples/site/stylesheets/scss/_yellow_toggler.scss
+++ /dev/null
@@ -1,8 +0,0 @@
-li[data-ur-set="toggler"] {
- [data-ur-toggler-component='button'] {
- background-color: #a3e2f5; }
- [data-ur-toggler-component='content'] {
- display: none;
- background-color: #d0e9f0;
- &[data-ur-state="enabled"] {
- display: block; } } }
diff --git a/examples/site/stylesheets/scss/_zoom_preview.scss b/examples/site/stylesheets/scss/_zoom_preview.scss
deleted file mode 100644
index a222a7e..0000000
--- a/examples/site/stylesheets/scss/_zoom_preview.scss
+++ /dev/null
@@ -1,63 +0,0 @@
-body#zoom_preview_page {
- [data-ur-zoom-preview-component='container'] {
- width: 204px;
- height: 204px;
- overflow: hidden;
- border: 1px solid black;
- position: relative; }
- [data-ur-zoom-preview-component='zoom_image'] {
- position: absolute;
- z-index: 20; }
- [data-ur-zoom-preview-component='button'] {
- z-index: 30;
- border: 1px solid black;
- width: 62px;
- height: 62px;
- position: absolute;
- right: 2px;
- bottom: 2px;
- background-color: #bbbbbb; }
- [data-ur-zoom-preview-component='thumbnails'] {
- height: auto;
- > li {
- display: inline-block; } }
- // Un-related CSS
- .normal_image {
- width: 200px;
- height: 200px;
- margin: 2px;
- img {
- width: 200px;
- height: 200px; } } }
-
-body#zoom_preview_examples_page {
- [data-ur-zoom-preview-component='container'] {
- width: 204px;
- height: 204px;
- overflow: hidden;
- border: 1px solid black;
- position: relative; }
- [data-ur-zoom-preview-component='zoom_image'] {
- position: absolute;
- z-index: 20; }
- [data-ur-zoom-preview-component='button'] {
- z-index: 30;
- border: 1px solid black;
- width: 62px;
- height: 62px;
- position: absolute;
- right: 2px;
- bottom: 2px;
- background-color: #bbbbbb; }
- [data-ur-zoom-preview-component='thumbnails'] {
- height: auto;
- > li {
- display: inline-block; } }
- // Un-related CSS
- .normal_image {
- width: 200px;
- height: 200px;
- margin: 2px;
- img {
- width: 200px;
- height: 200px; } } }
diff --git a/examples/site/stylesheets/scss/base.scss b/examples/site/stylesheets/scss/base.scss
deleted file mode 100644
index 7f159e2..0000000
--- a/examples/site/stylesheets/scss/base.scss
+++ /dev/null
@@ -1,23 +0,0 @@
-@import "compass";
-
-@import "_carousel.scss";
-@import "_compatibility.scss";
-@import "_demonstration.scss";
-@import "_geocode.scss";
-@import "_intro.scss";
-@import "_map.scss";
-@import "_resizer.scss";
-@import "_select_buttons.scss";
-@import "_select_lists.scss";
-@import "_styling.scss";
-@import "_tabs.scss";
-@import "_test.scss";
-@import "_toggler.scss";
-@import "_tutorial.scss";
-@import "_zoom_preview.scss";
-@import "_widget_list.scss";
-@import "_more.scss";
-@import "_swipe_toggle.scss";
-@import "_flex_table.scss";
-@import "_input_clear.scss";
-@import "_highlight_code.scss";
diff --git a/examples/site/stylesheets/scss/yellow_base.scss b/examples/site/stylesheets/scss/yellow_base.scss
deleted file mode 100644
index 15a2493..0000000
--- a/examples/site/stylesheets/scss/yellow_base.scss
+++ /dev/null
@@ -1 +0,0 @@
-@import "_yellow_toggler.scss";
diff --git a/examples/site/stylesheets/style_index_yellow.css b/examples/site/stylesheets/style_index_yellow.css
deleted file mode 100755
index 74ac06c..0000000
--- a/examples/site/stylesheets/style_index_yellow.css
+++ /dev/null
@@ -1,388 +0,0 @@
-html {
- padding: 0; margin: 0;
- font-family: Arial;
-}
-body {
- background-color: #FFD700;
- padding: 0; margin: 0;
-}
-/* Menu */
-#menu {
- width: 100%; height: 40px; margin: 0 auto;
- padding-top: 10px;
- background: rgb(50,50,50);
- border-bottom: 2px solid rgb(10,10,10);
-}
- #menuwrap {
- width: 624px; height: 40px;
- margin: auto;
- }
- .menuselect {
- width: 98px; height: 25px; padding-top: 6px;
- font-size: 15px; text-align: center;
- float: left;
- border-left: 1px solid rgb(80,80,80); border-right: 1px solid rgb(0,0,0);
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- }
- .menuselect:hover {
- background: rgb(55,55,55);
- }
- .toplinks.selected div {
- background: #FFD700 url('resources/largeshade.png') no-repeat left top;
- }
- .toplinks.selected a {
- color: rgb(50,50,50); text-decoration: none;
- }
- .toplinks.selected:hover div {
- background: #FFD700 url('resources/largeshade.png') no-repeat left top;
- }
-
-/* Top Header */
-.top_wrapper {
- max-width: 920px; min-width: 920px;
- padding-left: 20px; padding-right: 20px;
- margin: 0 auto;
- overflow: hidden;
-}
-.wrapper {
- /*max-width: 920px; min-width: 920px;*/
- padding-left: 20px; padding-right: 20px;
- margin: 0 50px 0 100px;
- overflow: hidden;
-}
-.description_wrapper {
- /*max-width: 920px; min-width: 920px;*/
- padding-left: 20px; padding-right: 20px;
- margin: 0 50px 0 100px;
- overflow: hidden;
- display: inline-block;
-}
- #uraniumlogo {
- width: 500px; height: 200px;
- background:url('resources/uraniumlogo.png') no-repeat 50% 50%;
- float: left;
- }
- #rightinfo {
- width: 370px; height: 150px;
- padding-top: 50px; text-align: center;
- background: rgb(250,250,250) url('resources/largeshade.png') no-repeat left bottom;
- border-left: 1px solid rgb(220,220,220); border-right: 1px solid rgb(220,220,220);
- color: rgb(50,50,50); font-size: 25px; font-style: italic; font-family: Rockwell;
- text-shadow:0px 1px 0px #C7C7C7;
- float: right;
- }
- .smalltext {
- font-size: 18px;
- }
- #rightshadow {
- width: 40px; height: 200px;
- background: url('resources/rightshadow.png') repeat-y left top;
- float: right;
- }
-
-/* Body Text */
-#textbody {
- width: 100%; margin: 0 auto;
- padding-top: 20px; padding-bottom: 30px;
- background: rgb(50,50,50);
- border-top: 7px solid #000000;
-}
- #centertext {
- width: 100%; text-align: center;
- }
- #lefttext {
- width: 70%; float: right;
- }
- h1 {
- color: #F5F5F5; font-style: italic; font-family: Rockwell;
- text-shadow:0px 2px 0px #000000;
- margin: auto; margin-bottom: 10px;
- font-size: 29px;
- }
- h2 {
- color: #FFD700; font-style: italic; font-family: Rockwell;
- text-shadow:0px 1px 0px #000000;
- margin: auto; margin-bottom: 10px;
- }
- h3 {
- color: #FFD700; font-style: italic; font-family: Rockwell;
- text-shadow:0px 1px 0px #000000;
- margin: auto; margin-bottom: 10px;
- }
- h4 {
- color: #323232; font-style: italic; font-family: Rockwell;
- margin: auto; margin-bottom: 10px;
- }
- p {
- color: #C0C0C0;
- }
-
- ol {
- color: #C0C0C0;
- }
- ul {
- color: #C0C0C0;
- }
- li {
- color: #C0C0C0;
- }
- hr {
- border-top: solid #464646;
- border-bottom: solid #1e1e1e;
- border-width: 1px 0;
- margin: 30px auto;
- }
-
- #how_to_use {
- width: 350px;
- background: #FAFAFA url('resources/largeshade.png') no-repeat left bottom;
- padding: 6px;
- padding-left: 10px;
- padding-right: 10px;
- margin: auto;
- margin-top: 30px;
- margin-bottom: 30px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- }
- #how_to_use p {
- color: #323232; font-style: italic; font-family: Rockwell; font-size: 20px;
- }
- #how_to_use li {
- color: #323232; font-style: italic; font-family: Rockwell; font-size: 20px;
- }
-#sidenote {
- color: #C0C0C0;
- text-align: right;
- font-size: 12px;
- margin-bottom: -25px;
-}
- /* Example Styles */
- .examplewrap {
- margin: auto;
- }
-
- #lefthead {
- float: left;
- width: 360px;
- }
- .example {
- width: 310px; height: 170px;
- float: left; padding: 10px;
- background-color: rgb(40,40,40);
- border: 3px solid rgb(60,60,60);
- -webkit-border-radius: 10px;
- -moz-border-radius: 10px;
- border-radius: 10px;
- }
- .mainpage_code {
- overflow: hidden;
- padding-left: 10px;
- }
- .code {
- background-color: rgb(40,40,40);
- border: 3px dashed rgb(60,60,60);
- padding: 10px;
- color: #C0C0C0; font-family: Courier New; font-size: 14px;
- -webkit-border-radius: 10px;
- -moz-border-radius: 10px;
- border-radius: 10px;
- }
- .inline_code {
- background-color: rgb(40,40,40);
- color: #C0C0C0; font-family: Courier New; font-size: 18px;
- margin: 5px;
- }
- #toggler {}
- #togglercode {}
- #carousel {
- height: 250px;
- }
- #carouselcode {
- height: 250px;
- font-size: 12px;
- }
- #select_list_code {
- font-size: 12px;
- }
- #brown { color: #FA8072; }
- #green { color: #8FBC8F; }
-
- /* Example styles. Non-functioning */
- #extoggler {
- width: 200px; height: 90px;
- background: rgb(250,250,250) url('resources/largeshade.png') no-repeat left bottom;
- padding: 6px; padding-left: 10px; padding-right: 10px; margin: auto; margin-top: 30px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- }
- #extitle {
- width: 100px; height: 20px;
- color: rgb(50,50,50); font-size: 18px; font-family: Rockwell;
- }
- #exbutton {
- width: 190px; height: 30px;
- margin: auto; margin-top: 15px; padding-top: 10px;
- color: rgb(50,50,50); font-size: 18px; font-family: Rockwell; text-align: center;
- background: #FFD700;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- }
- #exbutton:hover {
- cursor: hand;
- cursor: pointer;
- }
- #extoggler_content[data-ur-toggler-component="content"][data-ur-state="disabled"] {
- display: none;
- }
- #extoggler_content[data-ur-toggler-component="content"][data-ur-state="enabled"] {
- display: block;
- background: #C0C0C0;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- padding: 10px;
- margin-left: 5px;
- margin-top: 10px;
- width: 170px;
- }
- #excarousel {
- width: 230px; height: 180px;
- background: rgb(250,250,250) url('resources/largeshade.png') no-repeat left bottom;
- padding: 6px; padding-left: 10px; padding-right: 10px; margin: auto; margin-top: 30px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- }
- #exback {
- width: 30px; height: 30px;
- float: left;
- margin: auto; padding-top: 10px;
- color: rgb(50,50,50); font-size: 18px; font-family: Rockwell; text-align: center;
- background: #FFD700;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- display: inline;
- }
- #exback[data-ur-state="disabled"]{
- opacity: 0.5;
- }
- #exnext {
- width: 30px; height: 30px;
- float: right;
- margin: auto; padding-top: 10px;
- color: rgb(50,50,50); font-size: 18px; font-family: Rockwell; text-align: center;
- background: #FFD700;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- display: inline;
- }
- .cbutton:hover {
- cursor: hand;
- cursor: pointer;
- }
- #eximage {
- width: 70px; height: 70px;
- margin: auto;
- background: url('resources/photo1.png') no-repeat center center;
- }
- #exbottomtext {
- margin: auto; margin-top: 5px;
- text-align: center; color: rgb(50,50,50); font-family: Rockwell;
- }
-
-
- #exselectlist {
- width: 230px; height: 150px;
- background: rgb(250,250,250) url('resources/largeshade.png') no-repeat left bottom;
- padding: 6px; padding-left: 10px; padding-right: 10px; margin: auto; margin-top: 30px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- }
- #exselectlist select{
- margin-left: auto;
- margin-right: auto;
- width: 100%;
- margin-top: 10px;
- }
-
- *[data-ur-select-list-component="content"] {
- color: rgb(50,50,50); font-size: 18px; font-family: Rockwell; text-align: center; }
-
- *[data-ur-select-list-component="content"] [data-ur-state="enabled"] {
- background: #FFD700;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- }
-
- .example#select_list {
- height: 225px;
- }
-
-/* Used by logos */
-#threelogoholder {
- width: 508px; height: 75px; margin-top: 10px;
- margin: auto; margin-bottom: 20px;
-}
-#twologoholder {
- width: 332px; height: 75px; margin-top: 10px;
- margin: auto;
-}
- .onelogo {
- width: 150px; height: 75px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- }
-
- #oneleft {
- float: left;
- }
- #oneright {
- float: right; margin-left: 25px;
- }
-
-/* Footer */
-#bottombody {
- width: 100%; margin: 0 auto; border-top: 1px solid #000000;
- background: url('resources/topshadow.png') repeat-x left top;
-}
-#bottomwrap {
- margin-top: 10px; margin-bottom: 20px;
- text-align: center; color: rgb(50,50,50); font-size: 12px;
-}
- #moovweblogo {
- width: 300px; height: 100px;
- margin: auto; margin-bottom: 10px;
- background: url('resources/moovweblogo1.png') no-repeat center center;
- }
-
-/* Link Styles */
-
-.toplinks:link {color: #FFFAFA; text-decoration: none;}
-.toplinks:active {color: rgb(200,200,200); text-decoration: none;}
-.toplinks:hover {color: #FFFFFF; text-decoration: none; }
-.toplinks:visited {color: #FFFAFA; text-decoration: none;}
-
-.toplinks.selected:visited { color: rgb(50,50,50);}
-
-/* In the main body */
-#textbody a:link {color: #FAFAFA; text-decoration: none;} /* unvisited link */
-#textbody a:visited {color: #FAFAFA; text-decoration: none;} /* visited link */
-#textbody a:hover {color: #FAFAFA; text-decoration: underline; } /* mouse over link */
-#textbody a:active {color: #FAFAFA; text-decoration: none;} /* selected link */
-
-/* In the footer */
-#bottombody a:link {color: rgb(50,50,50); text-decoration: none;} /* unvisited link */
-#bottombody a:visited {color: rgb(50,50,50); text-decoration: none;} /* visited link */
-#bottombody a:hover {color: rgb(50,50,50); text-decoration: underline; } /* mouse over link */
-#bottombody a:active {color: rgb(100,100,100); text-decoration: none;} /* selected link */
\ No newline at end of file
diff --git a/examples/site/stylesheets/yellow_base.css b/examples/site/stylesheets/yellow_base.css
deleted file mode 100644
index ed0b692..0000000
--- a/examples/site/stylesheets/yellow_base.css
+++ /dev/null
@@ -1,7 +0,0 @@
-li[data-ur-set="toggler"] [data-ur-toggler-component='button'] {
- background-color: #a3e2f5; }
-li[data-ur-set="toggler"] [data-ur-toggler-component='content'] {
- display: none;
- background-color: #d0e9f0; }
- li[data-ur-set="toggler"] [data-ur-toggler-component='content'][data-ur-state="enabled"] {
- display: block; }
diff --git a/examples/site/styling.html b/examples/site/styling.html
deleted file mode 100644
index c50d396..0000000
--- a/examples/site/styling.html
+++ /dev/null
@@ -1,112 +0,0 @@
----
-layout: default
-title: Styling
-name: styling
-more_selected: selected
----
-
-
-
Styling
-
-
-
Lazy and Proper Styling
-
-
There are two types of styling for Uranium widgets. One we generally refer to as
- "lazy" styling, the other as "proper" styling. Lazy styling requires fewer lines of
- CSS, but proper styling is really the best way to style your widgets.
-
-
Lazy Styling
-
-
As its name implies, lazy styling is simpler and faster to do. You only really
- need to write out two declaration blocks. The first covers the element in its
- non-enabled state, and the other when the element is enabled.
-
-
Say we're styling a toggler button. When "enabled" , we want it to be full opacity. However,
- when disabled we want it to be at 50% opacity. Pretty simple using the following CSS:
-
-
- *[data-ur-toggler-component='button'] {
- background: red;
- opacity: 0.5;
- }
-
- *[data-ur-toggler-component='button'][data-ur-state='enabled'] {
- background: red;
- opacity: 1.0;
- }
-
-
-
Its default state (the first block) describes its color and that it should be at 50% opacity.
- The second block says that when the button is enabled, it will be at 100% opacity. Simple. See
- how it works by clicking on the button below.
-
-
- Popup !
-
-
-
-
-
-
-
However, lazy styling can cause problems. Let's take a look at a better way to
- style widgets.
-
-
-
-
Proper Styling
-
-
The problem with lazy styling is this: you're only really saying what the
- element looks like when the data-ur-state is enabled . We're taking it
- for granted that the non-enabled state is the same as the disabled state. This
- is an OK assumption to make in most cases.
-
-
But this isn't actually the case. What actually happens is that the element
- goes through a brief period without any data-ur-state before Uranium assigns
- the default (which is usually disabled). (Of course, this doesn't
- apply if you specify in your HTML that the element has a data-ur-set .)
-
-
So when we style the non-enabled state in lazy styling, we're actually styling
- two states - the one before any state has been assigned AND the "disabled"
- state.
-
-
We can style these states separately, as shown.
-
-
- *[data-ur-toggler-component='button'] {
- background: blue;
- }
-
- *[data-ur-toggler-component='button'][data-ur-state='disabled'] {
- background: red;
- opacity: 0.5;
- }
-
- *[data-ur-toggler-component='button'][data-ur-state='enabled'] {
- background: red;
- opacity: 1.0;
- }
-
-
-
And below is the preceding CSS applied to a toggler.
-
-
-
-
-
-
-
-
The fact is that on a desktop, Uranium works too fast to notice the non-assigned
- state. However, on mobile devices you can sometimes see a delay. You can sometimes
- see the delay if you refresh the carousel examples page.
-
-
And that's how we style things properly, rather than lazily.
-
-
-
-
\ No newline at end of file
diff --git a/examples/site/tutorials.html b/examples/site/tutorials.html
deleted file mode 100644
index 289abb6..0000000
--- a/examples/site/tutorials.html
+++ /dev/null
@@ -1,208 +0,0 @@
----
-layout: default
-title: Tutorial
-name: tutorial
-tutorials_selected: selected
----
-
-
Tutorial
-
-
Introduction
-
-
We've worked hard to make Uranium as streamlined as possible, requiring the least possible
- effort from the user.
-
Part of this is ensuring that the widgets are easy to use and once you've learnt how to
- implement one, the same methods are easily applied to other widgets.
-
As such, here we're going to go over an example of how to use widgets. We'll use
- the toggler as a model.
-
-
-
-
-
-
-
Tutorial: How to Implement A Toggler
-
-
-
We're going to start by making a toggler. What's a toggler? Well, it's a widget that has
- two components to it: a button and content . When we click on the button,
- the content should appear. Here is an example of what we're going to build (click on "Clothing"):
-
-
- Clothing
-
-
-
- Hat
- Socks
- Shoes
- Gloves
- Shirts
-
-
-
- We click on the button ("Clothing") and the content (the list of clothes)
- appears.
-
-
-
First Step: Adding Attributes to the HTML
-
-
- Let's start with the basic, bare-bones HTML: we have a div for
- "Clothing" and then an unordered list with the items in it.
-
-
- <div>
- Clothing
- <div>
- <ul>
- <li> Hat </li>
- <li> Socks </li>
- <li> Shoes </li>
- <li> Gloves </li>
- <li> Shirts </li>
- </ul>
-
-
- The first thing we need to do is wrap the whole toggler in a div with the
- data-ur-set attribute set
- as "toggler" . This is basically telling Uranium that the whole thing
- in the div is a toggler.
-
-
- <div data-ur-set="toggler">
- <div>
- Clothing
- <div>
- <ul>
- <li> Hat </li>
- <li> Socks </li>
- <li> Shoes </li>
- <li> Gloves </li>
- <li> Shirts </li>
- </ul>
- </div>
-
-
- This may have already caused a problem. What if we can't wrap the whole
- thing in a div ? Well, there's a trick around
- that - check out the explanation of ids here .
-
-
- Next, we indicate where the button is. In our case, we want the button to be the
- Clothing div. So we give the clothing div the attribute "data-ur-toggler-component"
- and the value "button" .
- (Want to know why the attributes are named so? Click here .)
-
-
- <div data-ur-set="toggler">
- <div data-ur-toggler-component="button">
- Clothing
- <div>
- <ul>
- <li> Hat </li>
- <li> Socks </li>
- <li> Shoes </li>
- <li> Gloves </li>
- <li> Shirts </li>
- </ul>
- </div>
-
-
- The final thing we need to do to this HTML is specify the content bit of the toggler. The content
- in this case is the unordered list that we want to appear when the button is clicked. We give it the
- attribute data-ur-toggler-component (the same as for the button, if
- you remember) - but this time we use the value "content" .
-
-
- <div data-ur-set="toggler">
- <div data-ur-toggler-component="button">
- Clothing
- <div>
- <ul data-ur-toggler-component="content">
- <li> Hat </li>
- <li> Socks </li>
- <li> Shoes </li>
- <li> Gloves </li>
- <li> Shirts </li>
- </ul>
- </div>
-
-
That's all we need to do with regards to HTML.
-
-
Second Step: Don't forget the Javascript
-
-
We've added all the necessary attributes to the HTML. The next job is to make sure
- we have Uranium running in the page.
-
The Uranium file can be downloaded here .
Include
- it in your project folder, and add an appropriate reference to it in the head of the
- HTML.
-
-
Third Step: Changing the CSS
-
-
Now we've added the Uranium javascript to the page, go back and refresh the site. The moment of
- truth is upon us. Click on the button!
-
...
-
- Ruh roh. Nothing seems to happen. Why not? Is the javascript broken? Let's check.
-
-
- Right-click on your widget and "inspect element". You'll see the button and the content divs have
- an extra attribute - data-ur-state . This is, by default, set
- to "disabled" .
-
-
-
- When the button is clicked, it changes to "enabled" .
-
-
-
The javascript is doing its job. The missing piece of the puzzle is the CSS.
-
- What we need to do is change the styling of the page. It needs to be set so that
- the content does not display when data-ur-state="disabled" ,
- but to display when data-ur-state="enabled" .
-
-
- *[data-ur-toggler-component='content'] {
- display: none;
- }
- *[data-ur-toggler-component='content'][data-ur-state='enabled'] {
- display: block;
- }
-
-
- (This is actually what we call "lazy" CSS styling. What we're doing is only defining what
- happens when the data-ur-state is enabled - we don't say anything about its "disabled" state.
- Check out more about lazy vs proper styling here .)
-
-
- By this point, the widget should be fully functional. Isn't it neat?
-
-
-
Fourth Step: Apply These Skills
-
-
Pretty much all the widgets in Uranium work in a similar way. You add special attributes to the
- tags in your HTML, import the javascript, and maybe do a little CSS re-styling.
-
-
- Now we've whetted your appetite, you probably want to check out some more
- widgets. Well, click here for a list of
- all the widgets bundled with Uranium.
-
-
- What's more, the widgets within Uranium are pretty much only limited by your
- CSS imagination. We've collected some of the coolest examples of widget usage
- here .
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/site/widget_list.html b/examples/site/widget_list.html
deleted file mode 100644
index e123b7b..0000000
--- a/examples/site/widget_list.html
+++ /dev/null
@@ -1,61 +0,0 @@
----
-layout: default
-title: Widget List
-name: widget_list
-widget_selected: selected
----
-
-
-
-
Widgets
-
-
What is a Widget?
-
-
- Uranium is a group of widgets - but what is a widget, exactly? In Uranium, a widget is a behavior that you're assigning to HTML elements
- on a page. It's a group of attributes you give to your HTML, allowing it to perform
- a function.
-
-
- Each widget page will give a brief description of the widget followed by the attributes necessary to add
- to your HTML (and where to put them). Finally there will be a demonstration of the widget with its HTML
- to illustrate the layout of the widget.
-
-
- If you're a bit lost with these pages, you might want to check out the
- tutorial
- page, which takes you step-by-step through an example of implementing a widget.
-
-
- Not all widgets work perfectly with every browser or device. Check out the compatibility
- charts.
-
-
-
-
-
-
-
diff --git a/examples/site/widgets/carousel.html b/examples/site/widgets/carousel.html
deleted file mode 100644
index d56e079..0000000
--- a/examples/site/widgets/carousel.html
+++ /dev/null
@@ -1,356 +0,0 @@
----
-layout: widgets
-title: Carousel
-name: carousel
-widget_selected: selected
----
-
-
Advanced
-
-
Basic
-
-
-
Carousels
-
-
-
Description
-
-
-
- The carousel is a widget that allows horizontal scrolling (with touch or buttons) between a set of items.
-
-
- The CSS we need to use here is pretty picky, so make sure to check out the CSS tab below.
-
-
- The compatibility of this with FireFox is adequate (vertical-scroll: enabled is not supported however). Check out our
- compatibility tables to see which devices
- and browsers will display the carousel.
-
-
-
-
-
-
Attributes
-
-
-
-
- data-ur-set="carousel" - add this attribute to a div that wraps the whole widget
- data-ur-carousel-component="view_container" - for wrapping the whole view container
- data-ur-carousel-component="scroll_container" - for wrapping the whole scrolling container
- data-ur-carousel-component="item" - wrap each scrollable item in this
- data-ur-carousel-component="button" - for the previous and next buttons
- data-ur-carousel-button-type="prev"/"next" - to distinguish the previous and next buttons
-
-
-
-
data-ur-set=
-
"carousel"
-
-
data-ur-carousel-component=
-
-
Required
-
-
-
- "view_container"
-
- this div should wrap the whole carousel; it must be set to no overflow. It or the scroll_container needs position:relative .
- multiple?: false
- state: N/A
- attributes
-
- optional: data-ur-touch : enabled/disabled
- optional: data-ur-vertical-scroll : enabled/disabled (specify vertical scrolling behavior while touching carousel)
- optional: data-ur-maps : enabled/disabled (allow images using maps in carousel)
- optional: data-ur-infinite : enabled/disabled (specify front to back wrapping behavior)
- optional: data-ur-autoscroll : enabled/disabled (automatically scroll with interval)
- optional: data-ur-autoscroll-delay : integer (autoscroll delay in seconds)
- optional: data-ur-autoscroll-dir : next/prev (specify autoscroll direction)
- optional: data-ur-android3d : enabled/disabled (specify translate3d use on Android 1.6-2.3)
-
-
-
-
-
- "scroll_container"
-
- this div should wrap the scrolling items on the carousel. It or the view_container needs position:relative .
- multiple?: false
- state: N/A
-
-
-
- "item"
-
- this attribute is for each item that needs to be displayed in the carousel
- multiple?: true
- state: active / inactive (reflects currently visible item)
- must have float:left and display:inline styles
-
-
-
-
-
Optional
-
-
-
- "button"
-
- indicates the previous and next buttons
- multiple?: true
- state: enabled / disabled ('next' defaults to enabled / 'prev' defaults to 'disabled')
- attributes
-
- required: data-ur-carousel-button-type:"next"/"prev" for the next and previous buttons, respectively
-
-
-
-
-
- "count"
-
- gives an indicator of the position of the carousel, in the form "1 of 8", etc.
- multiple?: false
- state: N/A
-
-
-
- "dots"
-
- gives a container that changes data-ur-state on the corresponding child
- multiple?: false
- state: N/A
-
-
-
-
-
-
Instance
-
Access the widget via:
Ur.Widgets.carousel["ID"] . The following methods are exposed for each carousel widget:
-
- jumpToIndex(index) : forces the carousel to jump to the specified (zero based) index
- onSlideCallbacks(callback) : supplies a callback which is called when animation has completed
- "slidestart" event is fired on view_container when sliding begins (excluding touch input)
- "slideend" event is fired on view_container when sliding begins
-
-
-
-
-
-
-
-
-
Demonstration
-
-
-
Touch-enabled Widget
-
-
Widget
-
-
HTML
-
-
CSS
-
-
-
-
-
-
-{% highlight css %}
-div[data-ur-carousel-component="view_container"] {
- width: 100%;
- overflow-x: hidden;
-}
-div[data-ur-carousel-component="scroll_container"] > * {
- display: inline-block;
- float: left;
-}
-div[data-ur-carousel-component="button"][data-ur-state="disabled"] {
- opacity: 0.3;
-}
-{% endhighlight %}
-
-
-
-
-
More examples of the carousel can be found here, including:
-
-
-
-
-
Carousel Examples
-
-
-
-
-
Vertical Scrolling
-
-
This carousel doesn't allow vertical scrolling on touch screens.
-
- data-ur-vertical-scroll="disabled" - apply this to the view container
-
-
-
-- count --
-
Prev
-
Next
-
-
-
-
-
-
-
-
-
Infinite scrolling example
-
-
- Here we have a carousel that loops from front to back. Note that the current element is centered.
-
-
-
-- count --
-
Prev
-
Next
-
-
-
-
-
-
-
-
-
Slideshow example
-
-
- Here we have a carousel that scrolls every five seconds with a "dot" indicator. Note that the current element is centered.
-
-
-
-
-- count --
-
- Prev
-
-
- Next
-
-
-
-
-
-
-
-
-
-
"Jump to..." function
-
-
- In this example, we have a bit of extra javascript to include in the page. We use this to
- jump to a location in the carousel. It's what we call an "instance" - only for this instance
- of the carousel will the feature be enabled.
-
-
-{% highlight html %}
-
-{% endhighlight %}
-
-
Jump to 5th item
-
-
-
-- count --
-
Prev
-
Next
-
-
-
-
-
diff --git a/examples/site/widgets/flex_table.html b/examples/site/widgets/flex_table.html
deleted file mode 100644
index 073f30a..0000000
--- a/examples/site/widgets/flex_table.html
+++ /dev/null
@@ -1,413 +0,0 @@
----
-layout: widgets
-title: Flex Table
-name: flex_table
-widget_selected: selected
----
-
-
-
Advanced
-
-
Basic
-
-
-
-
{{page.title}}
-
-
-
Description
-
-
-
There are a lot of ways to deal with tabular data in a mobile format. This solution should be credited to the FilamentGroup for their blog post .
-
This is accomplished by assigning semantic classes to the column headings that indicate which data values take precedence (essential vs optional), in combination with media queries to display them at different screen widths (a.k.a., responsive design ).
-
There is a bit of JavaScript logic to control which data is displayed by checking column names in the "Display" menu on the right. Once an option is checked, the associated data will persist and display at all screen widths until the option is unchecked.
-
You can also set a column to always persist by assigning a class in the markup, in which case it has no menu option.
-
-
-
-
-
-
-
-
- data-ur-set="flex-table" - add this attribute to a div that wraps the whole widget
- data-ur-flex-table-component="table" - add this attribute to the table node
- data-ur-flex-table-component="head - add this attribute to the table head node
- data-ur-flex-table-component="body" - add this attribute to the table body node
- class='persist' - add this attribute to the th node that should never disappear as a column. The option to enable/disable it via a checkbox is also removed.
- class='essential' - add this attribute to the th node that shouldn't disappear as a column due to screen size. The option to enable/disable it via a checkbox is available.
- class='optional' - add this attribute to the th node that should disappear as a column due to screen size at the large screen break. The option to enable/disable it via a checkbox is available.
- no class - Leave the th node with no class of persist, essential, or optional for the columns to only be present at the large screen size break. The option to enable/disable it via a checkbox is present
-
-
-
-
data-ur-set=
-
"flex-table"
-
data-ur-flex-table-component=
-
-
- "table"
-
- add this attribute to the table node
-
-
- "head"
-
- add this attribute to the table head node
-
-
- "body"
-
- add this attribute to the table body node
-
-
-
-
-
-
-
-
-
-
-
Required Styles
-
- {% highlight scss %}
- /* Required SCSS Styling */
-
- .table-wrapper {
- position: relative; }
- .table-menu {
- > ul {
- position: absolute;
- z-index: 100;
- background-color: white;
- padding: 10px;
- border: 1px solid #cccccc;
- width: 12em;
- right: 0;
- left: auto;
- top: -7px;
- list-style: none;
- li {
- color: black; } } }
- .table-background-element {
- position: fixed;
- left: 0px;
- top: 0px;
- z-index: 99;
- height: 100%;
- width: 100% !important; }
- .table-menu-hidden {
- display: none;
- left: -999em;
- right: auto; }
- .table-menu-btn {
- text-decoration: none;
- color: #333333;
- background: #eeeeee;
- padding: 0.4em 10px 0.4em 5px;
- border: 1px solid #cccccc;
- position: absolute;
- z-index: 100;
- top: -40px;
- right: 0; }
- a.table-menu-btn, a.table-menu-btn:hover {
- color: #333333;
- text-decoration: none; }
- .table-menu-btn-icon {
- width: 0px;
- height: 0px;
- font-size: 0px;
- line-height: 0px;
- border: 6px solid;
- margin-right: 5px;
- margin-top: 4px;
- vertical-align: middle;
- border-image: initial;
- display: inline-block;
- border-color: gray transparent transparent transparent; }
- .menu-btn-show > .table-menu-btn-icon {
- border-color: transparent transparent gray transparent;
- margin-top: -8px; }
- .table-menu li {
- padding: 0.3em 0; }
- table {
- width: 100%; }
- .enhanced th,
- .enhanced td {
- display: none; }
- .enhanced th.essential,
- .enhanced td.essential {
- display: table-cell; }
- .enhanced .ur_ft_hide {
- display: none !important; }
- .enhanced .ur_ft_show {
- display: table-cell !important; }
- // Change this width to alter the switch state
- // for the optional classes
- @media screen and (min-width: 480px) {
- .enhanced th.optional,
- .enhanced td.optional {
- display: table-cell; } }
- // Change this width to alter the switch state
- // to show all columns
- @media screen and (min-width: 800px) {
- .enhanced th,
- .enhanced td {
- display: table-cell; } }
- {% endhighlight %}
-
-
-
-
-
Demonstration
-
-
-
-
You can have multiple tables on the same page. Two are featured below. Resize your browser window to see the table columns show and hide themselves.
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/site/widgets/font_resizer.html b/examples/site/widgets/font_resizer.html
deleted file mode 100644
index 94753c9..0000000
--- a/examples/site/widgets/font_resizer.html
+++ /dev/null
@@ -1,176 +0,0 @@
----
-layout: widgets
-title: Font Resizer
-name: font_resizer
-widget_selected: selected
----
-
-
-
Advanced
-
-
Basic
-
-
-
-
{{page.title}}
-
-
-
Description
-
-
This widget allows us to change the font size of a specified page element.
-
To use this widget, we need to use a couple of attributes. We can use the set method (i.e.
- grouping all of the widget components in a single div with the attribute data-ur-set) or the id method (i.e. giving
- each component of the widget a data-ur-id with an identical value, which doesn't require them to
- be grouped inside a single wrapper).
-
-
-
-
-
Attributes
-
-
-
-
-
- data-ur-font-resizer-component="increase" - this is used to mark the increase button (e.g. [+])
- data-ur-font-resizer-component="label" - this indicates the text size
- data-ur-font-resizer-component="decrease" - this is used to mark the decrease button (e.g. [-])
- data-ur-font-resizer-component="content" - this marks the content
-
-
-
-
-
data-ur-set=
-
"font-resizer"
-
-
data-ur-font-resizer-component=
-
-
Required
-
- "increase"
-
-
- "decrease"
-
-
- "label"
-
-
- "content"
-
- multiple?: false
- attributes
-
- optional: data-ur-font-resizer-min - defaults to "100"
- optional: data-ur-font-resizer-max - defaults to "200"
- optional: data-ur-font-resizer-size - defaults to min
- optional: data-ur-font-resizer-delta - defaults to "20"
-
-
-
-
-
-
-
-
-
-
-
-
-
Required Styles
-
- No styles are required. All styles are handled inline by the widget.
-
-
-
-
-
Demonstration
-
-
Widget
-
-
HTML
-
-
-
- {% highlight html %}
-
- {% endhighlight %}
-
-
-
-
-
-
-
-
Further Examples
-
Using data-ur-id:
-
-
-
[+]
-
-
[-]
-
To be or not to be, that is the question. Whether 'tis nobler in the mind to endure the slings and arrows of outrageous fortune etc etc.
-
-
-
-
-
Overriding Defaults
-
-
-
-
[+]
-
-
[-]
-
To be or not to be, that is the question. Whether 'tis nobler in the mind to endure the slings and arrows of outrageous fortune etc etc.
-
-
-
-
-
-
A Self-resizing Resizer
-
-
-
-
[+]
-
-
[-]
-
To be or not to be, that is the question. Whether 'tis nobler in the mind to endure the slings and arrows of outrageous fortune etc etc.
-
-
-
-
-
A Super-Advanced Example (using the secret "invert" attribute!):
-
-
-
[+]
-
-
[-]
-
To be or not to be, that is the question. Whether 'tis nobler in the mind to endure the slings and arrows of outrageous fortune etc etc.
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/site/widgets/geocode.html b/examples/site/widgets/geocode.html
deleted file mode 100644
index b554b55..0000000
--- a/examples/site/widgets/geocode.html
+++ /dev/null
@@ -1,482 +0,0 @@
----
-layout: widgets
-title: Geolocation
-name: geolocation
-widget_selected: selected
----
-
-
Advanced
-
-
Basic
-
-
-
{{page.title}}
-
-
-
Description
-
-
- This widget allows you to reverse geocode a location. You can use this to populate forms using the user's location. The elements you can populate are:
-
- Street Address (only line 1, floor level is not present in the api)
- City
- Zip
- State
- Country
-
-
-
You can only have one of these widgets per page.
-
- Some browsers (as for maps ) won't do this locally, so use dropbox
- for testing. Also, it's important to ensure that location services are enabled on the device and/or browser.
-
-
-
-
-
-
-
Attributes
-
-
-
-
- data-ur-set="reverse-geocode" - add this attribute to a div that wraps the whole widget
- data-ur-reverse-geocode-component="rg-street" - for the street field
- data-ur-reverse-geocode-component="rg-city" - for the city field
- data-ur-reverse-geocode-component="rg-zip" - for the zip code field
- data-ur-reverse-geocode-component="rg-state" - for the state field
- data-ur-reverse-geocode-component="rg-country" - for the country field
- data-ur-reverse-geocode-component="rg-button" - to wrap a "use my location" button
- As you see in the HTML from the example below, a few other non-Uranium elements are necessary to get this widget to work. These are all based around forms. For example, we need a form tag to wrap the widget, with action="geocode_submit" as an attribute.
-
-
-
-
data-ur-set=
-
"reverse-geocode"
-
-
data-ur-reverse-geocode-component=
-
-
- "rg-button"
-
- multiple?: false
- state: N/A
- if not included, the widget will fire when the page is loaded
-
-
- "rg-street"
-
- multiple?: false
- state: N/A
-
-
- "rg-city"
-
- multiple?: false
- state: N/A
-
-
- "rg-state"
-
- multiple?: false
- state: N/A
- can use a select tag or a text-input field
-
-
- "rg-zip"
-
- multiple?: false
- state: N/A
-
-
- "rg-country"
-
- multiple?: false
- state: N/A
- can use a select tag or a text-input field
-
-
-
-
-
Instance
-
This is a singleton widget. This means only a single geocoder can exist per page. It can be accessed via Ur.Widgets["reverse-geocode"]["someId"] .
-
-
-
-
-
-
-
Required Styles
-
- No styles are required.
-
-
-
-
-
Demonstration
-
-
-
- The demonstration here activates on load.
-
-
-
-
Widget
-
-
HTML
-
-
-
- {% highlight html %}
-
- {% endhighlight %}
-
-
-
-
-
-
-
-
-
-
-
FAQ's
-
-
Does the browser always have to ask for a user to share their location?
-
Yes. Its a security feature of all browsers.
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/site/widgets/geocode/button.html b/examples/site/widgets/geocode/button.html
deleted file mode 100644
index 870cb9b..0000000
--- a/examples/site/widgets/geocode/button.html
+++ /dev/null
@@ -1,338 +0,0 @@
----
-layout: geocode-widget-sub
-title: Geocode Button
-name: geocode_button
-widget_selected: selected
----
-
-
Reverse Geocode with a Button
-
-
Description
-
- Here, instead of the widget loading automatically (as on the widget page ), we
- have a button that needs to be clicked in order for it to be activated.
-
-
-
Components
-
We need to include a button (rather obviously) for this example to work. Here is the extra attribute
- required.
-
- data-ur-reverse-geocode-component="rg-button" - to be applied to a button tag
-
-
-
-
Demonstration
-
-
-
- Click here to find your location
-
-
-
\ No newline at end of file
diff --git a/examples/site/widgets/geocode/text_inputs.html b/examples/site/widgets/geocode/text_inputs.html
deleted file mode 100644
index a90c09e..0000000
--- a/examples/site/widgets/geocode/text_inputs.html
+++ /dev/null
@@ -1,32 +0,0 @@
----
-layout: geocode-widget-sub
-title: Geocode Text Inputs
-name: geocode_text_inputs
-widget_selected: selected
----
-
-
Reverse Geocode with Text Inputs
-
-
Description
-
-
- This example illustrates that a select form is not necessary to fill a field. We've used a text input instead
- of a select for the state and country.
-
-
-
Demonstration
-
-
-
- Reverse Geocode
-
-
-
diff --git a/examples/site/widgets/input_clear.html b/examples/site/widgets/input_clear.html
deleted file mode 100644
index 00b8825..0000000
--- a/examples/site/widgets/input_clear.html
+++ /dev/null
@@ -1,128 +0,0 @@
----
-layout: widgets
-title: Input Clear
-name: input_clear
-widget_selected: selected
----
-
-
-
Advanced
-
-
Basic
-
-
-
-
{{page.title}}
-
-
-
Description
-
-
-
When a user focuses and begins typing on a text input field, a small x appears along the right side of the field that can be clicked to clear it. If there is already text in the input field the x will appear without any typing.
-
-
-
-
-
-
-
-
- data-ur-set="input-clear" - add this attribute to a div that wraps the whole widget
- data-ur-input-clear-component="input" - add this attribute to the input that is wrapped by the set
-
-
-
-
data-ur-set=
-
"input-clear"
-
data-ur-input-clear-component=
-
-
- "input"
-
- add this attribute to the input node
-
-
-
-
-
-
-
-
-
-
-
Required Styles
-
-{% highlight scss %}
- /* Required SCSS Styling */
-
- *[data-ur-set='input-clear'] {
- position: relative;
- input[data-ur-input-clear-component='input'] {
- width:100%;
- min-height: 30px;
- position: relative;
- @include box-sizing(border-box);
- }
- .data-ur-input-clear-ex {
- // absolute to allow for center positioning in the text field
- position: absolute;
- display: none;
- // created from the glyphicons (http://glyphicons.com/) circle_remove icon
- // image included such that it can be modified to be smaller or the color changed if desired
- background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAKQ2lDQ1BJQ0MgcHJvZmlsZQAAeNqdU3dYk/cWPt/3ZQ9WQtjwsZdsgQAiI6wIyBBZohCSAGGEEBJAxYWIClYUFRGcSFXEgtUKSJ2I4qAouGdBiohai1VcOO4f3Ke1fXrv7e371/u855zn/M55zw+AERImkeaiagA5UoU8Otgfj09IxMm9gAIVSOAEIBDmy8JnBcUAAPADeXh+dLA//AGvbwACAHDVLiQSx+H/g7pQJlcAIJEA4CIS5wsBkFIAyC5UyBQAyBgAsFOzZAoAlAAAbHl8QiIAqg0A7PRJPgUA2KmT3BcA2KIcqQgAjQEAmShHJAJAuwBgVYFSLALAwgCgrEAiLgTArgGAWbYyRwKAvQUAdo5YkA9AYACAmUIszAAgOAIAQx4TzQMgTAOgMNK/4KlfcIW4SAEAwMuVzZdL0jMUuJXQGnfy8ODiIeLCbLFCYRcpEGYJ5CKcl5sjE0jnA0zODAAAGvnRwf44P5Dn5uTh5mbnbO/0xaL+a/BvIj4h8d/+vIwCBAAQTs/v2l/l5dYDcMcBsHW/a6lbANpWAGjf+V0z2wmgWgrQevmLeTj8QB6eoVDIPB0cCgsL7SViob0w44s+/zPhb+CLfvb8QB7+23rwAHGaQJmtwKOD/XFhbnauUo7nywRCMW735yP+x4V//Y4p0eI0sVwsFYrxWIm4UCJNx3m5UpFEIcmV4hLpfzLxH5b9CZN3DQCshk/ATrYHtctswH7uAQKLDljSdgBAfvMtjBoLkQAQZzQyefcAAJO/+Y9AKwEAzZek4wAAvOgYXKiUF0zGCAAARKCBKrBBBwzBFKzADpzBHbzAFwJhBkRADCTAPBBCBuSAHAqhGJZBGVTAOtgEtbADGqARmuEQtMExOA3n4BJcgetwFwZgGJ7CGLyGCQRByAgTYSE6iBFijtgizggXmY4EImFINJKApCDpiBRRIsXIcqQCqUJqkV1II/ItchQ5jVxA+pDbyCAyivyKvEcxlIGyUQPUAnVAuagfGorGoHPRdDQPXYCWomvRGrQePYC2oqfRS+h1dAB9io5jgNExDmaM2WFcjIdFYIlYGibHFmPlWDVWjzVjHVg3dhUbwJ5h7wgkAouAE+wIXoQQwmyCkJBHWExYQ6gl7CO0EroIVwmDhDHCJyKTqE+0JXoS+cR4YjqxkFhGrCbuIR4hniVeJw4TX5NIJA7JkuROCiElkDJJC0lrSNtILaRTpD7SEGmcTCbrkG3J3uQIsoCsIJeRt5APkE+S+8nD5LcUOsWI4kwJoiRSpJQSSjVlP+UEpZ8yQpmgqlHNqZ7UCKqIOp9aSW2gdlAvU4epEzR1miXNmxZDy6Qto9XQmmlnafdoL+l0ugndgx5Fl9CX0mvoB+nn6YP0dwwNhg2Dx0hiKBlrGXsZpxi3GS+ZTKYF05eZyFQw1zIbmWeYD5hvVVgq9ip8FZHKEpU6lVaVfpXnqlRVc1U/1XmqC1SrVQ+rXlZ9pkZVs1DjqQnUFqvVqR1Vu6k2rs5Sd1KPUM9RX6O+X/2C+mMNsoaFRqCGSKNUY7fGGY0hFsYyZfFYQtZyVgPrLGuYTWJbsvnsTHYF+xt2L3tMU0NzqmasZpFmneZxzQEOxrHg8DnZnErOIc4NznstAy0/LbHWaq1mrX6tN9p62r7aYu1y7Rbt69rvdXCdQJ0snfU6bTr3dQm6NrpRuoW623XP6j7TY+t56Qn1yvUO6d3RR/Vt9KP1F+rv1u/RHzcwNAg2kBlsMThj8MyQY+hrmGm40fCE4agRy2i6kcRoo9FJoye4Ju6HZ+M1eBc+ZqxvHGKsNN5l3Gs8YWJpMtukxKTF5L4pzZRrmma60bTTdMzMyCzcrNisyeyOOdWca55hvtm82/yNhaVFnMVKizaLx5balnzLBZZNlvesmFY+VnlW9VbXrEnWXOss623WV2xQG1ebDJs6m8u2qK2brcR2m23fFOIUjynSKfVTbtox7PzsCuya7AbtOfZh9iX2bfbPHcwcEh3WO3Q7fHJ0dcx2bHC866ThNMOpxKnD6VdnG2ehc53zNRemS5DLEpd2lxdTbaeKp26fesuV5RruutK10/Wjm7ub3K3ZbdTdzD3Ffav7TS6bG8ldwz3vQfTw91jicczjnaebp8LzkOcvXnZeWV77vR5Ps5wmntYwbcjbxFvgvct7YDo+PWX6zukDPsY+Ap96n4e+pr4i3z2+I37Wfpl+B/ye+zv6y/2P+L/hefIW8U4FYAHBAeUBvYEagbMDawMfBJkEpQc1BY0FuwYvDD4VQgwJDVkfcpNvwBfyG/ljM9xnLJrRFcoInRVaG/owzCZMHtYRjobPCN8Qfm+m+UzpzLYIiOBHbIi4H2kZmRf5fRQpKjKqLupRtFN0cXT3LNas5Fn7Z72O8Y+pjLk722q2cnZnrGpsUmxj7Ju4gLiquIF4h/hF8ZcSdBMkCe2J5MTYxD2J43MC52yaM5zkmlSWdGOu5dyiuRfm6c7Lnnc8WTVZkHw4hZgSl7I/5YMgQlAvGE/lp25NHRPyhJuFT0W+oo2iUbG3uEo8kuadVpX2ON07fUP6aIZPRnXGMwlPUit5kRmSuSPzTVZE1t6sz9lx2S05lJyUnKNSDWmWtCvXMLcot09mKyuTDeR55m3KG5OHyvfkI/lz89sVbIVM0aO0Uq5QDhZML6greFsYW3i4SL1IWtQz32b+6vkjC4IWfL2QsFC4sLPYuHhZ8eAiv0W7FiOLUxd3LjFdUrpkeGnw0n3LaMuylv1Q4lhSVfJqedzyjlKD0qWlQyuCVzSVqZTJy26u9Fq5YxVhlWRV72qX1VtWfyoXlV+scKyorviwRrjm4ldOX9V89Xlt2treSrfK7etI66Trbqz3Wb+vSr1qQdXQhvANrRvxjeUbX21K3nShemr1js20zcrNAzVhNe1bzLas2/KhNqP2ep1/XctW/a2rt77ZJtrWv913e/MOgx0VO97vlOy8tSt4V2u9RX31btLugt2PGmIbur/mft24R3dPxZ6Pe6V7B/ZF7+tqdG9s3K+/v7IJbVI2jR5IOnDlm4Bv2pvtmne1cFoqDsJB5cEn36Z8e+NQ6KHOw9zDzd+Zf7f1COtIeSvSOr91rC2jbaA9ob3v6IyjnR1eHUe+t/9+7zHjY3XHNY9XnqCdKD3x+eSCk+OnZKeenU4/PdSZ3Hn3TPyZa11RXb1nQ8+ePxd07ky3X/fJ897nj13wvHD0Ivdi2yW3S609rj1HfnD94UivW2/rZffL7Vc8rnT0Tes70e/Tf/pqwNVz1/jXLl2feb3vxuwbt24m3Ry4Jbr1+Hb27Rd3Cu5M3F16j3iv/L7a/eoH+g/qf7T+sWXAbeD4YMBgz8NZD+8OCYee/pT/04fh0kfMR9UjRiONj50fHxsNGr3yZM6T4aeypxPPyn5W/3nrc6vn3/3i+0vPWPzY8Av5i8+/rnmp83Lvq6mvOscjxx+8znk98ab8rc7bfe+477rfx70fmSj8QP5Q89H6Y8en0E/3Pud8/vwv94Tz+4A5JREAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfcAx8WHyF/aorvAAABgUlEQVRIx8WWsXnCQAyFf5smHZR0oUwXynS5EWADsgEbyNqADUKZdB4BbwAbmDIdbJBGzmc7d+eD8BGVZ1nv9PSkU0aiicgjMAMmdnQCalU9pvyfJQRfAwsD8VkNlMAmBpoFAMZAYSCX2AYoVPU8CCQiz8AWmHOd7YGVqh6CQAaya9XhWjsBrg2W9eja/SETX2auoTFvfShuCILFKjoZmbrqyE+lqW7uuXVtqgzZTFWPTUYxdW1VdQk4C9ynZmniCdm6TV3oRqWqvgEY1w1Yh3/zKQMxFgDZAG2dgC3R4DmLCWmWicirOZEK5mnuIbW6PDJa2urZNZlcAUJToxN3sBSgIHU9gQwC1ZeAiMi4TWMiWJ3baA+B1QF17TxgsRg/DRvsARF59xS+IxDzWUSmyv1G0Aigqqqzc24CvAScn4Cp53xq34IPoap++qb3/oaK3v+a3vd4+PJeXxxS+yKhJTpP+ajvVVXVl3PuA3iI1Cy2nKx829D/rlsDCyRWw4sWyG+u+8N6uRUsuAAAAABJRU5ErkJggg==) no-repeat;
- // if you alter the size of the image, the dimensions
- // and layout position will need to be changed as well
- height: 27px;
- width: 27px;
- top: 4px;
- right: 2px;
- }
- }
-{% endhighlight %}
-
-
-
-
-
Demonstration
-
-
-
-
You can have multiple tables on the same page. Two are featured below. Resize your browser window to see the table columns show and hide themselves.
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/site/widgets/lateload.html b/examples/site/widgets/lateload.html
deleted file mode 100644
index 2663bf8..0000000
--- a/examples/site/widgets/lateload.html
+++ /dev/null
@@ -1,22 +0,0 @@
----
-layout: widgets
-title: Late Load
-name: lateload
-widget_selected: selected
----
-
-
-
-
-
{{page.title}}
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/site/widgets/maps.html b/examples/site/widgets/maps.html
deleted file mode 100644
index ddbdfcf..0000000
--- a/examples/site/widgets/maps.html
+++ /dev/null
@@ -1,228 +0,0 @@
----
-layout: widgets
-title: Maps
-name: maps
-widget_selected: selected
----
-
-
Advanced
-
-
Basic
-
-
-
{{page.title}}
-
-
-
Description
-
-
The maps widget allows easy embedding of a Google Map into a site. We specify the addresses
- we want to show on the map, and these are indicated by pins. The map is fully functional (i.e.
- you can zoom and do street-view).
-
- You can only use one map per page.
-
-
Note: If you're testing this locally (off of a file in your
- browser) - then geolocation may not work. Put it in your public dropbox folder to play with these features.
-
-
-
-
-
Attributes
-
-
-
-
- data-ur-set="maps" - add this attribute to a div that wraps the whole widget
- data-ur-map-component="canvas" - sets the map canvas
- data-ur-map-component="address" - defines the address for a map point
- data-ur-map-component="description" - defines a description for the address
-
-
-
-
data-ur-set=
-
"select-list"
-
-
data-ur-map-component=
-
-
Required
-
-
- "address"
-
- wraps an address for a point on a map
- multiple?: true
-
-
- "description"
-
- describes the point on a map
- multiple?: true
-
-
- "canvas"
-
- where the map is placed
- multiple?: false
-
-
-
-
-
Optional
-
-
- "icon"
-
- allows you to change the pin icon
- multiple?: false
- attributes
-
- required: data-ur-width
- required: data-ur-height
- required: data-ur-url
-
-
-
-
- "user_location"
-
- should wrap a "use my location" button
- state: enabled / disabled(default)
-
-
-
-
-
-
Instance
-
This is a singleton widget. This means only a single geocoder can exist per page. It can be accessed via Ur.Widgets["maps"]["someId"] .
-
-
-
-
-
-
-
Optional CSS
-
- {% highlight scss %}
- /* CSS Styling */
- /* To constrain the map canvas */
-
- *[data-ur-map-component='canvas'] {
- width: 300px;
- height: 300px;
- }
- {% endhighlight %}
-
-
-
-
-
-
Demonstration
-
-
-
-
Widget
-
HTML
-
-
- {% highlight html %}
-
-
-
- 333 11th Street, San Francisco, CA
-
-
-
Slims
-
(415) 255-0333
-
-
- 1805 Geary Blvd, San Francisco, California 94115
-
-
-
- 500 4th Street, San Francisco, CA
-
-
-
- 859 O'Farrell Street, San Francisco, CA
-
-
-
- 1233 17th Street, San Francisco, CA
-
-
-
- {% endhighlight %}
-
-
-
-
-
-
-
-
-
Further Examples
-
-
-
-
-
-
-
-
diff --git a/examples/site/widgets/maps/advanced.html b/examples/site/widgets/maps/advanced.html
deleted file mode 100644
index 0c898d5..0000000
--- a/examples/site/widgets/maps/advanced.html
+++ /dev/null
@@ -1,96 +0,0 @@
----
-layout: map-widget-sub
-title: Advanced Map
-name: advanced_map
-widget_selected: selected
----
-
-
{{page.title}}
-
-
Description
-
-
- This map has custom icons and a geolocation button to enable the user's location
-
-
Note: If you're testing this locally (off of a file in your
- browser) - then geolocation may not work. Put it in your dropbox
- to play with these features
-
-
Attributes
-
-
To use these features, you will need the following attributes.
-
Geolocation Button
-
Apply these to the geolocation button
-
-
- data-ur-map-component="user_location" Text
- data-ur-state="enabled"
-
-
-
Custom Icon
-
Apply these to a div anywhere in the widget
-
-
- data-ur-map-component="icon"
- data-ur-url="image.png"
-
-
-
-
Demonstration
-
-
-
-
Use My Location!
-
-
-
-
-
-
-
-
-
-
- 333 11th Street, San Francisco, CA
-
-
-
Slims
-
(415) 255-0333
-
-
-
- 1805 Geary Blvd, San Francisco, California 94115
-
-
-
-
- 500 4th Street, San Francisco, CA
-
-
-
-
- 859 O'Farrell Street, San Francisco, CA
-
-
-
-
- 1233 17th Street, San Francisco, CA
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/site/widgets/maps/hidden.html b/examples/site/widgets/maps/hidden.html
deleted file mode 100644
index d759183..0000000
--- a/examples/site/widgets/maps/hidden.html
+++ /dev/null
@@ -1,80 +0,0 @@
----
-layout: map-widget-sub
-title: Hidden Map
-name: hidden_map
-widget_selected: selected
----
-
-
{{page.title}}
-
-
Description
-
-
- This is a simple map that's hidden initially (but is still loaded automatically). All we do is wrap
- the map in a toggler .
-
-
Note: If you're testing this locally (off of a file in your
- browser) - then geolocation may not work. Put it in your dropbox
- to play with these features
-
-
-
Demonstration
-
-
-
Click me to show map
-
-
-
-
Use My Location!
-
-
-
-
-
-
- 333 11th Street, San Francisco, CA
-
-
-
Slims
-
(415) 255-0333
-
-
-
- 1805 Geary Blvd, San Francisco, California 94115
-
-
-
-
- 500 4th Street, San Francisco, CA
-
-
-
-
- 859 O'Farrell Street, San Francisco, CA
-
-
-
-
- 1233 17th Street, San Francisco, CA
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/site/widgets/maps/late_load.html b/examples/site/widgets/maps/late_load.html
deleted file mode 100644
index 8cfe1ca..0000000
--- a/examples/site/widgets/maps/late_load.html
+++ /dev/null
@@ -1,105 +0,0 @@
----
-layout: map-widget-sub
-title: Late-Load Map
-name: late_load_map
-widget_selected: selected
----
-
-
{{page.title}}
-
-
Description
-
-
- Simple map thats that gets initialized when you click a button. This is pretty important for
- mobile applications for two reasons. It reduces the amount of data necessary to load
- the page, increasing speed. It also prevents too many requests being sent to Google,
- which they've threatened to start charging for.
-
-
-
Note: If you're testing this locally (off of a file in your
- browser) - then geolocation may not work. Put it in your dropbox
- to play with these features
-
-
-
-
Script
-
-
For this trick, a bit of extra javascript is needed. Just insert the following somewhere on the page:
- {% highlight js %}
- function setup_map(evt){
- Ur.setup("[data-ur-set='map']");
- x$("#map_button").un('click',setup_map);
- }
-
- x$("#map_button").on('click',setup_map);
- {% endhighlight %}
-
Then add a button with the id="map_button" , and set the
- data-ur-state of the map to "disabled".
-
-
Demonstration
-
-
-
Click Me to initialize the map
-
-
-
-
-
Use My Location!
-
-
-
-
-
-
- 333 11th Street, San Francisco, CA
-
-
-
Slims
-
(415) 255-0333
-
-
-
- 1805 Geary Blvd, San Francisco, California 94115
-
-
-
-
- 500 4th Street, San Francisco, CA
-
-
-
-
- 859 O'Farrell Street, San Francisco, CA
-
-
-
-
- 1233 17th Street, San Francisco, CA
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/site/widgets/select_buttons.html b/examples/site/widgets/select_buttons.html
deleted file mode 100644
index b054422..0000000
--- a/examples/site/widgets/select_buttons.html
+++ /dev/null
@@ -1,125 +0,0 @@
----
-layout: widgets
-title: Select Buttons
-name: select_buttons
-widget_selected: selected
----
-
-
Advanced
-
-
Basic
-
-
-
-
{{page.title}}
-
-
-
Description
-
-
-
- This widget allows you to bind increment/decrement buttons to trigger
- the appropriate changes on a <select> element.
- It's extremely useful in situations where the options for the select are long, and will not
- fit on the select popup that most devices present.
-
-
-
-
-
-
Attributes
-
-
-
-
- data-ur-set="select-buttons" - add this attribute to a div that wraps the whole widget
- data-ur-select-buttons-component="select" - add this attribute to the select tag
- data-ur-select-buttons-component="increment" - add this attribute to the increment button
- data-ur-select-buttons-component="decrement" - add this attribute to the decrement button
-
-
-
-
data-ur-set=
-
"select-buttons"
-
-
data-ur-select-buttons-component=
-
-
- "select"
-
- add this attribute to the drop-down list, which should be in a select tag
- multiple?: false
- state: N/A
-
-
- "increment"
-
- for the increment button
- multiple?: false
- state: enabled / disabled (default is no state)
-
-
- "decrement"
-
- for the decrement button
- multiple?: false
- state: enabled / disabled (default is no state; you should set to disabled)
-
-
-
-
-
-
-
-
-
-
Required Styles
-
- No styles are required.
-
-
-
-
-
Demonstration
-
-
-
-
Widget
-
-
HTML
-
-
-
- {% highlight html %}
-
-
- -None-
- XS
- S
- M
- L
-
-
- [-]
- [+]
-
- {% endhighlight %}
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/site/widgets/select_list.html b/examples/site/widgets/select_list.html
deleted file mode 100644
index e2f6810..0000000
--- a/examples/site/widgets/select_list.html
+++ /dev/null
@@ -1,134 +0,0 @@
----
-layout: widgets
-title: Select List
-name: select_list
-widget_selected: selected
----
-
-
Advanced
-
-
Basic
-
-
-
-
{{page.title}}
-
-
-
Description
-
-
-
- This widget allows you to bind a non-select list (for example a regular ol' <ul> )
- to trigger changes on a <select> element. So clicking on an item in the
- list will automatically select an option in a drop-down menu.
-
-
-
-
-
-
Attributes
-
-
-
- data-ur-set="select-list" - add this attribute to a div that wraps the whole widget
- data-ur-select-list-component="select" - add this attribute to the select tag
- data-ur-select-list-component="content" - add this attribute to the content
- each child item in the select list should have a matching value to an item in the content
-
-
-
-
data-ur-set=
-
"select-list"
-
-
data-ur-select-list-component=
-
-
- "select"
-
- add this attribute to the drop-down list, which should be in a select tag
- multiple?: false
- state: N/A
-
-
- "content"
-
- the children of this element must have the same ID as the select tag's children
- multiple?: false
- state: enabled / disabled(default)
-
-
-
-
-
-
-
-
-
-
Required Styles
-
- No styles are required.
-
-
-
-
-
Demonstration
-
-
- A <ul> is the trigger list in this case.
-
-
-
Widget
-
-
HTML
-
-
-
- {% highlight html %}
-
-
- -None-
- XS
- S
- M
- L
-
-
-
-
- -None-
- XS
- S
- M
- L
-
-
- {% endhighlight %}
-
-
-
-
-
Another example of a selecting list can be found here . This one uses a <div>
- instead of a <ul> as its trigger list.
-
-
-
-
\ No newline at end of file
diff --git a/examples/site/widgets/swipe_toggle.html b/examples/site/widgets/swipe_toggle.html
deleted file mode 100644
index 319e69c..0000000
--- a/examples/site/widgets/swipe_toggle.html
+++ /dev/null
@@ -1,22 +0,0 @@
----
-layout: widgets
-title: Swipe Toggle
-name: swipe_toggle
-widget_selected: selected
----
-
-
-
-
-
{{page.title}}
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/site/widgets/tabs.html b/examples/site/widgets/tabs.html
deleted file mode 100644
index fd4ff1f..0000000
--- a/examples/site/widgets/tabs.html
+++ /dev/null
@@ -1,241 +0,0 @@
----
-layout: widgets
-title: Tabs
-name: tabs
-widget_selected: selected
----
-
-
Advanced
-
-
Basic
-
-
{{page.title}}
-
-
-
Description
-
-
- Tabs are kind of like togglers, but only one tab is active at a time. When you enable the state of one tab, another tab is disabled.
-
-
-
-
-
-
Attributes
-
-
-
-
- data-ur-set="tabs" - add this attribute to a div that wraps the whole widget
- data-ur-tabs-component="button" - add this attribute to the button div
- data-ur-tabs-component="content" - add this attribute to the content
- data-ur-tab-id="NAME" - this attribute needs to link the button and the content (i.e. the button and content should have the same id)
-
-
-
-
data-ur-set=
-
"tabs"
-
-
data-ur-tabs-component=
-
-
- "button"
-
- add this attribute to the button (i.e. the thing to be clicked)
- multiple?: true
- state: enabled / disabled(default)
- attributes
-
- required: data-ur-tab-id is required and must match attribute on content element
-
-
-
-
- "content"
-
- add this attribute to each content item
- multiple?: true
- state: enabled / disabled(default)
- attributes
-
- required: data-ur-tab-id is required and must match attribute on button element
-
-
-
-
-
-
-
Instance
-
Each instance is available by set id under Ur.Widgets["tabs"] . Each instance exposes elements property -- raw components of the widget
-
-
-
-
-
-
-
Required CSS
-
- {% highlight scss %}
- /* Required SCSS Styling */
-
- *[data-ur-set="tabs"] {
- *[data-ur-tabs-component='button'] {
- opacity: 0.5;
- }
- *[data-ur-tabs-component='button'][data-ur-state='enabled'] {
- opacity: 1.0;
- }
- *[data-ur-tabs-component='content'] {
- display:none;
- }
- *[data-ur-tabs-component='content'][data-ur-state='enabled'] {
- display: block;
- }
- }
-
- /* Required CSS Styling */
-
- *[data-ur-set="tabs"] *[data-ur-tabs-component='button'] {
- opacity: 0.5;
- }
- *[data-ur-set="tabs"] *[data-ur-tabs-component='button'][data-ur-state='enabled'] {
- opacity: 1.0;
- }
- *[data-ur-set="tabs"] *[data-ur-tabs-component='content'] {
- display:none;
- }
- *[data-ur-set="tabs"] *[data-ur-tabs-component='content'][data-ur-state='enabled'] {
- display: block;
- }
- {% endhighlight %}
-
-
-
-
-
Demonstration
-
-
-
-
Widget
-
-
HTML
-
-
-
-
-
-
-
-
-
-
Further Examples
-
-
-
-
Selecting the Second Tab
-
-
Here, as proof of principle, we're putting the data-ur-state="enabled" attribute on the
- second tab to illustrate that a different tab can be selected at the outset.
-
-
-
First
-
Second
-
Third
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Accordions with State
-
-
-
So far, we've set one of the tabs to be enabled at the start. However, this isn't
- strictly necessary. In the following example, we start out with no states defined.
-
The first one we click on will be the first one to be "enabled".
-
-
-
-
First
-
-
- Oh uranium.
-
-
-
Second
-
-
- You do nifty widget things.
-
-
-
Third
-
-
- And you're performant.
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/site/widgets/toggler.html b/examples/site/widgets/toggler.html
deleted file mode 100644
index ed4ebf9..0000000
--- a/examples/site/widgets/toggler.html
+++ /dev/null
@@ -1,286 +0,0 @@
----
-layout: widgets
-title: Togglers
-name: togglers
-widget_selected: selected
----
-
-
-
Advanced
-
-
Basic
-
-
-
-
{{page.title}}
-
-
-
Description
-
-
- A toggler is a widget that has two components - a button, and a
- set of contents.
-
When you click the button, the states (of both
- the button and the contents) are toggled.
-
-
-
-
-
Attributes
-
-
-
- data-ur-set="toggler" - add this attribute to a div that wraps the whole widget
- data-ur-toggler-component="button" - add this attribute to the button div
- data-ur-toggler-component="content" - add this attribute to the content
-
-
-
-
data-ur-set=
-
"toggler"
-
-
data-ur-toggler-component=
-
-
- "button"
-
- add this attribute to the button (i.e. the thing to be clicked)
- multiple?: false
- state: enabled / disabled(default)
-
-
- "content"
-
- add this attribute to each content item
- multiple?: true
- state: enabled / disabled(default)
-
-
-
-
-
-
-
-
-
Required Styles
-
- {% highlight scss %}
- /* Required SCSS Styling */
-
- *[data-ur-set='toggler'] {
- /* By Default content is hidden*/
- *[data-ur-toggler-component='content'] {
- display:none;
- }
- *[data-ur-toggler-component='content'][data-ur-state='enabled'] {
- display: block;
- }
- }
-
- /* Required CSS Styling */
-
- *[data-ur-set='toggler'] *[data-ur-toggler-component='content'] {
- display:none;
- }
- *[data-ur-set='toggler'] *[data-ur-toggler-component='content'][data-ur-state='enabled'] {
- display: block;
- }
- {% endhighlight %}
-
-
-
-
-
Demonstration
-
-
-
- We have one button ("Click Here!"). When we click on it, we want the content
- (containing the clothing options) to appear. We call this an "accordion".
-
-
-
-
Widget
-
-
HTML
-
-
-
-
-
-
-
-
-
-
-
-
Further Examples
-
-
-
-
-
Nested Togglers
-
-
-
-
It's super-easy to nest togglers as well. You'll have to use ids .
- Give the button component and the content component the same attribute:
- data-ur-id="ID" .
-
-
-
-
- Foods
-
-
-
-
- Veggies
-
-
-
- Meats
-
-
-
-
-
-
-
-
-
-
-
Popup
-
-
-
- In this style, we want an image to appear when we click on the button.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Multiple Toggling Elements
-
-
-
-
Now we're getting to quite a complex example. The buttons are used to
- toggle between the two images. We start off by defining the button, giving it
- a data-ur-id and making its state disabled.
-
-
Then, we apply the same data-ur-id to the content and define the two content
- panes. However, we specify that one of the contents has a disabled state, and
- the other one has an enabled state. As they have opposing states, when the button
- is clicked they will remain the opposite of each other (i.e. the enabled image
- will become disabled, and vice versa).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Requiring Activation
-
We use an extra snippet of javascript to make the toggler work only when a different button
- is clicked. We start by making the whole toggler have a data-ur-state="disabled" .
- Then, we add the following javascript, which enables the toggler when clicked.
-
-
- {% highlight javascript %}
- x$(".activate_button").on('click',function(){Ur.setup("div[name='Disabled']")});
- {% endhighlight %}
-
-
-
-
-
-
-
- Clothing
-
-
-
- Hat
- Socks
- Shoes
- Gloves
- Shirts
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/site/widgets/zoom_preview.html b/examples/site/widgets/zoom_preview.html
deleted file mode 100644
index 61ec641..0000000
--- a/examples/site/widgets/zoom_preview.html
+++ /dev/null
@@ -1,22 +0,0 @@
----
-layout: widgets
-title: Zoom Preview
-name: zoom_preview
-widget_selected: selected
----
-
-
-
-
-
{{page.title}}
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/site/widgets/zoom_preview_deprecated.html b/examples/site/widgets/zoom_preview_deprecated.html
deleted file mode 100644
index 4c55ea0..0000000
--- a/examples/site/widgets/zoom_preview_deprecated.html
+++ /dev/null
@@ -1,220 +0,0 @@
----
-layout: widgets
-title: Zoom Preview Deprecated
-name: zoom_preview
-widget_selected: selected
----
-
-
Advanced
-
-
Basic
-
-
-
Zoom Preview
-
-
-
Description
-
-
-
- This is a widget to look at a large zoomed image with touch events
- (although here it's simulated with mouse events). The idea is that
- given some thumbnail/image preview, you can insert a button that
- the user can touch/drag around to view the zoomed image. It seems in
- the wild we also need a modifier rule, which tells us how to
- generate the src of the big image so that it's really giant.
-
-
- Note: We assume listeners on the thumbnails to update the main
- image are already in place. If this is not the case, we can make a
- skeleton image gallery widget.
-
-
-
-
-
-
Attributes
-
-
-
-
To the wrapper div:
-
-
- data-ur-set="zoom-preview" - add this attribute to a div that wraps the whole widget
- data-ur-zoom-preview-component="container"
-
-
-
To the large image:
-
-
- data-ur-zoom-preview-component="zoom_image"
- style="visibility: hidden"
-
-
-
To the main image:
-
-
- data-ur-zoom-preview-component="normal_image"
- src='images/pic1.jpeg'
- This image should be styled to 200px by 200px in the CSS
-
-
-
To the thumbnail image:
-
-
- data-ur-zoom-preview-component="button"
- This image should be styled to roughly 62px by 62px in the CSS
-
-
-
-
data-ur-set=
-
"zoom-preview"
-
-
data-ur-zoom-preview-component=
-
-
-
- "normal_image"
-
- multiple?: false
- state: enabled / disabled(default)
- attributes
-
- required: data-ur-tab-id : must match corresponding attribute on content element
-
-
-
-
- "zoom_image"
-
- multiple?: false
- state: enabled / disabled(default)
- attributes
-
- optional: match
- optional: match
-
-
-
-
- "buttons"
-
- multiple?: false
- state: enabled / disabled(default)
-
-
- "container"
-
- multiple?: false
- state: enabled / disabled(default)
-
-
-
-
-
-
-
-
-
-
Demonstration
-
-
-
Widget
-
-
HTML
-
-
-
-
-
-
- <div data-ur-set='zoom-preview' data-ur-zoom-preview-component='container'>
- <img data-ur-zoom-preview-component='zoom_image' data-ur-src-modifier-match='(some_attr=)(.*)'
- data-ur-src-modifier-replace='$1yesway' style="visibility: hidden" />
-
- <div class="normal_image">
- <img data-ur-zoom-preview-component='normal_image'
- data-ur-zoom-modifier-match='$' data-ur-zoom-modifier-replace='?small_image=true'
- src="images/pic1.jpeg" />
- </div>
-
- <img data-ur-src-modifier-match='$' data-ur-src-modifier-replace='&button_image=true' data-ur-zoom-preview-component='button'/>
-
- </div>
-
-
-
-
-
-
-
-
-
-
-
Further Examples
-
-
-
In this case of the zoom preview widget, we have a series of thumbnails at the bottom of the
- main image. Clicking on a thumbnail takes us to the zoom preview for that image. An extra bit
- of javascript is needed, however, to make this work.
-
-
- <script type='text/javascript'>
- var big_image = document.getElementById("big_image");
- x$().iterate(
- document.querySelectorAll("[data-ur-zoom-preview-component='thumbnails'] img"),
- function(elem) {
- elem.addEventListener('click', function(evt){big_image.src=evt.target.src;}, false);
- }
- );
- </script>
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/lib/after.js b/lib/after.js
new file mode 100644
index 0000000..3dcb6a0
--- /dev/null
+++ b/lib/after.js
@@ -0,0 +1 @@
+})(jQuery);
diff --git a/lib/before.js b/lib/before.js
new file mode 100644
index 0000000..73c4e71
--- /dev/null
+++ b/lib/before.js
@@ -0,0 +1,4 @@
+// jQuery.Uranium.js
+// Build out Uranium interactions in jQuery
+
+(function ( $ ) {
diff --git a/lib/carousel.js b/lib/carousel.js
index c29d21c..0c6154e 100644
--- a/lib/carousel.js
+++ b/lib/carousel.js
@@ -1,576 +1,692 @@
-/* Carousel *
- * * * * * * *
- * The carousel is a widget to allow for horizontally scrolling
- * (with touch or buttons) between a set of items.
- *
- * The only assumption is about the items' style -- they must be
- * float: left; so that the real width can be accurately totalled.
- */
-
-Ur.WindowLoaders["carousel"] = (function() {
-
- function Carousel(components) {
- this.container = components["view_container"];
- this.items = components["scroll_container"];
- if (this.items.length == 0) {
- Ur.error("carousel missing item components");
- return false;
- }
-
- // Optionally:
- this.button = components["button"] === undefined ? {} : components["button"];
- this.count = components["count"];
- this.dots = components["dots"];
-
- this.initialize();
- this.onSlideCallbacks = [];
- }
-
- // Private/Helper methods
-
- function sign(num) {
- return num < 0 ? -1 : 1;
- }
-
- function zeroCeil(num) {
- return num <= 0 ? Math.floor(num) : Math.ceil(num);
- }
-
- function zeroFloor(num) {
- return num >= 0 ? Math.floor(num) : Math.ceil(num);
- }
-
- function stifle(e) {
- e.preventDefault();
- e.stopPropagation();
- }
-
- function getTranslateX(obj) {
- var style = getComputedStyle(obj);
- var transform = style["webkitTransform"] || style["MozTransform"] || style["oTransform"] || style["transform"];
- if (transform != "none") {
- if (window.WebKitCSSMatrix)
- return new WebKitCSSMatrix(transform).m41;
- else
- return parseInt(transform.split(",")[4]);
- }
- else {
- Ur.error("no transform found");
- return 0;
- }
- }
-
- //// Public Methods ////
-
- Carousel.prototype = {
- initialize: function() {
- // TODO:
- // add an internal event handler to handle all events on the container:
- // x$(this.container).on("event", this.handleEvent);
-
- this.flag = {click: false, increment: false, loop: false, lock: null, timeoutId: null, touched: false};
- this.options = {
- autoscroll: true,
- autoscrollDelay: 5000,
- autoscrollForward: true,
- cloneLength: 1,
- infinite: true,
- maps: false,
- transform3d: true,
- touch: true,
- verticalScroll: true
- };
-
- this.readAttributes();
-
- if (this.options.touch) {
- var hasTouch = document.ontouchstart !== undefined;
- var start = hasTouch ? "touchstart" : "mousedown";
- var move = hasTouch ? "touchmove" : "mousemove";
- var end = hasTouch ? "touchend" : "mouseup";
- var target = (this.options.maps && hasTouch) ? document : this.items;
- x$(target).on(start, function(obj){return function(e){obj.startSwipe(e)};}(this));
- x$(target).on(move, function(obj){return function(e){obj.continueSwipe(e)};}(this));
- x$(target).on(end, function(obj){return function(e){obj.finishSwipe(e)};}(this));
- x$(this.items).click(function(obj){return function(e){if (!obj.click) stifle(e);}}(this));
- }
-
- x$(this.button["prev"]).click(function(obj){return function(){obj.moveTo(obj.magazineCount);}}(this));
- x$(this.button["next"]).click(function(obj){return function(){obj.moveTo(-obj.magazineCount);}}(this));
-
- this.preCoords = {x: 0, y: 0};
-
- this.itemIndex = 0;
- this.magazineCount = 1;
-
- if (this.options.infinite) {
- var items = x$(this.items).find("[data-ur-carousel-component='item']");
- this.realItemCount = items.length;
- this.itemIndex = this.options.cloneLength;
- this.clones = []; // probaby useless
- for (var i = 0; i < this.options.cloneLength; i++) {
- var clone = items[i].cloneNode(true);
- this.clones.push(clone);
- x$(clone).attr("data-ur-clone", i).attr("data-ur-state", "inactive");
- items[items.length - 1].parentNode.appendChild(clone);
- }
-
- for (var i = items.length - this.options.cloneLength; i < items.length; i++) {
- var clone = items[i].cloneNode(true);
- this.clones.push(clone);
- x$(clone).attr("data-ur-clone", i).attr("data-ur-state", "inactive");
- items[0].parentNode.insertBefore(clone, items[0]);
- }
- }
-
- this.adjustSpacing();
-
- if (!this.options.infinite)
- this.realItemCount = this.itemCount;
-
- if (this.dots) {
- var existing = x$(this.dots).find("[data-ur-carousel-component='dot']");
- for (var i = existing.length; i < this.realItemCount; i++) {
- var new_dot = document.createElement("div");
- x$(new_dot).attr("data-ur-carousel-component", "dot");
- if (i == 0)
- x$(new_dot).attr("data-ur-state", "active");
- this.dots.appendChild(new_dot);
- }
- }
-
- this.updateIndex(this.options.infinite ? this.options.cloneLength : 0);
-
- // Expose this function globally: (this will work on webkit / FF)
- this.jumpToIndex = (function(obj) { return function(idx) { obj.__proto__.moveToIndex.call(obj, idx); };})(this);
-
- x$(window).orientationchange(function(obj){return function(){obj.resize();}}(this));
- // orientationchange isn't supported on some androids
- x$(window).on("resize", function(obj) { return function() {
- obj.resize();
- setTimeout(function(){obj.resize()}, 100);
- }}(this));
- //window.setInterval(function(obj){return function(){obj.resize();}}(this),1000);
-
- this.autoscrollStart();
- },
-
- readAttributes: function() {
- var $container = x$(this.container);
-
- // translate3d is disabled on Android by default because it often causes problems
- // however, on some pages translate3d will work fine so the data-ur-android3d
- // attribute can be set to "enabled" to use translate3d since it can be smoother
- // on some Android devices
-
- var oldAndroid = /Android [12]/.test(navigator.userAgent);
- if (oldAndroid && $container.attr("data-ur-android3d")[0] != "enabled")
- this.options.transform3d = false;
-
- this.options.verticalScroll = $container.attr("data-ur-vertical-scroll")[0] != "disabled";
- $container.attr("data-ur-vertical-scroll", this.options.verticalScroll ? "enabled" : "disabled");
-
- this.options.touch = $container.attr("data-ur-touch")[0] != "disabled";
- $container.attr("data-ur-touch", this.options.touch ? "enabled" : "disabled");
-
- this.options.maps = $container.attr("data-ur-maps")[0] == "enabled";
- $container.attr("data-ur-maps", this.options.maps ? "enabled" : "disabled");
-
- this.options.infinite = $container.attr("data-ur-infinite")[0] != "disabled";
- $container.attr("data-ur-infinite", this.options.infinite ? "enabled" : "disabled");
-
- var cloneLength = parseInt($container.attr("data-ur-clones"));
- if (cloneLength > 0)
- this.options.cloneLength = cloneLength;
- $container.attr("data-ur-clones", this.options.cloneLength);
-
- this.options.autoscroll = $container.attr("data-ur-autoscroll")[0] == "enabled";
- $container.attr("data-ur-autoscroll", this.options.autoscroll ? "enabled" : "disabled");
-
- var autoscrollDelay = parseInt($container.attr("data-ur-autoscroll-delay"));
- if (autoscrollDelay >= 0)
- this.options.autoscrollDelay = autoscrollDelay;
- $container.attr("data-ur-autoscroll-delay", this.options.autoscrollDelay);
-
- this.options.autoscrollForward = $container.attr("data-ur-autoscroll-dir")[0] != "prev";
- $container.attr("data-ur-autoscroll-dir", this.options.autoscrollForward ? "next" : "prev");
- },
-
- resize: function() {
- if (this.snapWidth != this.container.offsetWidth)
- this.adjustSpacing();
- },
-
- adjustSpacing: function() {
- // Will need to be called if the container's size changes --> orientation change
- var visibleWidth = this.container.offsetWidth;
-
- if (this.oldWidth !== undefined && this.oldWidth == visibleWidth)
- return;
- var oldSnapWidth = this.snapWidth;
- this.oldWidth = visibleWidth;
-
- var cumulativeOffset = 0;
- var items = x$(this.items).find("[data-ur-carousel-component='item']");
- this.itemCount = items.length;
-
- // Adjust the container to be the necessary width.
- // I have to do this because the alternative is assuming the container expands to its full width (display:table-row) which is non-standard if the container isn't a
- var totalWidth = 0;
-
- for (var i = 0; i < items.length; i++)
- totalWidth += items[i].offsetWidth;
-
- this.items.style.width = totalWidth + "px";
-
- this.snapWidth = visibleWidth;
-
- this.lastIndex = this.itemCount - 1;
-
- this.itemIndex = (this.lastIndex < this.itemIndex) ? this.lastIndex : this.itemIndex;
-
- cumulativeOffset -= items[this.itemIndex].offsetLeft; // initial offset
- if (this.options.infinite) {
- var centerOffset = parseInt((this.snapWidth - items[0].offsetWidth)/2);
- cumulativeOffset += centerOffset; // CHECK
- }
- if (oldSnapWidth)
- this.destinationOffset = cumulativeOffset;
-
- this.translate(cumulativeOffset);
- },
-
- autoscrollStart: function() {
- if (!this.options.autoscroll)
- return;
-
- var self = this;
- self.flag.timeoutId = setTimeout(function() {
- if (!self.options.infinite && self.itemIndex == self.lastIndex && self.options.autoscrollForward)
- self.jumpToIndex(0);
- else if (!self.options.infinite && self.itemIndex == 0 && !self.options.autoscrollForward)
- self.jumpToIndex(self.lastIndex);
- else
- self.moveTo(self.options.autoscrollForward ? -self.magazineCount : self.magazineCount);
- }, self.options.autoscrollDelay);
- },
-
- autoscrollStop: function() {
- clearTimeout(this.flag.timeoutId);
- },
-
- getEventCoords: function(event) {
- if (event.touches && event.touches.length > 0)
- return {x: event.touches[0].clientX, y: event.touches[0].clientY};
- else
- return {x: event.clientX, y: event.clientY};
- return null;
- },
-
- updateButtons: function() {
- x$(this.button["prev"]).attr("data-ur-state", this.itemIndex == 0 ? "disabled" : "enabled")
- x$(this.button["next"]).attr("data-ur-state", this.itemIndex == this.lastIndex ? "disabled" : "enabled")
- },
-
- getNewIndex: function(direction) {
- var newIndex = this.itemIndex - direction;
-
- if (!this.options.infinite) {
- if (newIndex > this.lastIndex)
- newIndex = this.lastIndex;
- else if (newIndex < 0)
- newIndex = 0;
- }
-
- return newIndex;
- },
-
- updateIndex: function(newIndex) {
- if (newIndex === undefined)
- return;
-
- this.itemIndex = newIndex;
- if (this.itemIndex < 0)
- this.itemIndex = 0;
- else if (this.itemIndex > this.lastIndex)
- this.itemIndex = this.lastIndex - 1;
-
- var realIndex = this.itemIndex;
- if (this.options.infinite)
- realIndex = (this.realItemCount + this.itemIndex - this.options.cloneLength) % this.realItemCount;
- if (this.count !== undefined)
- this.count.innerHTML = realIndex + 1 + " of " + this.realItemCount;
-
- x$(this.items).find("[data-ur-carousel-component='item'][data-ur-state='active']").attr("data-ur-state", "inactive");
- x$(x$(this.items).find("[data-ur-carousel-component='item']")[this.itemIndex]).attr("data-ur-state", "active");
-
- if (this.dots)
- x$(this.dots).find("[data-ur-carousel-component='dot']").attr("data-ur-state", "inactive")[realIndex].setAttribute("data-ur-state", "active");
-
- this.updateButtons();
-
- x$(this.container).fire("slidestart", {index: realIndex});
- },
-
- startSwipe: function(e) {
- if (this.options.maps && !x$(e.target).has("[data-ur-carousel-component='item'], [data-ur-carousel-component='item'] *"))
- return;
- if (!this.options.verticalScroll)
- stifle(e);
- this.autoscrollStop();
-
- this.flag.touched = true; // For non-touch environments
- var coords = this.getEventCoords(e);
- this.preCoords.x = coords.x;
- this.preCoords.y = coords.y;
- this.flag.lock = document.ontouchstart === undefined ? "x" : null;
- this.flag.loop = false;
-
- if (coords !== null) {
- var translateX = getTranslateX(this.items);
-
- if (this.startingOffset === undefined || this.startingOffset === null) {
- this.startingOffset = translateX;
- this.startPos = this.endPos = coords;
- } else {
- // Fast swipe
- this.startingOffset = this.destinationOffset; //Factor incomplete previous swipe
- this.startPos = this.endPos = coords;
- }
- }
- this.flag.click = true;
- },
-
- continueSwipe: function(e) {
- if (!this.flag.touched) // For non-touch environments
- return;
-
- this.flag.click = false;
-
- var coords = this.getEventCoords(e);
-
- if (document.ontouchstart !== undefined && this.options.verticalScroll) {
- var slope = Math.abs((this.preCoords.y - coords.y)/(this.preCoords.x - coords.x));
- if (this.flag.lock) {
- if (this.flag.lock == "y")
- return;
- }
- else if (slope > 1.2) {
- this.flag.lock = "y";
- return;
- }
- else if (slope <= 1.2)
- this.flag.lock = "x";
- else
- return;
- }
- stifle(e);
-
- if (coords !== null) {
- this.endPos = coords;
- var dist = this.swipeDist() + this.startingOffset;
-
- if (this.options.infinite) {
- var items = x$(this.items).find("[data-ur-carousel-component='item']");
- var endLimit = items[this.lastIndex].offsetLeft + items[this.lastIndex].offsetWidth - this.container.offsetWidth;
-
- if (dist > 0) { // at the beginning of carousel
- var srcNode = items[this.realItemCount];
- var offset = srcNode.offsetLeft - items[0].offsetLeft;
- this.startingOffset -= offset;
- dist -= offset;
- this.flag.loop = !this.flag.loop;
- }
- else if (dist < -endLimit) { // at the end of carousel
- var srcNode = items[this.lastIndex - this.realItemCount];
- var offset = srcNode.offsetLeft - items[this.lastIndex].offsetLeft;
- this.startingOffset -= offset;
- dist -= offset;
- this.flag.loop = !this.flag.loop;
- }
- }
-
- this.translate(dist);
- }
- },
-
- finishSwipe: function(e) {
- if (!this.flag.click || this.flag.lock)
- stifle(e);
- else
- x$(e.target).click();
-
- this.flag.touched = false; // For non-touch environments
-
- if (!this.options.verticalScroll || this.flag.lock == "x")
- this.moveHelper(this.getDisplacementIndex());
- else if (this.flag.lock == "y")
- this.autoscrollStart();
- },
- getDisplacementIndex: function() {
- var swipeDistance = this.swipeDist();
- var displacementIndex = zeroCeil(swipeDistance/x$(this.items).find("[data-ur-carousel-component='item']")[0].offsetWidth);
- return displacementIndex;
- },
- snapTo: function(displacement) {
- this.destinationOffset = displacement + this.startingOffset;
- var maxOffset = -1*(this.lastIndex)*this.snapWidth;
- var minOffset = parseInt((this.snapWidth - x$(this.items).find("[data-ur-carousel-component='item']")[0].offsetWidth)/2);
-
- if (this.options.infinite)
- maxOffset = -this.items.offsetWidth;
- if (this.destinationOffset < maxOffset || this.destinationOffset > minOffset) {
- if (Math.abs(this.destinationOffset - maxOffset) < 1) {
- // Hacky -- but there are rounding errors
- // I see this when I'm in multi-mode and using the buttons
- // This only seems to happen on the desktop browser -- ideally its removed at compile time
- this.destinationOffset = maxOffset;
- } else {
- this.destinationOffset = this.startingOffset;
- }
- }
-
- this.momentum();
- },
-
- moveTo: function(direction) {
- // The animation isnt done yet
- if (this.flag.increment)
- return;
-
- this.startingOffset = getTranslateX(this.items);
- this.moveHelper(direction);
- },
-
- moveHelper: function(direction) {
- this.autoscrollStop();
-
- var newIndex = this.getNewIndex(direction);
-
- var items = x$(this.items).find("[data-ur-carousel-component='item']");
-
- if (this.options.infinite) {
- var oldTransform = getTranslateX(this.items);
- var altTransform = oldTransform;
-
- if (newIndex < this.options.cloneLength) { // at the beginning of carousel
- var offset = items[this.options.cloneLength].offsetLeft - items[this.itemCount - this.options.cloneLength].offsetLeft;
- if (!this.flag.loop) {
- altTransform += offset;
- this.translate(altTransform);
- this.startingOffset += offset;
- }
- newIndex += this.realItemCount;
- this.itemIndex = newIndex + direction;
- }
- else if (newIndex > this.lastIndex - this.options.cloneLength) { // at the end of carousel
- var offset = items[this.itemCount - this.options.cloneLength].offsetLeft - items[this.options.cloneLength].offsetLeft;
- if (!this.flag.loop) {
- altTransform += offset;
- this.translate(altTransform);
- this.startingOffset += offset;
- }
- newIndex -= this.realItemCount;
- this.itemIndex = newIndex + direction;
- }
- }
- var newItem = items[newIndex];
- var currentItem = items[this.itemIndex];
- var displacement = currentItem.offsetLeft - newItem.offsetLeft; // CHECK
-
- setTimeout(function(obj) {
- return function() {
- obj.snapTo(displacement);
- obj.updateIndex(newIndex);
- }
- }(this), 6);
- },
-
- moveToIndex: function(index) {
- var direction = this.itemIndex - index;
- this.moveTo(direction);
- },
-
- momentum: function() {
- if (this.flag.touched)
- return;
-
- this.flag.increment = false;
-
- var translateX = getTranslateX(this.items);
- var distance = this.destinationOffset - translateX;
- var increment = distance - zeroFloor(distance / 1.1);
-
- // Hacky -- this is for the desktop browser only -- to fix rounding errors
- // Ideally, this is removed at compile time
- if(Math.abs(increment) < 0.01)
- increment = 0;
-
- var newTransform = increment + translateX;
-
- this.translate(newTransform);
-
- if (increment != 0)
- this.flag.increment = true;
-
- if (this.flag.increment)
- setTimeout(function(obj){return function(){obj.momentum()}}(this), 16);
- else {
- this.startingOffset = null;
- this.autoscrollStart();
-
- var itemIndex = this.itemIndex;
- x$(this.container).fire("slideend", {index: itemIndex});
-
- x$().iterate(this.onSlideCallbacks, function(callback) { callback(); });
- }
- },
-
- swipeDist: function() {
- if (this.endPos === undefined)
- return 0;
- return this.endPos.x - this.startPos.x;
- },
-
- translate: function(x) {
- var container = this.items;
- var translatePrefix = this.options.transform3d ? "translate3d(" : "translate(";
- var translateSuffix = this.options.transform3d ? ", 0px)" : ")";
- ["webkitTransform", "MozTransform", "oTransform", "transform"].forEach(function(i) {
- container.style[i] = translatePrefix + x + "px, 0px" + translateSuffix;
- });
- }
- }
-
- // Private constructors
- var ComponentConstructors = {
- button: function(group, component, type) {
- if (group["button"] === undefined)
- group["button"] = {};
-
- var type = component.getAttribute("data-ur-carousel-button-type");
-
- // Declaration error
- if (type === undefined)
- Ur.error("malformed carousel button type on:" + component.outerHTML);
-
- group["button"][type] = component;
-
- // Maybe in the future I'll make it so any of the items can be the starting item
- x$(component).attr("data-ur-state", type == "prev" ? "disabled" : "enabled");
- }
- };
- function CarouselLoader(){}
-
- CarouselLoader.prototype.initialize = function(fragment) {
- var carousels = x$(fragment).findElements("carousel", ComponentConstructors);
- Ur.Widgets["carousel"] = {};
- for (var name in carousels) {
- var carousel = carousels[name];
- Ur.Widgets["carousel"][name] = new Carousel(carousel);
- x$(carousel["set"]).attr("data-ur-state", "enabled");
- }
- }
-
- return CarouselLoader;
-})();
+// Carousel
+interactions.carousel = function ( fragment, options ) {
+ if (fragment.constructor == Object)
+ var groups = assignElements(fragment, "carousel");
+ else
+ var groups = findElements(fragment, "carousel");
+
+ // for each carousel
+ $.each(groups, function(id, group) {
+ $(group["buttons"]).each(function() {
+ var type = $(this).attr("data-ur-carousel-button-type");
+ if(!type) {
+ $.error("malformed carousel button type for carousel with id: " + id);
+ }
+ $(this).attr("data-ur-state", type == "prev" ? "disabled" : "enabled");
+ });
+ Uranium.carousel[id] = new Carousel(group, options);
+ $(group["set"]).data("urInit", true);
+ $(group["set"]).attr("data-ur-state", "enabled"); // should be data-ur-init or fire event
+ });
+
+ // private methods
+
+ function zeroFloor(num) {
+ return num >= 0 ? Math.floor(num) : Math.ceil(num);
+ }
+
+ function Carousel(set, options) {
+ var self = this;
+ self.urId = set["_id"];
+ self.container = set["set"];
+ self.scroller = set["scroll_container"];
+ if (!self.scroller)
+ $.error("carousel missing item components");
+ self.items = set["item"] || [];
+
+ // Optionally:
+ self.button = {
+ prev: $(set["button"]).filter("[data-ur-carousel-button-type='prev']"),
+ next: $(set["button"]).filter("[data-ur-carousel-button-type='next']")
+ };
+ self.counter = set["count"];
+ self.dots = set["dots"];
+
+ self.flag = {
+ click: true, // used for determining if item is clicked on touchscreens
+ snapping: false, // true if carousel is currently snapping, flag for users' convenience
+ lock: null, // used for determining horizontal/vertical dragging motion on touchscreens
+ touched: false // true when user is currently touching/dragging
+ };
+
+ self.options = {
+ autoscroll: false,
+ autoscrollDelay: 5000,
+ autoscrollForward: true,
+ center: false, // position active item in the middle of the carousel
+ cloneLength: 0, // number of clones at back of carousel (or front and back for centered carousels)
+ fill: 0, // exactly how many items forced to fit in the viewport, 0 means disabled
+ infinite: true, // loops the last item back to first and vice versa
+ speed: 1.1, // determines how "fast" carousel snaps, should probably be deprecated
+ transform3d: transform3d, // determines if translate3d() or translate() is used
+ touch: true, // determines if carousel can be dragged e.g. when user only wants buttons to be used
+ verticalScroll: true // determines if dragging carousel vertically scrolls the page on touchscreens, this is almost always true
+ };
+
+ $.extend(self.options, options);
+
+ self.count = self.items.length; // number of items (excluding clones)
+ self.itemIndex = 0; // index of active item (including clones)
+ self.translate = 0; // current numerical css translate value
+
+ var $container = $(self.container);
+ var $items = $(self.items); // all carousel items (including clones)
+ var coords = null;
+ var prevCoords; // stores previous coords, used for determining swipe direction
+ var startCoords = {x: 0, y: 0};
+ var shift = 0; // in range [0, 1) or [-0.5, 0.5) for centered carousels showing translate percentage past top/left side of active item
+ var dest = $items[0]; // snap destination element
+ var destinationOffset; // translate value of destination
+ var lastIndex = self.count - 1; // index of last item
+ var allItemsWidth; // sum of all items' widths (excluding clones)
+ var autoscrollId; // used for autoscrolling timeout
+ var momentumId; // used for snapping timeout
+
+ var viewport = $container.outerWidth();
+
+ var startingOffset = null;
+
+ var translatePrefix = "translate3d(", translateSuffix = ", 0)";
+
+ function initialize() {
+ if (!self.options.transform3d) {
+ translatePrefix = "translate(";
+ translateSuffix = ")";
+ }
+
+ $items.each(function(i, obj) {
+ if ($(obj).attr("data-ur-state") == "active") {
+ self.itemIndex = i;
+ return false;
+ }
+ });
+
+ insertClones();
+ updateIndex(self.options.center ? self.itemIndex + self.options.cloneLength : self.itemIndex);
+ updateDots();
+ self.update();
+
+ $(self.scroller).on("dragstart.ur.carousel", function() { return false; }); // for Firefox
+
+ if (self.options.touch) {
+ $(self.scroller)
+ .on(downEvent + ".carousel", startSwipe)
+ .on(moveEvent + ".carousel", continueSwipe)
+ .on(upEvent + ".carousel", finishSwipe);
+ $items.each(function(_, item) {
+ if (item.onclick)
+ $(item).data("urClick", item.onclick);
+ item.onclick = function(event) {
+ if (self.flag.click || (!event.clientX && !event.clientY)) {
+ var handler = $(this).data("urClick");
+ if (handler)
+ handler.call(this, event);
+ }
+ else {
+ stifle(event);
+ event.stopImmediatePropagation();
+ }
+ };
+ });
+ }
+
+ self.button.prev.on("click.ur.carousel", function() {
+ moveTo(1);
+ });
+ self.button.next.on("click.ur.carousel", function() {
+ moveTo(-1);
+ });
+
+ if ("onorientationchange" in window)
+ $(window).on("orientationchange.ur.carousel", self.update);
+ else
+ $(window).on("resize.ur.carousel", function() {
+ if (viewport != $container.outerWidth()) {
+ self.update();
+ setTimeout(self.update, 100); // sometimes styles haven't updated yet
+ }
+ });
+
+ $items.find("img").addBack("img").on("load.ur.carousel", self.update); // after any (late-loaded) images are loaded
+
+ self.autoscrollStart();
+
+ $container.triggerHandler("load.ur.carousel");
+ }
+
+ function readAttributes() {
+ var custom3d = $container.attr("data-ur-android3d") || $container.attr("data-ur-transform3d");
+ if (custom3d)
+ self.options.transform3d = custom3d != "disabled";
+ $container.attr("data-ur-transform3d", self.options.transform3d ? "enabled" : "disabled");
+ if (oldAndroid && !self.options.transform3d) {
+ var speed = parseFloat($container.attr("data-ur-speed"));
+ self.options.speed = speed > 1 ? speed : 1.3;
+ }
+ $container.attr("data-ur-speed", self.options.speed);
+
+ var fill = parseInt($container.attr("data-ur-fill"));
+ if (fill > 0)
+ self.options.fill = fill;
+ $container.attr("data-ur-fill", self.options.fill);
+
+ var cloneLength = $container.attr("data-ur-clones");
+ if (cloneLength)
+ self.options.cloneLength = parseInt(cloneLength);
+ $container.attr("data-ur-clones", self.options.cloneLength);
+
+ var autoscrollDelay = parseInt($container.attr("data-ur-autoscroll-delay"));
+ if (autoscrollDelay >= 0)
+ self.options.autoscrollDelay = autoscrollDelay;
+ $container.attr("data-ur-autoscroll-delay", self.options.autoscrollDelay);
+
+ var autoscrollDir = $container.attr("data-ur-autoscroll-dir");
+ if (autoscrollDir)
+ self.options.autoscrollForward = autoscrollDir != "prev";
+ $container.attr("data-ur-autoscroll-dir", self.options.autoscrollForward ? "next" : "prev");
+
+ // read boolean attributes
+ $.each(["autoscroll", "center", "infinite", "touch", "verticalScroll"], function(_, name) {
+ var dashName = "data-ur-" + name.replace(/[A-Z]/g, function(i) { return "-" + i.toLowerCase()});
+ var value = $container.attr(dashName);
+ if (value == "enabled")
+ self.options[name] = true;
+ else if (value == "disabled")
+ self.options[name] = false;
+
+ $container.attr(dashName, self.options[name] ? "enabled" : "disabled");
+ });
+ }
+
+ function insertClones() {
+ if (!self.options.infinite) {
+ self.options.cloneLength = 0;
+ $container.attr("data-ur-clones", 0);
+ return;
+ }
+
+ if (self.options.cloneLength == 0) {
+ if (self.options.fill)
+ self.options.cloneLength = self.options.center ? Math.min(1, self.options.fill - 1) : self.options.fill;
+ else if (self.options.center) {
+ // insert enough clones at front and back to never see a blank space
+ var cloneLengths = [0, 0];
+ var space = viewport/2 + width($items[lastIndex])/2;
+ for (var i = lastIndex; space > 0; i = (i - 1 + self.count) % self.count) {
+ space -= width($items[i]);
+ cloneLengths[0]++;
+ }
+
+ space = viewport/2 + width($items[0])/2;
+ for (var i = 0; space > 0; i = (i + 1) % self.count) {
+ space -= width($items[i]);
+ cloneLengths[1]++;
+ }
+
+ self.options.cloneLength = Math.max(cloneLengths[0], cloneLengths[1]);
+ }
+ else {
+ // insert enough clones at the back to never see a blank space
+ var space = viewport;
+ var i = 0;
+ while (space > 0) {
+ space -= width($items[i]);
+ self.options.cloneLength++;
+ i = (i + 1) % $items.length;
+ }
+ }
+ }
+
+ $container.attr("data-ur-clones", self.options.cloneLength);
+
+ var frag = document.createDocumentFragment();
+ for (var i = 0; i < self.options.cloneLength; i++) {
+ var srcIndex = i % self.count;
+ var clone = $items.eq(srcIndex).clone(true).attr("data-ur-clone", srcIndex).attr("data-ur-state", "inactive");
+ frag.appendChild(clone[0]);
+ }
+ $items.parent().append(frag);
+
+ if (self.options.center) {
+ frag = document.createDocumentFragment()
+ var offset = self.count - (self.options.cloneLength % self.count);
+ for (var i = offset; i < offset + self.options.cloneLength; i++) {
+ var srcIndex = i % self.count;
+ var clone = $items.eq(srcIndex).clone(true).attr("data-ur-clone", srcIndex).attr("data-ur-state", "inactive");
+ frag.appendChild(clone[0]);
+ }
+ $items.parent().prepend(frag);
+ }
+
+ $items = $(self.scroller).find("[data-ur-carousel-component='item']");
+ lastIndex = $items.length - 1;
+ }
+
+ function updateDots() {
+ if (self.dots) {
+ var existing = $(self.dots).find("[data-ur-carousel-component='dot']");
+ if (existing.length != self.count) {
+ existing.remove();
+ var dot = $("");
+ var storage = document.createDocumentFragment();
+ for (var i = 0; i < self.count; i++) {
+ var newdot = dot.clone().attr("data-ur-state", i == self.itemIndex ? "active" : "inactive");
+ storage.appendChild(newdot[0]);
+ }
+ $(self.dots).append(storage);
+ }
+ }
+ }
+
+ self.update = function() {
+ var oldCount = $items.length;
+ $items = $(self.scroller).find("[data-ur-carousel-component='item']");
+ if (oldCount != $items.length) {
+ self.items = $items.filter(":not([data-ur-clone])").toArray();
+ self.count = self.items.length;
+ lastIndex = $items.length - 1;
+
+ $items.each(function(i, obj) {
+ if ($(obj).attr("data-ur-state") == "active") {
+ self.itemIndex = i;
+ return false;
+ }
+ });
+
+ // in case the previous active item was removed
+ if (self.itemIndex >= $items.length - self.options.cloneLength) {
+ self.itemIndex = lastIndex - self.options.cloneLength;
+ $items.eq(self.itemIndex).attr("data-ur-state", "active");
+ }
+
+ // in the rare case the destination element was (re)moved
+ if (!$.contains(self.scroller, dest))
+ dest = $items[self.itemIndex];
+
+ updateDots();
+ updateIndex(self.options.center ? self.itemIndex + self.options.cloneLength : self.itemIndex);
+ }
+
+ viewport = $container.outerWidth();
+ // Adjust the container to be the necessary width.
+ var totalWidth = 0;
+
+ // pixel-perfect division, slightly inefficient?
+ var divisions = [];
+ if (self.options.fill > 0) {
+ var remainder = viewport;
+ for (var i = self.options.fill; i > 0; i--) {
+ var length = Math.round(remainder/i);
+ divisions.push(length);
+ remainder -= length;
+ }
+ }
+
+ allItemsWidth = 0;
+ for (var i = 0; i < $items.length; i++) {
+ if (self.options.fill > 0) {
+ var length = divisions[i % self.options.fill];
+ var item = $items.eq(i);
+ // set outerWidth regardless of box-sizing
+ item.css("width", length + parseInt(item.css("width")) - item.outerWidth()); // could add true param if margins allowed
+ totalWidth += length;
+ }
+ else
+ totalWidth += width($items[i]);
+
+ if (i <= lastIndex - self.options.cloneLength && i >= (self.options.center ? self.options.cloneLength : 0))
+ allItemsWidth += width($items[i]);
+ }
+
+ $(self.scroller).width(totalWidth);
+
+ var currentItem = $items[self.itemIndex];
+ var newTranslate = -(offsetFront(currentItem) + shift * width(currentItem));
+ destinationOffset = -offsetFront(dest);
+ if (self.options.center) {
+ newTranslate += centerOffset(currentItem);
+ destinationOffset += centerOffset(dest);
+ }
+ translateX(newTranslate);
+ };
+
+ self.autoscrollStart = function() {
+ if (!self.options.autoscroll)
+ return;
+
+ autoscrollId = setTimeout(function() {
+ if (viewport != 0) {
+ if (!self.options.infinite && self.itemIndex == lastIndex && self.options.autoscrollForward)
+ self.jumpToIndex(0);
+ else if (!self.options.infinite && self.itemIndex == 0 && !self.options.autoscrollForward)
+ self.jumpToIndex(lastIndex);
+ else
+ moveTo(self.options.autoscrollForward ? -1 : 1);
+ }
+ else
+ self.autoscrollStart();
+ }, self.options.autoscrollDelay);
+ };
+
+ self.autoscrollStop = function() {
+ clearTimeout(autoscrollId);
+ };
+
+ function updateButtons() {
+ if (self.options.infinite)
+ $([self.button.prev, self.button.next]).attr("data-ur-state", "enabled");
+ else {
+ $(self.button.prev).attr("data-ur-state", self.itemIndex == 0 ? "disabled" : "enabled");
+ $(self.button.next).attr("data-ur-state", self.itemIndex == self.count - Math.max(self.options.fill, 1) ? "disabled" : "enabled");
+ }
+ }
+
+ // execute side effects of new index
+ function updateIndex(newIndex) {
+ if (newIndex === undefined)
+ return;
+
+ self.itemIndex = newIndex;
+ if (self.itemIndex < 0)
+ self.itemIndex = 0;
+ else if (self.itemIndex > lastIndex)
+ self.itemIndex = lastIndex;
+
+ var realIndex = self.itemIndex;
+ if (self.options.infinite && self.options.center)
+ realIndex = self.itemIndex - self.options.cloneLength;
+ realIndex = realIndex % self.count;
+ $(self.counter).html(function() {
+ var template = $(this).attr("data-ur-template") || "{{index}} of {{count}}";
+ return template.replace("{{index}}", realIndex + 1).replace("{{count}}", self.count);
+ });
+
+ $items.attr("data-ur-state", "inactive");
+ $items.eq(self.itemIndex % self.count).attr("data-ur-state", "active");
+
+ $(self.dots).find("[data-ur-carousel-component='dot']").attr("data-ur-state", "inactive").eq(realIndex).attr("data-ur-state", "active");
+
+ updateButtons();
+ }
+
+ function startSwipe(e) {
+ if (!self.options.verticalScroll)
+ stifle(e);
+ self.autoscrollStop();
+
+ self.flag.touched = true;
+ self.flag.lock = null;
+ self.flag.click = true;
+
+ coords = getEventCoords(e);
+
+ startCoords = prevCoords = coords;
+ startingOffset = getTranslateX();
+ }
+
+ function continueSwipe(e) {
+ if (!self.flag.touched) // for non-touch environments since mousemove fires without mousedown
+ return;
+
+ prevCoords = coords;
+ coords = getEventCoords(e);
+
+ if (Math.abs(startCoords.y - coords.y) + Math.abs(startCoords.x - coords.x) > 0)
+ self.flag.click = false;
+
+ if (touchscreen && self.options.verticalScroll) {
+ var slope = Math.abs((startCoords.y - coords.y)/(startCoords.x - coords.x));
+ if (self.flag.lock) {
+ if (self.flag.lock == "y")
+ return;
+ }
+ else if (slope > 1.2) {
+ self.flag.lock = "y";
+ return;
+ }
+ else if (slope <= 1.2)
+ self.flag.lock = "x";
+ else
+ return;
+ }
+
+ stifle(e);
+
+ if (coords !== null) {
+ var dist = startingOffset + swipeDist(startCoords, coords); // new translate() value, usually negative
+
+ var threshold = -dist;
+ if (self.options.center)
+ threshold += viewport/2;
+ $items.each(function(i, item) {
+ var boundStart = offsetFront(item);
+ var boundEnd = boundStart + width(item);
+ if (boundEnd > threshold) {
+ self.itemIndex = i;
+ shift = (threshold - boundStart)/width(item);
+ if (self.options.center)
+ shift -= 0.5;
+ return false;
+ }
+ });
+
+ if (self.options.infinite) {
+ if (self.options.center) {
+ if (self.itemIndex < self.options.cloneLength) { // at the start of carousel so loop to end
+ startingOffset -= allItemsWidth;
+ dist -= allItemsWidth;
+ self.itemIndex += self.count;
+ }
+ else if (self.itemIndex >= self.count + self.options.cloneLength) { // at the end of carousel so loop to start
+ startingOffset += allItemsWidth;
+ dist += allItemsWidth;
+ self.itemIndex -= self.count;
+ }
+ }
+ else {
+ if (shift < 0) { // at the start of carousel so loop to end
+ startingOffset -= allItemsWidth;
+ dist -= allItemsWidth;
+ self.itemIndex += self.count;
+ var item = $items[self.itemIndex];
+ shift = (-dist - offsetFront(item))/width(item);
+ }
+ else if (self.itemIndex >= self.count) { // at the end of carousel so loop to start
+ var offset = offsetFront($items[self.count]) - offsetFront($items[0]); // length of all original items
+ startingOffset += offset;
+ dist += offset;
+ self.itemIndex -= self.count;
+ }
+ }
+ }
+
+ translateX(dist);
+ }
+
+ }
+
+ function finishSwipe(e) {
+ if (!self.flag.touched) // for non-touch environments since mouseup fires without mousedown
+ return;
+
+ if (!self.flag.click || self.flag.lock)
+ stifle(e);
+ else if (e.target.tagName == "AREA")
+ location.href = e.target.href;
+
+ self.flag.touched = false;
+
+ var dir = coords.x - prevCoords.x;
+ if (self.options.center) {
+ if (dir < 0 && shift > 0)
+ moveTo(-1)
+ else if (dir > 0 && shift < 0)
+ moveTo(1);
+ else
+ moveTo(0);
+ }
+ else
+ moveTo(dir < 0 ? -1: 0);
+ }
+
+ function moveTo(direction) {
+ self.autoscrollStop();
+
+ // in case prev/next buttons are being spammed
+ clearTimeout(momentumId);
+
+ var newIndex = self.itemIndex - direction;
+ if (!self.options.infinite) {
+ if (self.options.fill > 0)
+ newIndex = bound(newIndex, [0, self.count - self.options.fill]);
+ else
+ newIndex = bound(newIndex, [0, lastIndex]);
+ }
+
+ // when snapping to clone, prepare to snap back to original element
+ if (self.options.infinite) {
+ var transform = getTranslateX();
+ if (self.options.center) {
+ if (newIndex < self.options.cloneLength) { // clone at start of carousel so loop to back
+ translateX(transform - allItemsWidth);
+ newIndex += self.count;
+ self.itemIndex = newIndex + direction;
+ }
+ else if (newIndex >= self.count + self.options.cloneLength) { // clone at end of carousel so loop to front
+ translateX(transform + allItemsWidth);
+ newIndex -= self.count;
+ self.itemIndex = newIndex + direction;
+ }
+
+ }
+ else {
+ if (newIndex < 0) { // at start of carousel so loop to back
+ translateX(transform - allItemsWidth);
+ newIndex += self.count;
+ self.itemIndex = newIndex + direction;
+ }
+ else if (newIndex > self.count) { // clone at end of carousel so loop to start
+ translateX(transform + allItemsWidth);
+ newIndex -= self.count;
+ self.itemIndex = newIndex + direction;
+ }
+
+ }
+ }
+
+ dest = $items[newIndex];
+ $container.triggerHandler("slidestart", {index: newIndex});
+
+ // timeout needed for mobile safari
+ setTimeout(function() {
+ snapTo();
+ updateIndex(newIndex);
+ }, 0);
+ }
+
+ function snapTo() {
+ destinationOffset = -offsetFront(dest);
+ if (self.options.center)
+ destinationOffset += centerOffset(dest);
+
+ function momentum() {
+ // in case user touched in the middle of snapping
+ if (self.flag.touched)
+ return;
+
+ var translate = getTranslateX();
+ var distance = destinationOffset - translate;
+ var delta = distance - zeroFloor(distance / self.options.speed);
+
+ // Hacky -- this is for the desktop browser only -- to fix rounding errors
+ // Ideally, this is removed at compile time
+ if(Math.abs(delta) < 0.01)
+ delta = 0;
+
+ var newTransform = translate + delta;
+ translateX(newTransform);
+
+ self.flag.snapping = delta != 0;
+ if (self.flag.snapping)
+ momentumId = setTimeout(momentum, 16);
+ else
+ endSnap();
+ }
+
+ momentum();
+ }
+
+ function endSnap() {
+ // infinite, non-centered carousels when swiping from last item back to first can't switch early in moveTo() since no clones at front
+ if (self.options.infinite && !self.options.center && self.itemIndex >= self.count) {
+ translateX(getTranslateX() + allItemsWidth);
+ self.itemIndex -= self.count;
+ }
+ shift = 0;
+ self.flag.click = true;
+ self.autoscrollStart();
+ $container.triggerHandler("slideend", {index: self.itemIndex});
+ }
+
+ self.jumpToIndex = function(index) {
+ moveTo(self.itemIndex - index);
+ };
+
+ // could be end.y - start.y if vertical option implemented
+ function swipeDist(start, end) {
+ return end.x - start.x;
+ }
+
+ function translateX(x) {
+ self.translate = x;
+ var css = translatePrefix + x + "px, 0px" + translateSuffix;
+ $(self.scroller).css({webkitTransform: css, MozTransform: css, msTransform: css, transform: css});
+ }
+
+ function getTranslateX() {
+ return self.translate;
+ }
+
+ // could possibly be $(item).outerWidth(true) if margins are allowed
+ function width(item) {
+ return item.offsetWidth;
+ }
+
+ // .offsetLeft/Top, could includ margin as "part" of the element with - parseInt($(item).css("marginLeft"))
+ function offsetFront(item) {
+ return item.offsetLeft;
+ }
+
+ // offset needed to center element, round since subpixel translation makes images blurry
+ function centerOffset(item) {
+ return Math.floor((viewport - width(item))/2);
+ }
+
+ readAttributes();
+
+ // delay initialization until we can figure out number of clones
+ var zeroWidth = false;
+ if (self.options.infinite && !self.options.fill && self.options.cloneLength == 0) {
+ $items.width(function(i, width) {
+ if (width == 0)
+ zeroWidth = true;
+ });
+ }
+ if (zeroWidth) {
+ // wait until (late-loaded) images are loaded or other content inserted
+ console.warn("carousel with id: " + self.urId + " will be late loaded");
+ var imgs = $items.find("img").addBack("img");
+ var numImgs = imgs.length;
+ if (numImgs > 0)
+ imgs.on("load.ur.carousel", function() {
+ if (--numImgs == 0)
+ initialize();
+ });
+ else
+ $(window).on("load.ur.carousel", initialize);
+ }
+ else
+ initialize();
+
+ }
+};
diff --git a/lib/deprecated/carousel.js b/lib/deprecated/carousel.js
new file mode 100644
index 0000000..10c0c11
--- /dev/null
+++ b/lib/deprecated/carousel.js
@@ -0,0 +1,599 @@
+/* Carousel *
+ * * * * * * *
+ * The carousel is a widget to allow for horizontally scrolling
+ * (with touch or buttons) between a set of items.
+ *
+ * The only assumption is about the items' style -- they must be
+ * float: left; so that the real width can be accurately totalled.
+ */
+
+Ur.WindowLoaders["carousel"] = (function() {
+
+ function Carousel(components) {
+ var self = this;
+
+ this.container = components["view_container"];
+ this.items = components["scroll_container"];
+ if (this.items.length == 0) {
+ Ur.error("carousel missing item components");
+ return false;
+ }
+
+ // Optionally:
+ this.button = components["button"] === undefined ? {} : components["button"];
+ this.count = components["count"];
+ this.dots = components["dots"];
+
+ this.flag = {
+ click: false,
+ increment: false,
+ loop: false,
+ lock: null,
+ timeoutId: null,
+ touched: false
+ };
+
+ this.options = {
+ autoscroll: true,
+ autoscrollDelay: 5000,
+ autoscrollForward: true,
+ center: true,
+ cloneLength: 1,
+ fill: 0,
+ infinite: true,
+ speed: 1.1,
+ transform3d: true,
+ touch: true,
+ verticalScroll: true
+ };
+
+ this.itemIndex = 0;
+ this.translate = 0;
+
+ var $container = x$(this.container);
+ var preCoords = {x: 0, y: 0};
+ var startPos = {x: 0, y: 0}, endPos = {x: 0, y: 0};
+
+ var snapWidth = 0;
+
+ var startingOffset = null;
+
+ var translatePrefix = "translate3d(", translateSuffix = ", 0px)";
+
+ function initialize() {
+ // TODO:
+ // add an internal event handler to handle all events on the container:
+ // x$(self.container).on("event", self.handleEvent);
+
+ readAttributes();
+
+ if (!self.options.transform3d) {
+ translatePrefix = "translate(";
+ translateSuffix = ")";
+ }
+
+ x$(self.items).find("[data-ur-carousel-component='item']").each(function(obj, i) {
+ if (x$(obj).attr("data-ur-state")[0] == "active")
+ self.itemIndex = i;
+ });
+
+ if (self.options.infinite) {
+ var items = x$(self.items).find("[data-ur-carousel-component='item']");
+ self.realItemCount = items.length;
+ for (var i = 0; i < self.options.cloneLength; i++) {
+ var clone = items[i].cloneNode(true);
+ x$(clone).attr("data-ur-clone", i).attr("data-ur-state", "inactive");
+ items[items.length - 1].parentNode.appendChild(clone);
+ }
+
+ for (var i = items.length - self.options.cloneLength; i < items.length; i++) {
+ var clone = items[i].cloneNode(true);
+ x$(clone).attr("data-ur-clone", i).attr("data-ur-state", "inactive");
+ items[0].parentNode.insertBefore(clone, items[0]);
+ }
+ }
+
+ updateIndex(self.itemIndex + self.options.cloneLength);
+
+ self.update();
+
+ if (self.options.touch) {
+ var hasTouch = "ontouchstart" in window;
+ var start = hasTouch ? "touchstart" : "mousedown";
+ var move = hasTouch ? "touchmove" : "mousemove";
+ var end = hasTouch ? "touchend" : "mouseup";
+
+ x$(self.items).on(start, startSwipe);
+ x$(self.items).on(move, continueSwipe);
+ x$(self.items).on(end, finishSwipe);
+ x$(self.items).click(function(e) {if (!self.flag.click) stifle(e);});
+ }
+
+ x$(self.button["prev"]).click(function(){self.moveTo(1);});
+ x$(self.button["next"]).click(function(){self.moveTo(-1);});
+
+ x$(window).orientationchange(resize);
+ // orientationchange isn't supported on some androids
+ x$(window).on("resize", function() {
+ resize();
+ setTimeout(resize, 100);
+ });
+
+ self.autoscrollStart();
+ }
+
+ function readAttributes() {
+
+ // translate3d is disabled on Android by default because it often causes problems
+ // however, on some pages translate3d will work fine so the data-ur-android3d
+ // attribute can be set to "enabled" to use translate3d since it can be smoother
+ // on some Android devices
+
+ var oldAndroid = /Android [12]/.test(navigator.userAgent);
+ if (oldAndroid && $container.attr("data-ur-android3d")[0] != "enabled") {
+ self.options.transform3d = false;
+ var speed = parseFloat($container.attr("data-ur-speed"));
+ self.options.speed = speed > 1 ? speed : 1.3;
+ }
+
+ $container.attr("data-ur-speed", self.options.speed);
+
+ self.options.verticalScroll = $container.attr("data-ur-vertical-scroll")[0] != "disabled";
+ $container.attr("data-ur-vertical-scroll", self.options.verticalScroll ? "enabled" : "disabled");
+
+ self.options.touch = $container.attr("data-ur-touch")[0] != "disabled";
+ $container.attr("data-ur-touch", self.options.touch ? "enabled" : "disabled");
+
+ self.options.infinite = $container.attr("data-ur-infinite")[0] != "disabled";
+ if ($container.find("[data-ur-carousel-component='item']").length == 1)
+ self.options.infinite = false;
+ $container.attr("data-ur-infinite", self.options.infinite ? "enabled" : "disabled");
+
+ self.options.center = $container.attr("data-ur-center")[0] == "enabled";
+ $container.attr("data-ur-center", self.options.center ? "enabled" : "disabled");
+
+ var fill = parseInt($container.attr("data-ur-fill"));
+ if (fill > 0)
+ self.options.fill = fill;
+ $container.attr("data-ur-fill", self.options.fill);
+
+ var cloneLength = parseInt($container.attr("data-ur-clones"));
+ if (!self.options.infinite)
+ cloneLength = 0;
+ else if (isNaN(cloneLength) || cloneLength < self.options.fill)
+ cloneLength = Math.max(1, self.options.fill);
+ self.options.cloneLength = cloneLength;
+ $container.attr("data-ur-clones", self.options.cloneLength);
+
+ self.options.autoscroll = $container.attr("data-ur-autoscroll")[0] == "enabled";
+ $container.attr("data-ur-autoscroll", self.options.autoscroll ? "enabled" : "disabled");
+
+ var autoscrollDelay = parseInt($container.attr("data-ur-autoscroll-delay"));
+ if (autoscrollDelay >= 0)
+ self.options.autoscrollDelay = autoscrollDelay;
+ $container.attr("data-ur-autoscroll-delay", self.options.autoscrollDelay);
+
+ self.options.autoscrollForward = $container.attr("data-ur-autoscroll-dir")[0] != "prev";
+ $container.attr("data-ur-autoscroll-dir", self.options.autoscrollForward ? "next" : "prev");
+ }
+
+ function updateDots() {
+ if (self.dots) {
+ var existing = x$(self.dots).find("[data-ur-carousel-component='dot']");
+ if (existing.length != self.realItemCount) {
+ existing.remove();
+ var dot = x$("
")[0];
+ var realItemIndex = self.itemIndex - self.options.cloneLength;
+ for (var i = 0; i < self.realItemCount; i++) {
+ var new_dot = dot.cloneNode();
+ if (i == realItemIndex)
+ x$(new_dot).attr("data-ur-state", "active");
+ self.dots.appendChild(new_dot);
+ }
+ }
+ }
+ }
+
+ function resize() {
+ var offsetWidth = self.container.offsetWidth;
+ if (snapWidth != offsetWidth && offsetWidth != 0)
+ self.update();
+ }
+
+ this.update = function() {
+ var oldWidth = snapWidth;
+ snapWidth = self.container.offsetWidth;
+
+ var oldCount = self.itemCount;
+ var items = x$(self.items).find("[data-ur-carousel-component='item']");
+ self.itemCount = items.length;
+
+ if (oldCount != self.itemCount) {
+ self.realItemCount = items.has(":not([data-ur-clone])").length;
+ self.lastIndex = self.itemCount - 1;
+ if (self.itemIndex > self.lastIndex)
+ self.itemIndex = self.lastIndex;
+ updateDots();
+ }
+
+ // Adjust the container to be the necessary width.
+ var totalWidth = 0;
+
+ var divisions = [];
+ if (self.options.fill > 0) {
+ var remainder = snapWidth;
+ for (var i = self.options.fill; i > 0; i--) {
+ var length = Math.round(remainder/i);
+ divisions.push(length);
+ remainder -= length;
+ }
+ }
+
+ for (var i = 0; i < items.length; i++) {
+ if (self.options.fill > 0) {
+ var length = divisions[i % self.options.fill];
+ items[i].style.width = length + "px";
+ totalWidth += length;
+ }
+ else
+ totalWidth += items[i].offsetWidth;
+ }
+
+ self.items.style.width = totalWidth + "px";
+
+ var cumulativeOffset = -items[self.itemIndex].offsetLeft; // initial offset
+ if (self.options.center) {
+ var centerOffset = parseInt((snapWidth - items[self.itemIndex].offsetWidth)/2);
+ cumulativeOffset += centerOffset; // CHECK
+ }
+ if (oldWidth)
+ self.destinationOffset = cumulativeOffset;
+
+ translateX(cumulativeOffset);
+ };
+
+ this.autoscrollStart = function() {
+ if (!self.options.autoscroll)
+ return;
+
+ self.flag.timeoutId = setTimeout(function() {
+ if (self.container.offsetWidth != 0) {
+ if (!self.options.infinite && self.itemIndex == self.lastIndex && self.options.autoscrollForward)
+ self.jumpToIndex(0);
+ else if (!self.options.infinite && self.itemIndex == 0 && !self.options.autoscrollForward)
+ self.jumpToIndex(self.lastIndex);
+ else
+ self.moveTo(self.options.autoscrollForward ? -1 : 1);
+ }
+ else
+ self.autoscrollStart();
+ }, self.options.autoscrollDelay);
+ };
+
+ this.autoscrollStop = function() {
+ clearTimeout(self.flag.timeoutId);
+ };
+
+ function getEventCoords(event) {
+ if (event.touches && event.touches.length > 0)
+ return {x: event.touches[0].clientX, y: event.touches[0].clientY};
+ else if (event.clientX != undefined)
+ return {x: event.clientX, y: event.clientY};
+ return null;
+ }
+
+ function updateButtons() {
+ x$(self.button["prev"]).attr("data-ur-state", self.itemIndex == 0 ? "disabled" : "enabled");
+ x$(self.button["next"]).attr("data-ur-state", self.itemIndex == self.itemCount - Math.max(self.options.fill, 1) ? "disabled" : "enabled");
+ }
+
+ function getNewIndex(direction) {
+ var newIndex = self.itemIndex - direction;
+ if (!self.options.infinite) {
+ if (self.options.fill > 1 && newIndex > self.lastIndex - self.options.fill + 1)
+ newIndex = self.lastIndex - self.options.fill + 1;
+ else if (newIndex > self.lastIndex)
+ newIndex = self.lastIndex;
+ else if (newIndex < 0)
+ newIndex = 0;
+ }
+
+ return newIndex;
+ }
+
+ function updateIndex(newIndex) {
+ if (newIndex === undefined)
+ return;
+
+ self.itemIndex = newIndex;
+ if (self.itemIndex < 0)
+ self.itemIndex = 0;
+ else if (self.itemIndex > self.lastIndex)
+ self.itemIndex = self.lastIndex - 1;
+
+ var realIndex = self.itemIndex;
+ if (self.options.infinite)
+ realIndex = (self.realItemCount + self.itemIndex - self.options.cloneLength) % self.realItemCount;
+ if (self.count !== undefined)
+ self.count.innerHTML = realIndex + 1 + " of " + self.realItemCount;
+
+ x$(self.items).find("[data-ur-carousel-component='item'][data-ur-state='active']").attr("data-ur-state", "inactive");
+ x$(x$(self.items).find("[data-ur-carousel-component='item']")[self.itemIndex]).attr("data-ur-state", "active");
+
+ if (self.dots)
+ x$(x$(self.dots).find("[data-ur-carousel-component='dot']").attr("data-ur-state", "inactive")[realIndex]).attr("data-ur-state", "active");
+
+ updateButtons();
+
+ $container.fire("slidestart", {index: realIndex});
+ }
+
+ function startSwipe(e) {
+ if (!self.options.verticalScroll)
+ stifle(e);
+ self.autoscrollStop();
+
+ self.flag.touched = true; // For non-touch environments
+ self.flag.lock = null;
+ self.flag.loop = false;
+ self.flag.click = true;
+ var coords = getEventCoords(e);
+ preCoords.x = coords.x;
+ preCoords.y = coords.y;
+
+ if (coords !== null) {
+ var translate = getTranslateX();
+
+ if (startingOffset == null || self.destinationOffset == undefined)
+ startingOffset = translate;
+ else
+ // Fast swipe
+ startingOffset = self.destinationOffset; //Factor incomplete previous swipe
+
+ startPos = endPos = coords;
+ }
+ }
+
+ function continueSwipe(e) {
+ if (!self.flag.touched) // For non-touch environments
+ return;
+
+ self.flag.click = false;
+
+ var coords = getEventCoords(e);
+
+ if (document.ontouchstart !== undefined && self.options.verticalScroll) {
+ var slope = Math.abs((preCoords.y - coords.y)/(preCoords.x - coords.x));
+ if (self.flag.lock) {
+ if (self.flag.lock == "y")
+ return;
+ }
+ else if (slope > 1.2) {
+ self.flag.lock = "y";
+ return;
+ }
+ else if (slope <= 1.2)
+ self.flag.lock = "x";
+ else
+ return;
+ }
+ stifle(e);
+
+ if (coords !== null) {
+ endPos = coords;
+ var dist = swipeDist() + startingOffset;
+
+ if (self.options.infinite) {
+ var items = x$(self.items).find("[data-ur-carousel-component='item']");
+ var endLimit = items[self.lastIndex].offsetLeft + items[self.lastIndex].offsetWidth - self.container.offsetWidth;
+
+ if (dist > 0) { // at the beginning of carousel
+ var srcNode = items[self.realItemCount];
+ var offset = srcNode.offsetLeft - items[0].offsetLeft;
+ startingOffset -= offset;
+ dist -= offset;
+ self.flag.loop = !self.flag.loop;
+ }
+ else if (dist < -endLimit) { // at the end of carousel
+ var srcNode = items[self.lastIndex - self.realItemCount];
+ var offset = srcNode.offsetLeft - items[self.lastIndex].offsetLeft;
+ startingOffset -= offset;
+ dist -= offset;
+ self.flag.loop = !self.flag.loop;
+ }
+ }
+
+ translateX(dist);
+ }
+ }
+
+ function finishSwipe(e) {
+ if (!self.flag.click || self.flag.lock)
+ stifle(e);
+ else if (e.target.tagName == "AREA")
+ location.href = e.target.href;
+
+ self.flag.touched = false; // For non-touch environments
+
+ moveHelper(getDisplacementIndex());
+ }
+
+ function getDisplacementIndex() {
+ var swipeDistance = swipeDist();
+ var displacementIndex = zeroCeil(swipeDistance/x$(self.items).find("[data-ur-carousel-component='item']")[0].offsetWidth);
+ return displacementIndex;
+ }
+
+ function snapTo(displacement) {
+ self.destinationOffset = displacement + startingOffset;
+ var maxOffset = -1*self.lastIndex*snapWidth;
+ var minOffset = parseInt((snapWidth - x$(self.items).find("[data-ur-carousel-component='item']")[0].offsetWidth)/2);
+
+ if (self.options.infinite)
+ maxOffset = -self.items.offsetWidth;
+ if (self.destinationOffset < maxOffset || self.destinationOffset > minOffset) {
+ if (Math.abs(self.destinationOffset - maxOffset) < 1) {
+ // Hacky -- but there are rounding errors
+ // I see this when I'm in multi-mode and using the buttons
+ // This only seems to happen on the desktop browser -- ideally its removed at compile time
+ self.destinationOffset = maxOffset;
+ } else
+ self.destinationOffset = minOffset;
+ }
+
+ momentum();
+ }
+
+ this.moveTo = function(direction) {
+ // The animation isnt done yet
+ if (self.flag.increment)
+ return;
+
+ startingOffset = getTranslateX();
+ moveHelper(direction);
+ };
+
+ function moveHelper(direction) {
+ self.autoscrollStop();
+
+ var newIndex = getNewIndex(direction);
+
+ var items = x$(self.items).find("[data-ur-carousel-component='item']");
+
+ if (self.options.infinite) {
+ var oldTransform = getTranslateX();
+ var altTransform = oldTransform;
+
+ if (newIndex < self.options.cloneLength) { // at the beginning of carousel
+ var offset = items[self.options.cloneLength].offsetLeft - items[self.itemCount - self.options.cloneLength].offsetLeft;
+ if (!self.flag.loop) {
+ altTransform += offset;
+ translateX(altTransform);
+ startingOffset += offset;
+ }
+ newIndex += self.realItemCount;
+ self.itemIndex = newIndex + direction;
+ }
+ else if (newIndex > self.lastIndex - self.options.cloneLength) { // at the end of carousel
+ var offset = items[self.itemCount - self.options.cloneLength].offsetLeft - items[self.options.cloneLength].offsetLeft;
+ if (!self.flag.loop) {
+ altTransform += offset;
+ translateX(altTransform);
+ startingOffset += offset;
+ }
+ newIndex -= self.realItemCount;
+ self.itemIndex = newIndex + direction;
+ }
+ }
+ var newItem = items[newIndex];
+ var currentItem = items[self.itemIndex];
+ var displacement = currentItem.offsetLeft - newItem.offsetLeft; // CHECK
+ if (self.options.center)
+ displacement += (currentItem.offsetWidth - newItem.offsetWidth) / 2;
+ setTimeout(function() {
+ snapTo(displacement);
+ updateIndex(newIndex);
+ }, 0);
+ }
+
+ this.jumpToIndex = function(index) {
+ self.moveTo(self.itemIndex - index);
+ };
+
+ function momentum() {
+ if (self.flag.touched)
+ return;
+
+ self.flag.increment = false;
+
+ var translate = getTranslateX();
+ var distance = self.destinationOffset - translate;
+ var increment = distance - zeroFloor(distance / self.options.speed);
+
+ // Hacky -- this is for the desktop browser only -- to fix rounding errors
+ // Ideally, this is removed at compile time
+ if(Math.abs(increment) < 0.01)
+ increment = 0;
+
+ var newTransform = increment + translate;
+
+ translateX(newTransform);
+
+ if (increment != 0)
+ self.flag.increment = true;
+
+ if (self.flag.increment)
+ setTimeout(momentum, 16);
+ else {
+ startingOffset = null;
+ self.autoscrollStart();
+
+ var itemIndex = self.itemIndex;
+ x$(self.container).fire("slideend", {index: itemIndex});
+ }
+ }
+
+ function swipeDist() {
+ return endPos === undefined ? 0 : endPos.x - startPos.x;
+ }
+
+ function translateX(x) {
+ self.translate = x;
+ var items = self.items;
+ items.style.webkitTransform = items.style.msTransform = items.style.OTransform = items.style.MozTransform = items.style.transform = translatePrefix + x + "px, 0px" + translateSuffix;
+ }
+
+ function getTranslateX() {
+ return self.translate;
+ }
+
+ initialize();
+ }
+
+ // Private/Helper methods
+
+ function zeroCeil(num) {
+ return num <= 0 ? Math.floor(num) : Math.ceil(num);
+ }
+
+ function zeroFloor(num) {
+ return num >= 0 ? Math.floor(num) : Math.ceil(num);
+ }
+
+ function stifle(e) {
+ e.preventDefault();
+ e.stopPropagation();
+ }
+
+ // Private constructors
+ var ComponentConstructors = {
+ button: function(group, component, type) {
+ if (group["button"] === undefined)
+ group["button"] = {};
+
+ var type = component.getAttribute("data-ur-carousel-button-type");
+
+ // Declaration error
+ if (type === undefined)
+ Ur.error("malformed carousel button type on:" + component.outerHTML);
+
+ group["button"][type] = component;
+
+ // Maybe in the future I'll make it so any of the items can be the starting item
+ x$(component).attr("data-ur-state", type == "prev" ? "disabled" : "enabled");
+ }
+ };
+ function CarouselLoader(){}
+
+ CarouselLoader.prototype.initialize = function(fragment) {
+ var carousels = x$(fragment).findElements("carousel", ComponentConstructors);
+ Ur.Widgets["carousel"] = {};
+ for (var name in carousels) {
+ var carousel = carousels[name];
+ Ur.Widgets["carousel"][name] = new Carousel(carousel);
+ x$(carousel["set"]).attr("data-ur-state", "enabled");
+ }
+ }
+
+ return CarouselLoader;
+})();
diff --git a/lib/flex_table.js b/lib/deprecated/flex_table.js
similarity index 100%
rename from lib/flex_table.js
rename to lib/deprecated/flex_table.js
diff --git a/lib/font_resizer.js b/lib/deprecated/font_resizer.js
similarity index 77%
rename from lib/font_resizer.js
rename to lib/deprecated/font_resizer.js
index 1f4c421..90fee39 100644
--- a/lib/font_resizer.js
+++ b/lib/deprecated/font_resizer.js
@@ -1,38 +1,49 @@
/* Font Resizer
------------
- Font Resizer displays three components:
+ Font Resizer displays four components:
(1) a button which, when pressed, increases the font size of some
specified page elements
(2) a button which, when pressed, decreases the font size of some
specified page elements
(3) a label which reports the current font size of the aforementioned
page elements
+ (4) a button which, when pressed, resets the contents to the original
+ font size (optional component)
*/
Ur.QuickLoaders["font-resizer"] = (function() {
-
+
var labelText = "Text Size: ";
- var up = 1, down = -1;
+ var up = 1, down = -1, reset = 0;
+ var is_reset_enabled = "false";
function FontResizer(components) {
this.increase = components["increase"];
this.decrease = components["decrease"];
this.label = components["label"];
this.content = components["content"];
+ if (components["reset"]) {
+ this.reset_size = components["reset"];
+ is_reset_enabled = true;
+ }
this.initialize();
}
- FontResizer.prototype.initialize = function() {
+ FontResizer.prototype.initialize = function() {
var content = x$(this.content);
this.min = parseInt(content.attr("data-ur-font-resizer-min")) || 100;
this.max = parseInt(content.attr("data-ur-font-resizer-max")) || 200;
this.delta = parseInt(content.attr("data-ur-font-resizer-delta")) || 20;
this.size = parseInt(content.attr("data-ur-font-resizer-size")) || this.min;
+ this.original_size = this.size;
this.invert = content.attr("data-ur-font-resizer-invert") == "Bam!" ? true : false;
x$(this.increase).click(function (obj) { return function() { obj.change(up); }; }(this));
x$(this.decrease).click(function (obj) { return function() { obj.change(down); }; }(this));
-
+ if (is_reset_enabled) {
+ x$(this.reset_size).click(function (obj) { return function() { obj.change(reset); }; }(this));
+ }
+
if (this.invert) {
this.size = this.min;
this.controlSize = this.max;
@@ -40,7 +51,7 @@ Ur.QuickLoaders["font-resizer"] = (function() {
this.decrease.style["font-size"] = this.controlSize + "%";
this.label.style["font-size"] = this.controlSize + "%";
}
-
+
content[0].style["font-size"] = this.size + "%";
x$(this.label).inner(labelText + this.size + "%");
@@ -52,22 +63,26 @@ Ur.QuickLoaders["font-resizer"] = (function() {
this.size += direction * this.delta;
this.content.style["font-size"] = this.size + "%";
this.label.innerText = labelText + this.size + "%";
-
+
if (this.invert) {
this.controlSize += -direction * this.delta;
this.increase.style["font-size"] = this.controlSize + "%";
this.decrease.style["font-size"] = this.controlSize + "%";
this.label.style["font-size"] = this.controlSize + "%";
}
+ } else if (direction == reset) {
+ this.size = this.original_size;
+ this.content.style["font-size"] = this.size + "%";
+ this.label.innerText = labelText + this.size + "%";
}
}
function FontResizerLoader() {}
-
+
FontResizerLoader.prototype.initialize = function(fragment) {
var font_resizers = x$(fragment).findElements('font-resizer');
for (var name in font_resizers) new FontResizer(font_resizers[name]);
}
-
+
return FontResizerLoader;
})();
diff --git a/lib/geolocation.js b/lib/deprecated/geolocation.js
similarity index 93%
rename from lib/geolocation.js
rename to lib/deprecated/geolocation.js
index 90b992a..ba3c0c6 100644
--- a/lib/geolocation.js
+++ b/lib/deprecated/geolocation.js
@@ -6,9 +6,9 @@
* populate form fields
*
*/
-
+
Ur.QuickLoaders["geocode"] = (function() {
-
+
function Geocode(data) {
this.elements = data;
this.callback = x$(this.elements.set).attr("data-ur-callback")[0];
@@ -17,15 +17,15 @@ Ur.QuickLoaders["geocode"] = (function() {
UrGeocode = function(obj){return function(){obj.setup_callbacks();};}(this);
var s = document.createElement('script');
s.type = "text/javascript";
- s.src = "http://maps.googleapis.com/maps/api/js?sensor=true&callback=UrGeocode";
- x$('body').html('bottom', s);
+ s.src = "//maps.googleapis.com/maps/api/js?sensor=true&callback=UrGeocode";
+ x$('head')[0].appendChild(s);
}
-
+
var geocoder;
var geocodeObj;
var currentObj;
-
+
function selectHelper(elm, value) {
for (var i=0,j=elm.length; i
0){
var type = "src";
var att = "data-ur-ll-src";
- var loc = obj.getAttribute(att);
- }else if (obj.hasAttribute("data-ur-ll-href")){
+ var loc = x$(obj).attr(att)[0];
+ }else if (x$(obj).attr("data-ur-ll-href").length > 0){
var type = "href";
var att = "data-ur-ll-href";
var loc = obj.getAttribute();
diff --git a/lib/map.js b/lib/deprecated/map.js
similarity index 100%
rename from lib/map.js
rename to lib/deprecated/map.js
diff --git a/lib/select_buttons.js b/lib/deprecated/select_buttons.js
similarity index 100%
rename from lib/select_buttons.js
rename to lib/deprecated/select_buttons.js
diff --git a/lib/select_list.js b/lib/deprecated/select_list.js
similarity index 100%
rename from lib/select_list.js
rename to lib/deprecated/select_list.js
diff --git a/lib/swipe_toggle.js b/lib/deprecated/swipe_toggle.js
similarity index 100%
rename from lib/swipe_toggle.js
rename to lib/deprecated/swipe_toggle.js
diff --git a/lib/deprecated/tabs.js b/lib/deprecated/tabs.js
new file mode 100644
index 0000000..9055a3b
--- /dev/null
+++ b/lib/deprecated/tabs.js
@@ -0,0 +1,116 @@
+/* Tabs *
+ * * * * * *
+ * The tabs are like togglers with state. If one is opened, the others are closed
+ *
+ * Question: Can I assume order is preserved? Ill use IDs for now
+ */
+
+Ur.QuickLoaders['tabs'] = (function(){
+ function Tabs(data){
+ this.elements = data;
+ this.setup_callbacks();
+ }
+
+ Tabs.prototype.setup_callbacks = function() {
+ var default_tab = null;
+
+ for(var tab_id in this.elements["buttons"]) {
+
+ var button = this.elements["buttons"][tab_id];
+ var content = this.elements["contents"][tab_id];
+
+ if (default_tab === null) {
+ default_tab = tab_id;
+ }
+
+ if(content === undefined) {
+ Ur.error("no matching tab content for tab button");
+ return;
+ }
+
+ var state = x$(button).attr("data-ur-state")[0];
+ if(state !== undefined && state == "enabled") {
+ default_tab = -1;
+ }
+
+ var closeable = x$(this.elements["set"]).attr("data-ur-closeable")[0];
+ closeable = (closeable !== undefined && closeable == "true") ? true : false;
+ var self = this;
+ x$(button).on(
+ "click",
+ function(evt) {
+ var firstScrollTop = x$(evt.target).offset().top - window.pageYOffset;
+ var this_tab_id = x$(evt.currentTarget).attr("data-ur-tab-id")[0];
+
+ for(var tab_id in self.elements["buttons"]) {
+ var button = self.elements["buttons"][tab_id];
+ var content = self.elements["contents"][tab_id];
+
+ if (tab_id !== this_tab_id) {
+ x$(button).attr("data-ur-state","disabled");
+ x$(content).attr("data-ur-state","disabled");
+ }
+ else {
+ var new_state = "enabled";
+ if (closeable) {
+ var old_state = x$(button).attr("data-ur-state")[0];
+ old_state = (old_state === undefined) ? "disabled" : old_state;
+ new_state = (old_state == "enabled") ? "disabled" : "enabled";
+ }
+ x$(button).attr("data-ur-state", new_state);
+ x$(content).attr("data-ur-state", new_state);
+ }
+ }
+ var secondScrollTop = x$(evt.target).offset().top - window.pageYOffset;
+ if ( secondScrollTop <= 0 ) {
+ window.scrollBy(0, secondScrollTop - firstScrollTop);
+ }
+ }
+ );
+ }
+ }
+
+ var ComponentConstructors = {
+ "button" : function(group, component, type) {
+ if (group["buttons"] === undefined) {
+ group["buttons"] = {}
+ }
+
+ var tab_id = x$(component).attr("data-ur-tab-id")[0];
+ if (tab_id === undefined) {
+ Ur.error("tab defined without a tab-id");
+ return;
+ }
+
+ group["buttons"][tab_id] = component;
+ },
+ "content" : function(group, component, type) {
+ if (group["contents"] === undefined) {
+ group["contents"] = {}
+ }
+
+ var tab_id = x$(component).attr("data-ur-tab-id")[0];
+ if (tab_id === undefined) {
+ Ur.error("tab defined without a tab-id");
+ return;
+ }
+
+ group["contents"][tab_id] = component;
+ }
+ }
+
+ function TabsLoader(){
+ }
+
+ TabsLoader.prototype.initialize = function(fragment) {
+ var tabs = x$(fragment).findElements('tabs', ComponentConstructors);
+ Ur.Widgets["tabs"] = {};
+
+ for(var name in tabs){
+ var tab = tabs[name];
+ Ur.Widgets["tabs"][name] = new Tabs(tabs[name]);
+ }
+ }
+
+ return TabsLoader;
+})();
diff --git a/lib/deprecated/toggler.js b/lib/deprecated/toggler.js
new file mode 100644
index 0000000..b81f740
--- /dev/null
+++ b/lib/deprecated/toggler.js
@@ -0,0 +1,96 @@
+/* Toggler *
+* * * * * *
+* The toggler alternates the state of all the content elements bound to the
+* toggler button.
+*
+* If no initial state is provided, the default value 'disabled'
+* is set upon initialization.
+*/
+
+Ur.QuickLoaders['toggler'] = (function(){
+ function ToggleContentComponent (group, content_component) {
+ // This is a 'collection' of components
+ // -- if I see it again, I'll make this abstract
+ if(group["content"] === undefined) {
+ group["content"] = [];
+ }
+ group["content"].push(content_component);
+ }
+
+ function ToggleLoader(){
+ this.component_constructors = {
+ "content" : ToggleContentComponent
+ };
+ }
+
+ ToggleLoader.prototype.find = function(fragment){
+ var togglers = x$(fragment).findElements('toggler', this.component_constructors);
+ var self=this;
+
+ for(var toggler_id in togglers) {
+ var toggler = togglers[toggler_id];
+
+ if (toggler["button"] === undefined) {
+ Ur.error("no button found for toggler with id=" + toggler_id);
+ continue;
+ }
+
+ var toggler_state = x$(toggler["button"]).attr("data-ur-state")[0];
+ if(toggler_state === undefined) {
+ x$(toggler["button"]).attr("data-ur-state", 'disabled');
+ toggler_state = "disabled";
+ }
+
+ if (toggler["content"] === undefined) {
+ Ur.error("no content found for toggler with id=" + toggler_id);
+ continue;
+ }
+
+ // Make the content state match the button state
+ x$().iterate(
+ toggler["content"],
+ function(content) {
+ if (x$(content).attr("data-ur-state")[0] === undefined ) {
+ x$(content).attr("data-ur-state", toggler_state)
+ }
+ }
+ );
+
+ }
+
+ return togglers;
+ }
+
+ ToggleLoader.prototype.construct_button_callback = function(contents, set) {
+ var self = this;
+ return function(evt) {
+ var button = evt.currentTarget;
+ var current_state = x$(button).attr("data-ur-state")[0];
+ var new_state = current_state === "enabled" ? "disabled" : "enabled";
+
+ x$(button).attr("data-ur-state", new_state);
+ x$(set).attr("data-ur-state", new_state);
+
+ x$().iterate(
+ contents,
+ function(content){
+ var current_state = x$(content).attr("data-ur-state")[0];
+ var new_state = current_state === "enabled" ? "disabled" : "enabled";
+ x$(content).attr("data-ur-state", new_state);
+ }
+ );
+ }
+ }
+
+ ToggleLoader.prototype.initialize = function(fragment) {
+ var togglers = this.find(fragment);
+ for(var name in togglers){
+ var toggler = togglers[name];
+ // if (togglers)
+ x$(toggler["button"]).click(this.construct_button_callback(toggler["content"], toggler["set"]));
+ x$(toggler["set"]).attr("data-ur-state","enabled");
+ }
+ }
+
+ return ToggleLoader;
+ })();
diff --git a/lib/uranium_mixins.js b/lib/deprecated/uranium_mixins.js
similarity index 98%
rename from lib/uranium_mixins.js
rename to lib/deprecated/uranium_mixins.js
index 427311b..3876519 100644
--- a/lib/uranium_mixins.js
+++ b/lib/deprecated/uranium_mixins.js
@@ -17,11 +17,12 @@ if(typeof(Ur) == "undefined") {
}
},
initialize: function(event, fragment) {
+
var Loaders = (event.type == "DOMContentLoaded") ? Ur.QuickLoaders : Ur.WindowLoaders;
if(fragment === undefined) {
fragment = document.body;
}
-
+
for(var name in Loaders) {
var widget = new Loaders[name];
widget.initialize(fragment);
@@ -32,6 +33,7 @@ if(typeof(Ur) == "undefined") {
Ur._onLoad();
}
},
+ // When going to jQuery don't need these as jQuery wraps them
error: function(msg) {
console.error("Uranium: " + msg);
},
@@ -66,7 +68,7 @@ window.addEventListener("DOMContentLoaded", Ur.initialize, false);
// Now, you can re-initialize html fragments like so (After I refactor the widget initializers to search within fragments)
// x$(elem).on('click', Ur.Loaders['zoom-preview'].intialize(fragment));
-// or
+// or
// x$(elem).on('click', Ur.initialize(fragment));
var mixins = {
@@ -88,7 +90,7 @@ var mixins = {
offset: function(elm) {
if (elm == undefined)
elm = this[0];
-
+
var cumulative_top = 0, cumulative_left = 0;
while (elm.offsetParent) {
cumulative_top += elm.offsetTop;
@@ -97,7 +99,7 @@ var mixins = {
}
return {left: cumulative_left, top: cumulative_top};
},
-
+
// TODO: Make private:
findNextAncestor: function(elem, type) {
//check to make sure there's still a parent:
@@ -175,7 +177,7 @@ var mixins = {
//setup group
groups[my_set_id] = {};
}
-
+
groups[my_set_id]["set"] = my_ancestor;
}
diff --git a/lib/deprecated/zoom.js b/lib/deprecated/zoom.js
new file mode 100644
index 0000000..2c40142
--- /dev/null
+++ b/lib/deprecated/zoom.js
@@ -0,0 +1,326 @@
+/* Zoom *
+ * * * * * * *
+ * This is a zoom widget that zooms images to larger images
+ * within the same container and allows for basic panning
+ *
+ */
+
+Ur.WindowLoaders["zoom"] = (function() {
+
+ function Zoom(components) {
+ var self = this;
+
+ this.container = components["view_container"];
+ this.img = components["img"];
+ this.prescale = false;
+ this.width = this.height = 0;
+ this.bigWidth = this.bigHeight = 0;
+ this.canvasWidth = this.canvasHeight = 0;
+ this.ratio = 1;
+ this.state = "disabled";
+
+ // Optionally:
+ this.button = components["button"];
+ this.idler = components["loading"];
+
+ var $img = x$(this.img);
+ var $idler = x$(this.idler);
+ var $btn = x$(this.button);
+
+ var boundX, boundY;
+ var relX, relY;
+ var offsetX = 0, offsetY = 0;
+ var touchX = 0, touchY = 0;
+ var mouseDown = false; // only used on non-touch browsers
+ var mouseDrag = true;
+
+ loaded_imgs.push($img.attr("src")[0]);
+
+ function initialize() {
+ self.canvasWidth = self.canvasWidth || self.container.offsetWidth;
+ self.canvasHeight = self.canvasHeight || self.container.offsetHeight;
+ self.width = self.width || parseInt($img.attr("width")) || parseInt($img.getStyle("width")) || self.img.width;
+ self.height = self.height || parseInt($img.attr("height")) || parseInt($img.getStyle("height")) || self.img.height;
+
+ self.bigWidth = parseInt($img.attr("data-ur-width")) || self.img.naturalWidth;
+ self.bigHeight = parseInt($img.attr("data-ur-height")) || self.img.naturalHeight;
+ if (($img.attr("data-ur-width")[0] && $img.attr("data-ur-height")[0]) || $img.attr("src")[0] == $img.attr("data-ur-src")[0])
+ self.prescale = true;
+
+ self.ratio = self.bigWidth/self.width;
+
+ boundX = (self.canvasWidth - self.bigWidth)/2; // horizontal translation to view middle of image
+ boundY = (self.canvasHeight - self.bigHeight)/2; // vertical translation to view middle of image
+ }
+
+ function panStart(event) {
+ if (event.target != self.img)
+ return;
+ mouseDrag = false;
+ touchX = event.pageX;
+ touchY = event.pageY;
+ mouseDown = true;
+ if (event.touches) {
+ touchX = event.touches[0].pageX;
+ touchY = event.touches[0].pageY;
+ }
+
+ var style = self.img.style;
+ if (window.WebKitCSSMatrix) {
+ var matrix = new WebKitCSSMatrix(style.webkitTransform);
+ offsetX = matrix.m41;
+ offsetY = matrix.m42;
+ }
+ else {
+ var transform = style.MozTransform || style.OTransform || style.transform || "translate(0, 0)";
+ transform = transform.replace(/.*?\(|\)/, "").split(",");
+
+ offsetX = parseInt(transform[0]);
+ offsetY = parseInt(transform[1]);
+ }
+
+ stifle(event);
+ }
+
+ function panMove(event) {
+ if (!mouseDown || event.target != self.img) // NOTE: mouseDown should always be true on touch-enabled devices
+ return;
+
+ stifle(event);
+ var x = event.pageX;
+ var y = event.pageY;
+ if (event.touches) {
+ x = event.touches[0].pageX;
+ y = event.touches[0].pageY;
+ }
+ var dx = x - touchX;
+ var dy = y - touchY;
+ if (Math.abs(dx) > 5 || Math.abs(dy) > 5)
+ mouseDrag = true;
+ var new_offsetX = bound(offsetX + dx, [-boundX, boundX]);
+ var new_offsetY = bound(offsetY + dy, [-boundY, boundY]);
+ transform(new_offsetX, new_offsetY, self.ratio);
+ }
+
+ function panEnd(event) {
+ if (!mouseDrag)
+ self.zoomOut();
+ stifle(event);
+ mouseDown = false;
+ mouseDrag = true;
+ }
+
+ function transitionEnd() {
+ if (self.state == "enabled-in") {
+ $img.css({ webkitTransitionDelay: "", MozTransitionDelay: "", OTransitionDelay: "", transitionDelay: "" });
+
+ self.img.src = $img.attr("data-ur-src")[0];
+ if (loaded_imgs.indexOf(self.img.getAttribute("data-ur-src")) == -1) {
+ setTimeout(function() {
+ if (loaded_imgs.indexOf(self.img.getAttribute("data-ur-src")) == -1)
+ $idler.attr("data-ur-state", "enabled");
+ }, 16);
+ }
+ self.state = "enabled";
+ self.container.setAttribute("data-ur-state", self.state);
+
+ var touch = "ontouchstart" in window;
+ var $container = x$(self.container);
+ $container.on(touch ? "touchstart" : "mousedown", panStart);
+ $container.on(touch ? "touchmove" : "mousemove", panMove);
+ $container.on(touch ? "touchend" : "mouseup", panEnd);
+ }
+ else if (self.state == "enabled-out") {
+ self.state = "disabled";
+ self.container.setAttribute("data-ur-state", self.state);
+
+ var touch = "ontouchstart" in window;
+ var $container = x$(self.container);
+ $container.un(touch ? "touchstart" : "mousedown", panStart);
+ $container.un(touch ? "touchmove" : "mousemove", panMove);
+ $container.un(touch ? "touchend" : "mouseup", panEnd);
+ }
+ }
+
+ function zoomHelper(x, y) {
+ $btn.attr("data-ur-state", "enabled");
+ self.state = "enabled-in";
+ self.container.setAttribute("data-ur-state", self.state);
+
+ x = x ? x : 0;
+ y = y ? y : 0;
+ transform(x, y, self.ratio);
+ }
+
+ function transform(x, y, scale) {
+ var t = "";
+ if (x != undefined)
+ t = translatePrefix + x + "px, " + y + "px" + translateSuffix;
+ if (scale != undefined) {
+ if (noScale3d)
+ t += " scale(" + scale + ")";
+ else
+ t += " scale3d(" + scale + ", " + scale + ", 1)";
+ }
+ return $img.css({ webkitTransform: t, MozTransform: t, OTransform: t, transform: t });
+ }
+
+ // attempts to zoom in centering in on the area that was touched
+ this.zoomIn = function(event) {
+ if (self.state != "disabled")
+ return;
+
+ if (!self.width) {
+ initialize();
+ self.img.style.width = self.width + "px";
+ self.img.style.height = self.height + "px";
+ }
+
+ var x = event.pageX, y = event.pageY;
+ if (event.touches) {
+ x = event.touches[0].pageX;
+ y = event.touches[0].pageY;
+ }
+
+ // find touch location relative to image
+ relX = event.offsetX;
+ relY = event.offsetY;
+ if (relX == undefined || relY == undefined) {
+ var offset = self.img.getBoundingClientRect();
+ relX = x - offset.left;
+ relY = y - offset.top;
+ }
+
+ if (!self.prescale) {
+ self.state = "enabled-in";
+ self.img.src = $img.attr("data-ur-src")[0];
+ setTimeout(function() {
+ if (!self.prescale)
+ $idler.attr("data-ur-state", "enabled");
+ }, 0);
+ }
+ else {
+ var translateX = bound(self.bigWidth/2 - self.ratio * relX, [-boundX, boundX]);
+ var translateY = bound(self.bigHeight/2 - self.ratio * relY, [-boundY, boundY]);
+ zoomHelper(translateX, translateY);
+ }
+ };
+
+ this.zoomOut = function() {
+ if (self.state != "enabled")
+ return;
+ $btn.attr("data-ur-state", "disabled");
+ self.state = "enabled-out";
+ self.container.setAttribute("data-ur-state", self.state);
+ transform(0, 0, 1);
+ };
+
+ if (self.container.getAttribute("data-ur-touch") != "disabled")
+ x$(self.container).click(self.zoomIn);
+
+ $img.load(function() {
+ if ($img.attr("src")[0] == $img.attr("data-ur-src")[0])
+ loaded_imgs.push($img.attr("src")[0]);
+ $idler.attr("data-ur-state", "disabled");
+ if (!self.prescale && self.state == "enabled-in") {
+ self.prescale = true;
+ initialize();
+ var translateX = bound(self.bigWidth/2 - self.ratio * relX, [-boundX, boundX]);
+ var translateY = bound(self.bigHeight/2 - self.ratio * relY, [-boundY, boundY]);
+
+ var delay = "0.3s";
+ $img.css({ webkitTransitionDelay: delay, MozTransitionDelay: delay, OTransitionDelay: delay, transitionDelay: delay });
+
+ zoomHelper(translateX, translateY);
+ }
+ });
+
+ // zooms in to the center of the image
+ this.zoom = function() {
+ if (self.state == "disabled") {
+ if (!self.width) {
+ initialize();
+ self.img.style.width = self.width + "px";
+ self.img.style.height = self.height + "px";
+ }
+
+ if (self.prescale)
+ zoomHelper(0, 0);
+ else {
+ self.state = "enabled-in";
+ self.img.src = $img.attr("data-ur-src")[0];
+ setTimeout(function() {
+ // if prescale ?
+ if (loaded_imgs.indexOf(self.img.getAttribute("data-ur-src")) == -1)
+ $idler.attr("data-ur-state", "enabled");
+ }, 0);
+ }
+ }
+ else
+ self.zoomOut();
+ };
+
+ // zoom in/out button, zooms in to the center of the image
+ x$(self.button).click(self.zoom);
+
+ x$.fn.iterate(["webkitTransitionEnd", "transitionend", "oTransitionEnd"], function(eventName) {
+ $img.on(eventName, transitionEnd);
+ });
+
+ this.reset = function() {
+ self.prescale = false;
+ self.width = self.height = 0;
+ $img.css({width: "", height: ""});
+ transform();
+ self.state = "enabled-out";
+ transitionEnd();
+ $idler.attr("data-ur-state", "disabled");
+ $btn.attr("data-ur-state", "disabled");
+ };
+ }
+
+ // Private shared variables
+
+ var loaded_imgs = []; // sometimes the load event doesn't fire when the image src has been previously loaded
+
+ var no3d = /Android [12]|Opera/.test(navigator.userAgent);
+
+ var noTranslate3d = no3d;
+ var noScale3d = no3d;
+
+ var translatePrefix = noTranslate3d ? "translate(" : "translate3d(";
+ var translateSuffix = noTranslate3d ? ")" : ", 0)";
+
+ var scalePrefix = noScale3d ? " scale(" : " scale3d(";
+ var scaleSuffix = noScale3d ? ")" : ", 1)";
+
+
+ // Private shared methods
+
+ function bound(num, range) {
+ return Math.max(Math.min(range[0], num), range[1]);
+ }
+
+ function stifle(e) {
+ e.preventDefault();
+ e.stopPropagation();
+ }
+
+ // Private constructors
+ var ComponentConstructors = {
+
+ };
+
+ function ZoomLoader(){}
+
+ ZoomLoader.prototype.initialize = function(fragment) {
+ var zooms = x$(fragment).findElements("zoom", ComponentConstructors);
+ Ur.Widgets["zoom"] = {};
+ for (var name in zooms) {
+ var zoom = zooms[name];
+ Ur.Widgets["zoom"][name] = new Zoom(zoom);
+ }
+ }
+
+ return ZoomLoader;
+})();
diff --git a/lib/zoom_preview.js b/lib/deprecated/zoom_preview.js
similarity index 100%
rename from lib/zoom_preview.js
rename to lib/deprecated/zoom_preview.js
diff --git a/lib/external/jquery-1.9.1.js b/lib/external/jquery-1.9.1.js
new file mode 100644
index 0000000..e2c203f
--- /dev/null
+++ b/lib/external/jquery-1.9.1.js
@@ -0,0 +1,9597 @@
+/*!
+ * jQuery JavaScript Library v1.9.1
+ * http://jquery.com/
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ *
+ * Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors
+ * Released under the MIT license
+ * http://jquery.org/license
+ *
+ * Date: 2013-2-4
+ */
+(function( window, undefined ) {
+
+// Can't do this because several apps including ASP.NET trace
+// the stack via arguments.caller.callee and Firefox dies if
+// you try to trace through "use strict" call chains. (#13335)
+// Support: Firefox 18+
+//"use strict";
+var
+ // The deferred used on DOM ready
+ readyList,
+
+ // A central reference to the root jQuery(document)
+ rootjQuery,
+
+ // Support: IE<9
+ // For `typeof node.method` instead of `node.method !== undefined`
+ core_strundefined = typeof undefined,
+
+ // Use the correct document accordingly with window argument (sandbox)
+ document = window.document,
+ location = window.location,
+
+ // Map over jQuery in case of overwrite
+ _jQuery = window.jQuery,
+
+ // Map over the $ in case of overwrite
+ _$ = window.$,
+
+ // [[Class]] -> type pairs
+ class2type = {},
+
+ // List of deleted data cache ids, so we can reuse them
+ core_deletedIds = [],
+
+ core_version = "1.9.1",
+
+ // Save a reference to some core methods
+ core_concat = core_deletedIds.concat,
+ core_push = core_deletedIds.push,
+ core_slice = core_deletedIds.slice,
+ core_indexOf = core_deletedIds.indexOf,
+ core_toString = class2type.toString,
+ core_hasOwn = class2type.hasOwnProperty,
+ core_trim = core_version.trim,
+
+ // Define a local copy of jQuery
+ jQuery = function( selector, context ) {
+ // The jQuery object is actually just the init constructor 'enhanced'
+ return new jQuery.fn.init( selector, context, rootjQuery );
+ },
+
+ // Used for matching numbers
+ core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
+
+ // Used for splitting on whitespace
+ core_rnotwhite = /\S+/g,
+
+ // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
+ rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
+
+ // A simple way to check for HTML strings
+ // Prioritize #id over to avoid XSS via location.hash (#9521)
+ // Strict HTML recognition (#11290: must start with <)
+ rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,
+
+ // Match a standalone tag
+ rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
+
+ // JSON RegExp
+ rvalidchars = /^[\],:{}\s]*$/,
+ rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
+ rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
+ rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,
+
+ // Matches dashed string for camelizing
+ rmsPrefix = /^-ms-/,
+ rdashAlpha = /-([\da-z])/gi,
+
+ // Used by jQuery.camelCase as callback to replace()
+ fcamelCase = function( all, letter ) {
+ return letter.toUpperCase();
+ },
+
+ // The ready event handler
+ completed = function( event ) {
+
+ // readyState === "complete" is good enough for us to call the dom ready in oldIE
+ if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {
+ detach();
+ jQuery.ready();
+ }
+ },
+ // Clean-up method for dom ready events
+ detach = function() {
+ if ( document.addEventListener ) {
+ document.removeEventListener( "DOMContentLoaded", completed, false );
+ window.removeEventListener( "load", completed, false );
+
+ } else {
+ document.detachEvent( "onreadystatechange", completed );
+ window.detachEvent( "onload", completed );
+ }
+ };
+
+jQuery.fn = jQuery.prototype = {
+ // The current version of jQuery being used
+ jquery: core_version,
+
+ constructor: jQuery,
+ init: function( selector, context, rootjQuery ) {
+ var match, elem;
+
+ // HANDLE: $(""), $(null), $(undefined), $(false)
+ if ( !selector ) {
+ return this;
+ }
+
+ // Handle HTML strings
+ if ( typeof selector === "string" ) {
+ if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
+ // Assume that strings that start and end with <> are HTML and skip the regex check
+ match = [ null, selector, null ];
+
+ } else {
+ match = rquickExpr.exec( selector );
+ }
+
+ // Match html or make sure no context is specified for #id
+ if ( match && (match[1] || !context) ) {
+
+ // HANDLE: $(html) -> $(array)
+ if ( match[1] ) {
+ context = context instanceof jQuery ? context[0] : context;
+
+ // scripts is true for back-compat
+ jQuery.merge( this, jQuery.parseHTML(
+ match[1],
+ context && context.nodeType ? context.ownerDocument || context : document,
+ true
+ ) );
+
+ // HANDLE: $(html, props)
+ if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
+ for ( match in context ) {
+ // Properties of context are called as methods if possible
+ if ( jQuery.isFunction( this[ match ] ) ) {
+ this[ match ]( context[ match ] );
+
+ // ...and otherwise set as attributes
+ } else {
+ this.attr( match, context[ match ] );
+ }
+ }
+ }
+
+ return this;
+
+ // HANDLE: $(#id)
+ } else {
+ elem = document.getElementById( match[2] );
+
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ if ( elem && elem.parentNode ) {
+ // Handle the case where IE and Opera return items
+ // by name instead of ID
+ if ( elem.id !== match[2] ) {
+ return rootjQuery.find( selector );
+ }
+
+ // Otherwise, we inject the element directly into the jQuery object
+ this.length = 1;
+ this[0] = elem;
+ }
+
+ this.context = document;
+ this.selector = selector;
+ return this;
+ }
+
+ // HANDLE: $(expr, $(...))
+ } else if ( !context || context.jquery ) {
+ return ( context || rootjQuery ).find( selector );
+
+ // HANDLE: $(expr, context)
+ // (which is just equivalent to: $(context).find(expr)
+ } else {
+ return this.constructor( context ).find( selector );
+ }
+
+ // HANDLE: $(DOMElement)
+ } else if ( selector.nodeType ) {
+ this.context = this[0] = selector;
+ this.length = 1;
+ return this;
+
+ // HANDLE: $(function)
+ // Shortcut for document ready
+ } else if ( jQuery.isFunction( selector ) ) {
+ return rootjQuery.ready( selector );
+ }
+
+ if ( selector.selector !== undefined ) {
+ this.selector = selector.selector;
+ this.context = selector.context;
+ }
+
+ return jQuery.makeArray( selector, this );
+ },
+
+ // Start with an empty selector
+ selector: "",
+
+ // The default length of a jQuery object is 0
+ length: 0,
+
+ // The number of elements contained in the matched element set
+ size: function() {
+ return this.length;
+ },
+
+ toArray: function() {
+ return core_slice.call( this );
+ },
+
+ // Get the Nth element in the matched element set OR
+ // Get the whole matched element set as a clean array
+ get: function( num ) {
+ return num == null ?
+
+ // Return a 'clean' array
+ this.toArray() :
+
+ // Return just the object
+ ( num < 0 ? this[ this.length + num ] : this[ num ] );
+ },
+
+ // Take an array of elements and push it onto the stack
+ // (returning the new matched element set)
+ pushStack: function( elems ) {
+
+ // Build a new jQuery matched element set
+ var ret = jQuery.merge( this.constructor(), elems );
+
+ // Add the old object onto the stack (as a reference)
+ ret.prevObject = this;
+ ret.context = this.context;
+
+ // Return the newly-formed element set
+ return ret;
+ },
+
+ // Execute a callback for every element in the matched set.
+ // (You can seed the arguments with an array of args, but this is
+ // only used internally.)
+ each: function( callback, args ) {
+ return jQuery.each( this, callback, args );
+ },
+
+ ready: function( fn ) {
+ // Add the callback
+ jQuery.ready.promise().done( fn );
+
+ return this;
+ },
+
+ slice: function() {
+ return this.pushStack( core_slice.apply( this, arguments ) );
+ },
+
+ first: function() {
+ return this.eq( 0 );
+ },
+
+ last: function() {
+ return this.eq( -1 );
+ },
+
+ eq: function( i ) {
+ var len = this.length,
+ j = +i + ( i < 0 ? len : 0 );
+ return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
+ },
+
+ map: function( callback ) {
+ return this.pushStack( jQuery.map(this, function( elem, i ) {
+ return callback.call( elem, i, elem );
+ }));
+ },
+
+ end: function() {
+ return this.prevObject || this.constructor(null);
+ },
+
+ // For internal use only.
+ // Behaves like an Array's method, not like a jQuery method.
+ push: core_push,
+ sort: [].sort,
+ splice: [].splice
+};
+
+// Give the init function the jQuery prototype for later instantiation
+jQuery.fn.init.prototype = jQuery.fn;
+
+jQuery.extend = jQuery.fn.extend = function() {
+ var src, copyIsArray, copy, name, options, clone,
+ target = arguments[0] || {},
+ i = 1,
+ length = arguments.length,
+ deep = false;
+
+ // Handle a deep copy situation
+ if ( typeof target === "boolean" ) {
+ deep = target;
+ target = arguments[1] || {};
+ // skip the boolean and the target
+ i = 2;
+ }
+
+ // Handle case when target is a string or something (possible in deep copy)
+ if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
+ target = {};
+ }
+
+ // extend jQuery itself if only one argument is passed
+ if ( length === i ) {
+ target = this;
+ --i;
+ }
+
+ for ( ; i < length; i++ ) {
+ // Only deal with non-null/undefined values
+ if ( (options = arguments[ i ]) != null ) {
+ // Extend the base object
+ for ( name in options ) {
+ src = target[ name ];
+ copy = options[ name ];
+
+ // Prevent never-ending loop
+ if ( target === copy ) {
+ continue;
+ }
+
+ // Recurse if we're merging plain objects or arrays
+ if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
+ if ( copyIsArray ) {
+ copyIsArray = false;
+ clone = src && jQuery.isArray(src) ? src : [];
+
+ } else {
+ clone = src && jQuery.isPlainObject(src) ? src : {};
+ }
+
+ // Never move original objects, clone them
+ target[ name ] = jQuery.extend( deep, clone, copy );
+
+ // Don't bring in undefined values
+ } else if ( copy !== undefined ) {
+ target[ name ] = copy;
+ }
+ }
+ }
+ }
+
+ // Return the modified object
+ return target;
+};
+
+jQuery.extend({
+ noConflict: function( deep ) {
+ if ( window.$ === jQuery ) {
+ window.$ = _$;
+ }
+
+ if ( deep && window.jQuery === jQuery ) {
+ window.jQuery = _jQuery;
+ }
+
+ return jQuery;
+ },
+
+ // Is the DOM ready to be used? Set to true once it occurs.
+ isReady: false,
+
+ // A counter to track how many items to wait for before
+ // the ready event fires. See #6781
+ readyWait: 1,
+
+ // Hold (or release) the ready event
+ holdReady: function( hold ) {
+ if ( hold ) {
+ jQuery.readyWait++;
+ } else {
+ jQuery.ready( true );
+ }
+ },
+
+ // Handle when the DOM is ready
+ ready: function( wait ) {
+
+ // Abort if there are pending holds or we're already ready
+ if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
+ return;
+ }
+
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
+ if ( !document.body ) {
+ return setTimeout( jQuery.ready );
+ }
+
+ // Remember that the DOM is ready
+ jQuery.isReady = true;
+
+ // If a normal DOM Ready event fired, decrement, and wait if need be
+ if ( wait !== true && --jQuery.readyWait > 0 ) {
+ return;
+ }
+
+ // If there are functions bound, to execute
+ readyList.resolveWith( document, [ jQuery ] );
+
+ // Trigger any bound ready events
+ if ( jQuery.fn.trigger ) {
+ jQuery( document ).trigger("ready").off("ready");
+ }
+ },
+
+ // See test/unit/core.js for details concerning isFunction.
+ // Since version 1.3, DOM methods and functions like alert
+ // aren't supported. They return false on IE (#2968).
+ isFunction: function( obj ) {
+ return jQuery.type(obj) === "function";
+ },
+
+ isArray: Array.isArray || function( obj ) {
+ return jQuery.type(obj) === "array";
+ },
+
+ isWindow: function( obj ) {
+ return obj != null && obj == obj.window;
+ },
+
+ isNumeric: function( obj ) {
+ return !isNaN( parseFloat(obj) ) && isFinite( obj );
+ },
+
+ type: function( obj ) {
+ if ( obj == null ) {
+ return String( obj );
+ }
+ return typeof obj === "object" || typeof obj === "function" ?
+ class2type[ core_toString.call(obj) ] || "object" :
+ typeof obj;
+ },
+
+ isPlainObject: function( obj ) {
+ // Must be an Object.
+ // Because of IE, we also have to check the presence of the constructor property.
+ // Make sure that DOM nodes and window objects don't pass through, as well
+ if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
+ return false;
+ }
+
+ try {
+ // Not own constructor property must be Object
+ if ( obj.constructor &&
+ !core_hasOwn.call(obj, "constructor") &&
+ !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
+ return false;
+ }
+ } catch ( e ) {
+ // IE8,9 Will throw exceptions on certain host objects #9897
+ return false;
+ }
+
+ // Own properties are enumerated firstly, so to speed up,
+ // if last one is own, then all properties are own.
+
+ var key;
+ for ( key in obj ) {}
+
+ return key === undefined || core_hasOwn.call( obj, key );
+ },
+
+ isEmptyObject: function( obj ) {
+ var name;
+ for ( name in obj ) {
+ return false;
+ }
+ return true;
+ },
+
+ error: function( msg ) {
+ throw new Error( msg );
+ },
+
+ // data: string of html
+ // context (optional): If specified, the fragment will be created in this context, defaults to document
+ // keepScripts (optional): If true, will include scripts passed in the html string
+ parseHTML: function( data, context, keepScripts ) {
+ if ( !data || typeof data !== "string" ) {
+ return null;
+ }
+ if ( typeof context === "boolean" ) {
+ keepScripts = context;
+ context = false;
+ }
+ context = context || document;
+
+ var parsed = rsingleTag.exec( data ),
+ scripts = !keepScripts && [];
+
+ // Single tag
+ if ( parsed ) {
+ return [ context.createElement( parsed[1] ) ];
+ }
+
+ parsed = jQuery.buildFragment( [ data ], context, scripts );
+ if ( scripts ) {
+ jQuery( scripts ).remove();
+ }
+ return jQuery.merge( [], parsed.childNodes );
+ },
+
+ parseJSON: function( data ) {
+ // Attempt to parse using the native JSON parser first
+ if ( window.JSON && window.JSON.parse ) {
+ return window.JSON.parse( data );
+ }
+
+ if ( data === null ) {
+ return data;
+ }
+
+ if ( typeof data === "string" ) {
+
+ // Make sure leading/trailing whitespace is removed (IE can't handle it)
+ data = jQuery.trim( data );
+
+ if ( data ) {
+ // Make sure the incoming data is actual JSON
+ // Logic borrowed from http://json.org/json2.js
+ if ( rvalidchars.test( data.replace( rvalidescape, "@" )
+ .replace( rvalidtokens, "]" )
+ .replace( rvalidbraces, "")) ) {
+
+ return ( new Function( "return " + data ) )();
+ }
+ }
+ }
+
+ jQuery.error( "Invalid JSON: " + data );
+ },
+
+ // Cross-browser xml parsing
+ parseXML: function( data ) {
+ var xml, tmp;
+ if ( !data || typeof data !== "string" ) {
+ return null;
+ }
+ try {
+ if ( window.DOMParser ) { // Standard
+ tmp = new DOMParser();
+ xml = tmp.parseFromString( data , "text/xml" );
+ } else { // IE
+ xml = new ActiveXObject( "Microsoft.XMLDOM" );
+ xml.async = "false";
+ xml.loadXML( data );
+ }
+ } catch( e ) {
+ xml = undefined;
+ }
+ if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
+ jQuery.error( "Invalid XML: " + data );
+ }
+ return xml;
+ },
+
+ noop: function() {},
+
+ // Evaluates a script in a global context
+ // Workarounds based on findings by Jim Driscoll
+ // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
+ globalEval: function( data ) {
+ if ( data && jQuery.trim( data ) ) {
+ // We use execScript on Internet Explorer
+ // We use an anonymous function so that context is window
+ // rather than jQuery in Firefox
+ ( window.execScript || function( data ) {
+ window[ "eval" ].call( window, data );
+ } )( data );
+ }
+ },
+
+ // Convert dashed to camelCase; used by the css and data modules
+ // Microsoft forgot to hump their vendor prefix (#9572)
+ camelCase: function( string ) {
+ return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
+ },
+
+ nodeName: function( elem, name ) {
+ return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
+ },
+
+ // args is for internal usage only
+ each: function( obj, callback, args ) {
+ var value,
+ i = 0,
+ length = obj.length,
+ isArray = isArraylike( obj );
+
+ if ( args ) {
+ if ( isArray ) {
+ for ( ; i < length; i++ ) {
+ value = callback.apply( obj[ i ], args );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( i in obj ) {
+ value = callback.apply( obj[ i ], args );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ }
+
+ // A special, fast, case for the most common use of each
+ } else {
+ if ( isArray ) {
+ for ( ; i < length; i++ ) {
+ value = callback.call( obj[ i ], i, obj[ i ] );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( i in obj ) {
+ value = callback.call( obj[ i ], i, obj[ i ] );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ }
+ }
+
+ return obj;
+ },
+
+ // Use native String.trim function wherever possible
+ trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
+ function( text ) {
+ return text == null ?
+ "" :
+ core_trim.call( text );
+ } :
+
+ // Otherwise use our own trimming functionality
+ function( text ) {
+ return text == null ?
+ "" :
+ ( text + "" ).replace( rtrim, "" );
+ },
+
+ // results is for internal usage only
+ makeArray: function( arr, results ) {
+ var ret = results || [];
+
+ if ( arr != null ) {
+ if ( isArraylike( Object(arr) ) ) {
+ jQuery.merge( ret,
+ typeof arr === "string" ?
+ [ arr ] : arr
+ );
+ } else {
+ core_push.call( ret, arr );
+ }
+ }
+
+ return ret;
+ },
+
+ inArray: function( elem, arr, i ) {
+ var len;
+
+ if ( arr ) {
+ if ( core_indexOf ) {
+ return core_indexOf.call( arr, elem, i );
+ }
+
+ len = arr.length;
+ i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
+
+ for ( ; i < len; i++ ) {
+ // Skip accessing in sparse arrays
+ if ( i in arr && arr[ i ] === elem ) {
+ return i;
+ }
+ }
+ }
+
+ return -1;
+ },
+
+ merge: function( first, second ) {
+ var l = second.length,
+ i = first.length,
+ j = 0;
+
+ if ( typeof l === "number" ) {
+ for ( ; j < l; j++ ) {
+ first[ i++ ] = second[ j ];
+ }
+ } else {
+ while ( second[j] !== undefined ) {
+ first[ i++ ] = second[ j++ ];
+ }
+ }
+
+ first.length = i;
+
+ return first;
+ },
+
+ grep: function( elems, callback, inv ) {
+ var retVal,
+ ret = [],
+ i = 0,
+ length = elems.length;
+ inv = !!inv;
+
+ // Go through the array, only saving the items
+ // that pass the validator function
+ for ( ; i < length; i++ ) {
+ retVal = !!callback( elems[ i ], i );
+ if ( inv !== retVal ) {
+ ret.push( elems[ i ] );
+ }
+ }
+
+ return ret;
+ },
+
+ // arg is for internal usage only
+ map: function( elems, callback, arg ) {
+ var value,
+ i = 0,
+ length = elems.length,
+ isArray = isArraylike( elems ),
+ ret = [];
+
+ // Go through the array, translating each of the items to their
+ if ( isArray ) {
+ for ( ; i < length; i++ ) {
+ value = callback( elems[ i ], i, arg );
+
+ if ( value != null ) {
+ ret[ ret.length ] = value;
+ }
+ }
+
+ // Go through every key on the object,
+ } else {
+ for ( i in elems ) {
+ value = callback( elems[ i ], i, arg );
+
+ if ( value != null ) {
+ ret[ ret.length ] = value;
+ }
+ }
+ }
+
+ // Flatten any nested arrays
+ return core_concat.apply( [], ret );
+ },
+
+ // A global GUID counter for objects
+ guid: 1,
+
+ // Bind a function to a context, optionally partially applying any
+ // arguments.
+ proxy: function( fn, context ) {
+ var args, proxy, tmp;
+
+ if ( typeof context === "string" ) {
+ tmp = fn[ context ];
+ context = fn;
+ fn = tmp;
+ }
+
+ // Quick check to determine if target is callable, in the spec
+ // this throws a TypeError, but we will just return undefined.
+ if ( !jQuery.isFunction( fn ) ) {
+ return undefined;
+ }
+
+ // Simulated bind
+ args = core_slice.call( arguments, 2 );
+ proxy = function() {
+ return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) );
+ };
+
+ // Set the guid of unique handler to the same of original handler, so it can be removed
+ proxy.guid = fn.guid = fn.guid || jQuery.guid++;
+
+ return proxy;
+ },
+
+ // Multifunctional method to get and set values of a collection
+ // The value/s can optionally be executed if it's a function
+ access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
+ var i = 0,
+ length = elems.length,
+ bulk = key == null;
+
+ // Sets many values
+ if ( jQuery.type( key ) === "object" ) {
+ chainable = true;
+ for ( i in key ) {
+ jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
+ }
+
+ // Sets one value
+ } else if ( value !== undefined ) {
+ chainable = true;
+
+ if ( !jQuery.isFunction( value ) ) {
+ raw = true;
+ }
+
+ if ( bulk ) {
+ // Bulk operations run against the entire set
+ if ( raw ) {
+ fn.call( elems, value );
+ fn = null;
+
+ // ...except when executing function values
+ } else {
+ bulk = fn;
+ fn = function( elem, key, value ) {
+ return bulk.call( jQuery( elem ), value );
+ };
+ }
+ }
+
+ if ( fn ) {
+ for ( ; i < length; i++ ) {
+ fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
+ }
+ }
+ }
+
+ return chainable ?
+ elems :
+
+ // Gets
+ bulk ?
+ fn.call( elems ) :
+ length ? fn( elems[0], key ) : emptyGet;
+ },
+
+ now: function() {
+ return ( new Date() ).getTime();
+ }
+});
+
+jQuery.ready.promise = function( obj ) {
+ if ( !readyList ) {
+
+ readyList = jQuery.Deferred();
+
+ // Catch cases where $(document).ready() is called after the browser event has already occurred.
+ // we once tried to use readyState "interactive" here, but it caused issues like the one
+ // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
+ if ( document.readyState === "complete" ) {
+ // Handle it asynchronously to allow scripts the opportunity to delay ready
+ setTimeout( jQuery.ready );
+
+ // Standards-based browsers support DOMContentLoaded
+ } else if ( document.addEventListener ) {
+ // Use the handy event callback
+ document.addEventListener( "DOMContentLoaded", completed, false );
+
+ // A fallback to window.onload, that will always work
+ window.addEventListener( "load", completed, false );
+
+ // If IE event model is used
+ } else {
+ // Ensure firing before onload, maybe late but safe also for iframes
+ document.attachEvent( "onreadystatechange", completed );
+
+ // A fallback to window.onload, that will always work
+ window.attachEvent( "onload", completed );
+
+ // If IE and not a frame
+ // continually check to see if the document is ready
+ var top = false;
+
+ try {
+ top = window.frameElement == null && document.documentElement;
+ } catch(e) {}
+
+ if ( top && top.doScroll ) {
+ (function doScrollCheck() {
+ if ( !jQuery.isReady ) {
+
+ try {
+ // Use the trick by Diego Perini
+ // http://javascript.nwbox.com/IEContentLoaded/
+ top.doScroll("left");
+ } catch(e) {
+ return setTimeout( doScrollCheck, 50 );
+ }
+
+ // detach all dom ready events
+ detach();
+
+ // and execute any waiting functions
+ jQuery.ready();
+ }
+ })();
+ }
+ }
+ }
+ return readyList.promise( obj );
+};
+
+// Populate the class2type map
+jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
+ class2type[ "[object " + name + "]" ] = name.toLowerCase();
+});
+
+function isArraylike( obj ) {
+ var length = obj.length,
+ type = jQuery.type( obj );
+
+ if ( jQuery.isWindow( obj ) ) {
+ return false;
+ }
+
+ if ( obj.nodeType === 1 && length ) {
+ return true;
+ }
+
+ return type === "array" || type !== "function" &&
+ ( length === 0 ||
+ typeof length === "number" && length > 0 && ( length - 1 ) in obj );
+}
+
+// All jQuery objects should point back to these
+rootjQuery = jQuery(document);
+// String to Object options format cache
+var optionsCache = {};
+
+// Convert String-formatted options into Object-formatted ones and store in cache
+function createOptions( options ) {
+ var object = optionsCache[ options ] = {};
+ jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {
+ object[ flag ] = true;
+ });
+ return object;
+}
+
+/*
+ * Create a callback list using the following parameters:
+ *
+ * options: an optional list of space-separated options that will change how
+ * the callback list behaves or a more traditional option object
+ *
+ * By default a callback list will act like an event callback list and can be
+ * "fired" multiple times.
+ *
+ * Possible options:
+ *
+ * once: will ensure the callback list can only be fired once (like a Deferred)
+ *
+ * memory: will keep track of previous values and will call any callback added
+ * after the list has been fired right away with the latest "memorized"
+ * values (like a Deferred)
+ *
+ * unique: will ensure a callback can only be added once (no duplicate in the list)
+ *
+ * stopOnFalse: interrupt callings when a callback returns false
+ *
+ */
+jQuery.Callbacks = function( options ) {
+
+ // Convert options from String-formatted to Object-formatted if needed
+ // (we check in cache first)
+ options = typeof options === "string" ?
+ ( optionsCache[ options ] || createOptions( options ) ) :
+ jQuery.extend( {}, options );
+
+ var // Flag to know if list is currently firing
+ firing,
+ // Last fire value (for non-forgettable lists)
+ memory,
+ // Flag to know if list was already fired
+ fired,
+ // End of the loop when firing
+ firingLength,
+ // Index of currently firing callback (modified by remove if needed)
+ firingIndex,
+ // First callback to fire (used internally by add and fireWith)
+ firingStart,
+ // Actual callback list
+ list = [],
+ // Stack of fire calls for repeatable lists
+ stack = !options.once && [],
+ // Fire callbacks
+ fire = function( data ) {
+ memory = options.memory && data;
+ fired = true;
+ firingIndex = firingStart || 0;
+ firingStart = 0;
+ firingLength = list.length;
+ firing = true;
+ for ( ; list && firingIndex < firingLength; firingIndex++ ) {
+ if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
+ memory = false; // To prevent further calls using add
+ break;
+ }
+ }
+ firing = false;
+ if ( list ) {
+ if ( stack ) {
+ if ( stack.length ) {
+ fire( stack.shift() );
+ }
+ } else if ( memory ) {
+ list = [];
+ } else {
+ self.disable();
+ }
+ }
+ },
+ // Actual Callbacks object
+ self = {
+ // Add a callback or a collection of callbacks to the list
+ add: function() {
+ if ( list ) {
+ // First, we save the current length
+ var start = list.length;
+ (function add( args ) {
+ jQuery.each( args, function( _, arg ) {
+ var type = jQuery.type( arg );
+ if ( type === "function" ) {
+ if ( !options.unique || !self.has( arg ) ) {
+ list.push( arg );
+ }
+ } else if ( arg && arg.length && type !== "string" ) {
+ // Inspect recursively
+ add( arg );
+ }
+ });
+ })( arguments );
+ // Do we need to add the callbacks to the
+ // current firing batch?
+ if ( firing ) {
+ firingLength = list.length;
+ // With memory, if we're not firing then
+ // we should call right away
+ } else if ( memory ) {
+ firingStart = start;
+ fire( memory );
+ }
+ }
+ return this;
+ },
+ // Remove a callback from the list
+ remove: function() {
+ if ( list ) {
+ jQuery.each( arguments, function( _, arg ) {
+ var index;
+ while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
+ list.splice( index, 1 );
+ // Handle firing indexes
+ if ( firing ) {
+ if ( index <= firingLength ) {
+ firingLength--;
+ }
+ if ( index <= firingIndex ) {
+ firingIndex--;
+ }
+ }
+ }
+ });
+ }
+ return this;
+ },
+ // Check if a given callback is in the list.
+ // If no argument is given, return whether or not list has callbacks attached.
+ has: function( fn ) {
+ return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
+ },
+ // Remove all callbacks from the list
+ empty: function() {
+ list = [];
+ return this;
+ },
+ // Have the list do nothing anymore
+ disable: function() {
+ list = stack = memory = undefined;
+ return this;
+ },
+ // Is it disabled?
+ disabled: function() {
+ return !list;
+ },
+ // Lock the list in its current state
+ lock: function() {
+ stack = undefined;
+ if ( !memory ) {
+ self.disable();
+ }
+ return this;
+ },
+ // Is it locked?
+ locked: function() {
+ return !stack;
+ },
+ // Call all callbacks with the given context and arguments
+ fireWith: function( context, args ) {
+ args = args || [];
+ args = [ context, args.slice ? args.slice() : args ];
+ if ( list && ( !fired || stack ) ) {
+ if ( firing ) {
+ stack.push( args );
+ } else {
+ fire( args );
+ }
+ }
+ return this;
+ },
+ // Call all the callbacks with the given arguments
+ fire: function() {
+ self.fireWith( this, arguments );
+ return this;
+ },
+ // To know if the callbacks have already been called at least once
+ fired: function() {
+ return !!fired;
+ }
+ };
+
+ return self;
+};
+jQuery.extend({
+
+ Deferred: function( func ) {
+ var tuples = [
+ // action, add listener, listener list, final state
+ [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
+ [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
+ [ "notify", "progress", jQuery.Callbacks("memory") ]
+ ],
+ state = "pending",
+ promise = {
+ state: function() {
+ return state;
+ },
+ always: function() {
+ deferred.done( arguments ).fail( arguments );
+ return this;
+ },
+ then: function( /* fnDone, fnFail, fnProgress */ ) {
+ var fns = arguments;
+ return jQuery.Deferred(function( newDefer ) {
+ jQuery.each( tuples, function( i, tuple ) {
+ var action = tuple[ 0 ],
+ fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
+ // deferred[ done | fail | progress ] for forwarding actions to newDefer
+ deferred[ tuple[1] ](function() {
+ var returned = fn && fn.apply( this, arguments );
+ if ( returned && jQuery.isFunction( returned.promise ) ) {
+ returned.promise()
+ .done( newDefer.resolve )
+ .fail( newDefer.reject )
+ .progress( newDefer.notify );
+ } else {
+ newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
+ }
+ });
+ });
+ fns = null;
+ }).promise();
+ },
+ // Get a promise for this deferred
+ // If obj is provided, the promise aspect is added to the object
+ promise: function( obj ) {
+ return obj != null ? jQuery.extend( obj, promise ) : promise;
+ }
+ },
+ deferred = {};
+
+ // Keep pipe for back-compat
+ promise.pipe = promise.then;
+
+ // Add list-specific methods
+ jQuery.each( tuples, function( i, tuple ) {
+ var list = tuple[ 2 ],
+ stateString = tuple[ 3 ];
+
+ // promise[ done | fail | progress ] = list.add
+ promise[ tuple[1] ] = list.add;
+
+ // Handle state
+ if ( stateString ) {
+ list.add(function() {
+ // state = [ resolved | rejected ]
+ state = stateString;
+
+ // [ reject_list | resolve_list ].disable; progress_list.lock
+ }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
+ }
+
+ // deferred[ resolve | reject | notify ]
+ deferred[ tuple[0] ] = function() {
+ deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
+ return this;
+ };
+ deferred[ tuple[0] + "With" ] = list.fireWith;
+ });
+
+ // Make the deferred a promise
+ promise.promise( deferred );
+
+ // Call given func if any
+ if ( func ) {
+ func.call( deferred, deferred );
+ }
+
+ // All done!
+ return deferred;
+ },
+
+ // Deferred helper
+ when: function( subordinate /* , ..., subordinateN */ ) {
+ var i = 0,
+ resolveValues = core_slice.call( arguments ),
+ length = resolveValues.length,
+
+ // the count of uncompleted subordinates
+ remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
+
+ // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
+ deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
+
+ // Update function for both resolve and progress values
+ updateFunc = function( i, contexts, values ) {
+ return function( value ) {
+ contexts[ i ] = this;
+ values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
+ if( values === progressValues ) {
+ deferred.notifyWith( contexts, values );
+ } else if ( !( --remaining ) ) {
+ deferred.resolveWith( contexts, values );
+ }
+ };
+ },
+
+ progressValues, progressContexts, resolveContexts;
+
+ // add listeners to Deferred subordinates; treat others as resolved
+ if ( length > 1 ) {
+ progressValues = new Array( length );
+ progressContexts = new Array( length );
+ resolveContexts = new Array( length );
+ for ( ; i < length; i++ ) {
+ if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
+ resolveValues[ i ].promise()
+ .done( updateFunc( i, resolveContexts, resolveValues ) )
+ .fail( deferred.reject )
+ .progress( updateFunc( i, progressContexts, progressValues ) );
+ } else {
+ --remaining;
+ }
+ }
+ }
+
+ // if we're not waiting on anything, resolve the master
+ if ( !remaining ) {
+ deferred.resolveWith( resolveContexts, resolveValues );
+ }
+
+ return deferred.promise();
+ }
+});
+jQuery.support = (function() {
+
+ var support, all, a,
+ input, select, fragment,
+ opt, eventName, isSupported, i,
+ div = document.createElement("div");
+
+ // Setup
+ div.setAttribute( "className", "t" );
+ div.innerHTML = " a ";
+
+ // Support tests won't run in some limited or non-browser environments
+ all = div.getElementsByTagName("*");
+ a = div.getElementsByTagName("a")[ 0 ];
+ if ( !all || !a || !all.length ) {
+ return {};
+ }
+
+ // First batch of tests
+ select = document.createElement("select");
+ opt = select.appendChild( document.createElement("option") );
+ input = div.getElementsByTagName("input")[ 0 ];
+
+ a.style.cssText = "top:1px;float:left;opacity:.5";
+ support = {
+ // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
+ getSetAttribute: div.className !== "t",
+
+ // IE strips leading whitespace when .innerHTML is used
+ leadingWhitespace: div.firstChild.nodeType === 3,
+
+ // Make sure that tbody elements aren't automatically inserted
+ // IE will insert them into empty tables
+ tbody: !div.getElementsByTagName("tbody").length,
+
+ // Make sure that link elements get serialized correctly by innerHTML
+ // This requires a wrapper element in IE
+ htmlSerialize: !!div.getElementsByTagName("link").length,
+
+ // Get the style information from getAttribute
+ // (IE uses .cssText instead)
+ style: /top/.test( a.getAttribute("style") ),
+
+ // Make sure that URLs aren't manipulated
+ // (IE normalizes it by default)
+ hrefNormalized: a.getAttribute("href") === "/a",
+
+ // Make sure that element opacity exists
+ // (IE uses filter instead)
+ // Use a regex to work around a WebKit issue. See #5145
+ opacity: /^0.5/.test( a.style.opacity ),
+
+ // Verify style float existence
+ // (IE uses styleFloat instead of cssFloat)
+ cssFloat: !!a.style.cssFloat,
+
+ // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
+ checkOn: !!input.value,
+
+ // Make sure that a selected-by-default option has a working selected property.
+ // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
+ optSelected: opt.selected,
+
+ // Tests for enctype support on a form (#6743)
+ enctype: !!document.createElement("form").enctype,
+
+ // Makes sure cloning an html5 element does not cause problems
+ // Where outerHTML is undefined, this still works
+ html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>",
+
+ // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
+ boxModel: document.compatMode === "CSS1Compat",
+
+ // Will be defined later
+ deleteExpando: true,
+ noCloneEvent: true,
+ inlineBlockNeedsLayout: false,
+ shrinkWrapBlocks: false,
+ reliableMarginRight: true,
+ boxSizingReliable: true,
+ pixelPosition: false
+ };
+
+ // Make sure checked status is properly cloned
+ input.checked = true;
+ support.noCloneChecked = input.cloneNode( true ).checked;
+
+ // Make sure that the options inside disabled selects aren't marked as disabled
+ // (WebKit marks them as disabled)
+ select.disabled = true;
+ support.optDisabled = !opt.disabled;
+
+ // Support: IE<9
+ try {
+ delete div.test;
+ } catch( e ) {
+ support.deleteExpando = false;
+ }
+
+ // Check if we can trust getAttribute("value")
+ input = document.createElement("input");
+ input.setAttribute( "value", "" );
+ support.input = input.getAttribute( "value" ) === "";
+
+ // Check if an input maintains its value after becoming a radio
+ input.value = "t";
+ input.setAttribute( "type", "radio" );
+ support.radioValue = input.value === "t";
+
+ // #11217 - WebKit loses check when the name is after the checked attribute
+ input.setAttribute( "checked", "t" );
+ input.setAttribute( "name", "t" );
+
+ fragment = document.createDocumentFragment();
+ fragment.appendChild( input );
+
+ // Check if a disconnected checkbox will retain its checked
+ // value of true after appended to the DOM (IE6/7)
+ support.appendChecked = input.checked;
+
+ // WebKit doesn't clone checked state correctly in fragments
+ support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
+
+ // Support: IE<9
+ // Opera does not clone events (and typeof div.attachEvent === undefined).
+ // IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
+ if ( div.attachEvent ) {
+ div.attachEvent( "onclick", function() {
+ support.noCloneEvent = false;
+ });
+
+ div.cloneNode( true ).click();
+ }
+
+ // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
+ // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP), test/csp.php
+ for ( i in { submit: true, change: true, focusin: true }) {
+ div.setAttribute( eventName = "on" + i, "t" );
+
+ support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
+ }
+
+ div.style.backgroundClip = "content-box";
+ div.cloneNode( true ).style.backgroundClip = "";
+ support.clearCloneStyle = div.style.backgroundClip === "content-box";
+
+ // Run tests that need a body at doc ready
+ jQuery(function() {
+ var container, marginDiv, tds,
+ divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
+ body = document.getElementsByTagName("body")[0];
+
+ if ( !body ) {
+ // Return for frameset docs that don't have a body
+ return;
+ }
+
+ container = document.createElement("div");
+ container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
+
+ body.appendChild( container ).appendChild( div );
+
+ // Support: IE8
+ // Check if table cells still have offsetWidth/Height when they are set
+ // to display:none and there are still other visible table cells in a
+ // table row; if so, offsetWidth/Height are not reliable for use when
+ // determining if an element has been hidden directly using
+ // display:none (it is still safe to use offsets if a parent element is
+ // hidden; don safety goggles and see bug #4512 for more information).
+ div.innerHTML = "";
+ tds = div.getElementsByTagName("td");
+ tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
+ isSupported = ( tds[ 0 ].offsetHeight === 0 );
+
+ tds[ 0 ].style.display = "";
+ tds[ 1 ].style.display = "none";
+
+ // Support: IE8
+ // Check if empty table cells still have offsetWidth/Height
+ support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
+
+ // Check box-sizing and margin behavior
+ div.innerHTML = "";
+ div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
+ support.boxSizing = ( div.offsetWidth === 4 );
+ support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );
+
+ // Use window.getComputedStyle because jsdom on node.js will break without it.
+ if ( window.getComputedStyle ) {
+ support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
+ support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
+
+ // Check if div with explicit width and no margin-right incorrectly
+ // gets computed margin-right based on width of container. (#3333)
+ // Fails in WebKit before Feb 2011 nightlies
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+ marginDiv = div.appendChild( document.createElement("div") );
+ marginDiv.style.cssText = div.style.cssText = divReset;
+ marginDiv.style.marginRight = marginDiv.style.width = "0";
+ div.style.width = "1px";
+
+ support.reliableMarginRight =
+ !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
+ }
+
+ if ( typeof div.style.zoom !== core_strundefined ) {
+ // Support: IE<8
+ // Check if natively block-level elements act like inline-block
+ // elements when setting their display to 'inline' and giving
+ // them layout
+ div.innerHTML = "";
+ div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
+ support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
+
+ // Support: IE6
+ // Check if elements with layout shrink-wrap their children
+ div.style.display = "block";
+ div.innerHTML = "
";
+ div.firstChild.style.width = "5px";
+ support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
+
+ if ( support.inlineBlockNeedsLayout ) {
+ // Prevent IE 6 from affecting layout for positioned elements #11048
+ // Prevent IE from shrinking the body in IE 7 mode #12869
+ // Support: IE<8
+ body.style.zoom = 1;
+ }
+ }
+
+ body.removeChild( container );
+
+ // Null elements to avoid leaks in IE
+ container = div = tds = marginDiv = null;
+ });
+
+ // Null elements to avoid leaks in IE
+ all = select = fragment = opt = a = input = null;
+
+ return support;
+})();
+
+var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
+ rmultiDash = /([A-Z])/g;
+
+function internalData( elem, name, data, pvt /* Internal Use Only */ ){
+ if ( !jQuery.acceptData( elem ) ) {
+ return;
+ }
+
+ var thisCache, ret,
+ internalKey = jQuery.expando,
+ getByName = typeof name === "string",
+
+ // We have to handle DOM nodes and JS objects differently because IE6-7
+ // can't GC object references properly across the DOM-JS boundary
+ isNode = elem.nodeType,
+
+ // Only DOM nodes need the global jQuery cache; JS object data is
+ // attached directly to the object so GC can occur automatically
+ cache = isNode ? jQuery.cache : elem,
+
+ // Only defining an ID for JS objects if its cache already exists allows
+ // the code to shortcut on the same path as a DOM node with no cache
+ id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
+
+ // Avoid doing any more work than we need to when trying to get data on an
+ // object that has no data at all
+ if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {
+ return;
+ }
+
+ if ( !id ) {
+ // Only DOM nodes need a new unique ID for each element since their data
+ // ends up in the global cache
+ if ( isNode ) {
+ elem[ internalKey ] = id = core_deletedIds.pop() || jQuery.guid++;
+ } else {
+ id = internalKey;
+ }
+ }
+
+ if ( !cache[ id ] ) {
+ cache[ id ] = {};
+
+ // Avoids exposing jQuery metadata on plain JS objects when the object
+ // is serialized using JSON.stringify
+ if ( !isNode ) {
+ cache[ id ].toJSON = jQuery.noop;
+ }
+ }
+
+ // An object can be passed to jQuery.data instead of a key/value pair; this gets
+ // shallow copied over onto the existing cache
+ if ( typeof name === "object" || typeof name === "function" ) {
+ if ( pvt ) {
+ cache[ id ] = jQuery.extend( cache[ id ], name );
+ } else {
+ cache[ id ].data = jQuery.extend( cache[ id ].data, name );
+ }
+ }
+
+ thisCache = cache[ id ];
+
+ // jQuery data() is stored in a separate object inside the object's internal data
+ // cache in order to avoid key collisions between internal data and user-defined
+ // data.
+ if ( !pvt ) {
+ if ( !thisCache.data ) {
+ thisCache.data = {};
+ }
+
+ thisCache = thisCache.data;
+ }
+
+ if ( data !== undefined ) {
+ thisCache[ jQuery.camelCase( name ) ] = data;
+ }
+
+ // Check for both converted-to-camel and non-converted data property names
+ // If a data property was specified
+ if ( getByName ) {
+
+ // First Try to find as-is property data
+ ret = thisCache[ name ];
+
+ // Test for null|undefined property data
+ if ( ret == null ) {
+
+ // Try to find the camelCased property
+ ret = thisCache[ jQuery.camelCase( name ) ];
+ }
+ } else {
+ ret = thisCache;
+ }
+
+ return ret;
+}
+
+function internalRemoveData( elem, name, pvt ) {
+ if ( !jQuery.acceptData( elem ) ) {
+ return;
+ }
+
+ var i, l, thisCache,
+ isNode = elem.nodeType,
+
+ // See jQuery.data for more information
+ cache = isNode ? jQuery.cache : elem,
+ id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
+
+ // If there is already no cache entry for this object, there is no
+ // purpose in continuing
+ if ( !cache[ id ] ) {
+ return;
+ }
+
+ if ( name ) {
+
+ thisCache = pvt ? cache[ id ] : cache[ id ].data;
+
+ if ( thisCache ) {
+
+ // Support array or space separated string names for data keys
+ if ( !jQuery.isArray( name ) ) {
+
+ // try the string as a key before any manipulation
+ if ( name in thisCache ) {
+ name = [ name ];
+ } else {
+
+ // split the camel cased version by spaces unless a key with the spaces exists
+ name = jQuery.camelCase( name );
+ if ( name in thisCache ) {
+ name = [ name ];
+ } else {
+ name = name.split(" ");
+ }
+ }
+ } else {
+ // If "name" is an array of keys...
+ // When data is initially created, via ("key", "val") signature,
+ // keys will be converted to camelCase.
+ // Since there is no way to tell _how_ a key was added, remove
+ // both plain key and camelCase key. #12786
+ // This will only penalize the array argument path.
+ name = name.concat( jQuery.map( name, jQuery.camelCase ) );
+ }
+
+ for ( i = 0, l = name.length; i < l; i++ ) {
+ delete thisCache[ name[i] ];
+ }
+
+ // If there is no data left in the cache, we want to continue
+ // and let the cache object itself get destroyed
+ if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
+ return;
+ }
+ }
+ }
+
+ // See jQuery.data for more information
+ if ( !pvt ) {
+ delete cache[ id ].data;
+
+ // Don't destroy the parent cache unless the internal data object
+ // had been the only thing left in it
+ if ( !isEmptyDataObject( cache[ id ] ) ) {
+ return;
+ }
+ }
+
+ // Destroy the cache
+ if ( isNode ) {
+ jQuery.cleanData( [ elem ], true );
+
+ // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
+ } else if ( jQuery.support.deleteExpando || cache != cache.window ) {
+ delete cache[ id ];
+
+ // When all else fails, null
+ } else {
+ cache[ id ] = null;
+ }
+}
+
+jQuery.extend({
+ cache: {},
+
+ // Unique for each copy of jQuery on the page
+ // Non-digits removed to match rinlinejQuery
+ expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ),
+
+ // The following elements throw uncatchable exceptions if you
+ // attempt to add expando properties to them.
+ noData: {
+ "embed": true,
+ // Ban all objects except for Flash (which handle expandos)
+ "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
+ "applet": true
+ },
+
+ hasData: function( elem ) {
+ elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
+ return !!elem && !isEmptyDataObject( elem );
+ },
+
+ data: function( elem, name, data ) {
+ return internalData( elem, name, data );
+ },
+
+ removeData: function( elem, name ) {
+ return internalRemoveData( elem, name );
+ },
+
+ // For internal use only.
+ _data: function( elem, name, data ) {
+ return internalData( elem, name, data, true );
+ },
+
+ _removeData: function( elem, name ) {
+ return internalRemoveData( elem, name, true );
+ },
+
+ // A method for determining if a DOM node can handle the data expando
+ acceptData: function( elem ) {
+ // Do not set data on non-element because it will not be cleared (#8335).
+ if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) {
+ return false;
+ }
+
+ var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
+
+ // nodes accept data unless otherwise specified; rejection can be conditional
+ return !noData || noData !== true && elem.getAttribute("classid") === noData;
+ }
+});
+
+jQuery.fn.extend({
+ data: function( key, value ) {
+ var attrs, name,
+ elem = this[0],
+ i = 0,
+ data = null;
+
+ // Gets all values
+ if ( key === undefined ) {
+ if ( this.length ) {
+ data = jQuery.data( elem );
+
+ if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
+ attrs = elem.attributes;
+ for ( ; i < attrs.length; i++ ) {
+ name = attrs[i].name;
+
+ if ( !name.indexOf( "data-" ) ) {
+ name = jQuery.camelCase( name.slice(5) );
+
+ dataAttr( elem, name, data[ name ] );
+ }
+ }
+ jQuery._data( elem, "parsedAttrs", true );
+ }
+ }
+
+ return data;
+ }
+
+ // Sets multiple values
+ if ( typeof key === "object" ) {
+ return this.each(function() {
+ jQuery.data( this, key );
+ });
+ }
+
+ return jQuery.access( this, function( value ) {
+
+ if ( value === undefined ) {
+ // Try to fetch any internally stored data first
+ return elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null;
+ }
+
+ this.each(function() {
+ jQuery.data( this, key, value );
+ });
+ }, null, value, arguments.length > 1, null, true );
+ },
+
+ removeData: function( key ) {
+ return this.each(function() {
+ jQuery.removeData( this, key );
+ });
+ }
+});
+
+function dataAttr( elem, key, data ) {
+ // If nothing was found internally, try to fetch any
+ // data from the HTML5 data-* attribute
+ if ( data === undefined && elem.nodeType === 1 ) {
+
+ var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
+
+ data = elem.getAttribute( name );
+
+ if ( typeof data === "string" ) {
+ try {
+ data = data === "true" ? true :
+ data === "false" ? false :
+ data === "null" ? null :
+ // Only convert to a number if it doesn't change the string
+ +data + "" === data ? +data :
+ rbrace.test( data ) ? jQuery.parseJSON( data ) :
+ data;
+ } catch( e ) {}
+
+ // Make sure we set the data so it isn't changed later
+ jQuery.data( elem, key, data );
+
+ } else {
+ data = undefined;
+ }
+ }
+
+ return data;
+}
+
+// checks a cache object for emptiness
+function isEmptyDataObject( obj ) {
+ var name;
+ for ( name in obj ) {
+
+ // if the public data object is empty, the private is still empty
+ if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
+ continue;
+ }
+ if ( name !== "toJSON" ) {
+ return false;
+ }
+ }
+
+ return true;
+}
+jQuery.extend({
+ queue: function( elem, type, data ) {
+ var queue;
+
+ if ( elem ) {
+ type = ( type || "fx" ) + "queue";
+ queue = jQuery._data( elem, type );
+
+ // Speed up dequeue by getting out quickly if this is just a lookup
+ if ( data ) {
+ if ( !queue || jQuery.isArray(data) ) {
+ queue = jQuery._data( elem, type, jQuery.makeArray(data) );
+ } else {
+ queue.push( data );
+ }
+ }
+ return queue || [];
+ }
+ },
+
+ dequeue: function( elem, type ) {
+ type = type || "fx";
+
+ var queue = jQuery.queue( elem, type ),
+ startLength = queue.length,
+ fn = queue.shift(),
+ hooks = jQuery._queueHooks( elem, type ),
+ next = function() {
+ jQuery.dequeue( elem, type );
+ };
+
+ // If the fx queue is dequeued, always remove the progress sentinel
+ if ( fn === "inprogress" ) {
+ fn = queue.shift();
+ startLength--;
+ }
+
+ hooks.cur = fn;
+ if ( fn ) {
+
+ // Add a progress sentinel to prevent the fx queue from being
+ // automatically dequeued
+ if ( type === "fx" ) {
+ queue.unshift( "inprogress" );
+ }
+
+ // clear up the last queue stop function
+ delete hooks.stop;
+ fn.call( elem, next, hooks );
+ }
+
+ if ( !startLength && hooks ) {
+ hooks.empty.fire();
+ }
+ },
+
+ // not intended for public consumption - generates a queueHooks object, or returns the current one
+ _queueHooks: function( elem, type ) {
+ var key = type + "queueHooks";
+ return jQuery._data( elem, key ) || jQuery._data( elem, key, {
+ empty: jQuery.Callbacks("once memory").add(function() {
+ jQuery._removeData( elem, type + "queue" );
+ jQuery._removeData( elem, key );
+ })
+ });
+ }
+});
+
+jQuery.fn.extend({
+ queue: function( type, data ) {
+ var setter = 2;
+
+ if ( typeof type !== "string" ) {
+ data = type;
+ type = "fx";
+ setter--;
+ }
+
+ if ( arguments.length < setter ) {
+ return jQuery.queue( this[0], type );
+ }
+
+ return data === undefined ?
+ this :
+ this.each(function() {
+ var queue = jQuery.queue( this, type, data );
+
+ // ensure a hooks for this queue
+ jQuery._queueHooks( this, type );
+
+ if ( type === "fx" && queue[0] !== "inprogress" ) {
+ jQuery.dequeue( this, type );
+ }
+ });
+ },
+ dequeue: function( type ) {
+ return this.each(function() {
+ jQuery.dequeue( this, type );
+ });
+ },
+ // Based off of the plugin by Clint Helfers, with permission.
+ // http://blindsignals.com/index.php/2009/07/jquery-delay/
+ delay: function( time, type ) {
+ time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
+ type = type || "fx";
+
+ return this.queue( type, function( next, hooks ) {
+ var timeout = setTimeout( next, time );
+ hooks.stop = function() {
+ clearTimeout( timeout );
+ };
+ });
+ },
+ clearQueue: function( type ) {
+ return this.queue( type || "fx", [] );
+ },
+ // Get a promise resolved when queues of a certain type
+ // are emptied (fx is the type by default)
+ promise: function( type, obj ) {
+ var tmp,
+ count = 1,
+ defer = jQuery.Deferred(),
+ elements = this,
+ i = this.length,
+ resolve = function() {
+ if ( !( --count ) ) {
+ defer.resolveWith( elements, [ elements ] );
+ }
+ };
+
+ if ( typeof type !== "string" ) {
+ obj = type;
+ type = undefined;
+ }
+ type = type || "fx";
+
+ while( i-- ) {
+ tmp = jQuery._data( elements[ i ], type + "queueHooks" );
+ if ( tmp && tmp.empty ) {
+ count++;
+ tmp.empty.add( resolve );
+ }
+ }
+ resolve();
+ return defer.promise( obj );
+ }
+});
+var nodeHook, boolHook,
+ rclass = /[\t\r\n]/g,
+ rreturn = /\r/g,
+ rfocusable = /^(?:input|select|textarea|button|object)$/i,
+ rclickable = /^(?:a|area)$/i,
+ rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,
+ ruseDefault = /^(?:checked|selected)$/i,
+ getSetAttribute = jQuery.support.getSetAttribute,
+ getSetInput = jQuery.support.input;
+
+jQuery.fn.extend({
+ attr: function( name, value ) {
+ return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
+ },
+
+ removeAttr: function( name ) {
+ return this.each(function() {
+ jQuery.removeAttr( this, name );
+ });
+ },
+
+ prop: function( name, value ) {
+ return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
+ },
+
+ removeProp: function( name ) {
+ name = jQuery.propFix[ name ] || name;
+ return this.each(function() {
+ // try/catch handles cases where IE balks (such as removing a property on window)
+ try {
+ this[ name ] = undefined;
+ delete this[ name ];
+ } catch( e ) {}
+ });
+ },
+
+ addClass: function( value ) {
+ var classes, elem, cur, clazz, j,
+ i = 0,
+ len = this.length,
+ proceed = typeof value === "string" && value;
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( j ) {
+ jQuery( this ).addClass( value.call( this, j, this.className ) );
+ });
+ }
+
+ if ( proceed ) {
+ // The disjunction here is for better compressibility (see removeClass)
+ classes = ( value || "" ).match( core_rnotwhite ) || [];
+
+ for ( ; i < len; i++ ) {
+ elem = this[ i ];
+ cur = elem.nodeType === 1 && ( elem.className ?
+ ( " " + elem.className + " " ).replace( rclass, " " ) :
+ " "
+ );
+
+ if ( cur ) {
+ j = 0;
+ while ( (clazz = classes[j++]) ) {
+ if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
+ cur += clazz + " ";
+ }
+ }
+ elem.className = jQuery.trim( cur );
+
+ }
+ }
+ }
+
+ return this;
+ },
+
+ removeClass: function( value ) {
+ var classes, elem, cur, clazz, j,
+ i = 0,
+ len = this.length,
+ proceed = arguments.length === 0 || typeof value === "string" && value;
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( j ) {
+ jQuery( this ).removeClass( value.call( this, j, this.className ) );
+ });
+ }
+ if ( proceed ) {
+ classes = ( value || "" ).match( core_rnotwhite ) || [];
+
+ for ( ; i < len; i++ ) {
+ elem = this[ i ];
+ // This expression is here for better compressibility (see addClass)
+ cur = elem.nodeType === 1 && ( elem.className ?
+ ( " " + elem.className + " " ).replace( rclass, " " ) :
+ ""
+ );
+
+ if ( cur ) {
+ j = 0;
+ while ( (clazz = classes[j++]) ) {
+ // Remove *all* instances
+ while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
+ cur = cur.replace( " " + clazz + " ", " " );
+ }
+ }
+ elem.className = value ? jQuery.trim( cur ) : "";
+ }
+ }
+ }
+
+ return this;
+ },
+
+ toggleClass: function( value, stateVal ) {
+ var type = typeof value,
+ isBool = typeof stateVal === "boolean";
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( i ) {
+ jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
+ });
+ }
+
+ return this.each(function() {
+ if ( type === "string" ) {
+ // toggle individual class names
+ var className,
+ i = 0,
+ self = jQuery( this ),
+ state = stateVal,
+ classNames = value.match( core_rnotwhite ) || [];
+
+ while ( (className = classNames[ i++ ]) ) {
+ // check each className given, space separated list
+ state = isBool ? state : !self.hasClass( className );
+ self[ state ? "addClass" : "removeClass" ]( className );
+ }
+
+ // Toggle whole class name
+ } else if ( type === core_strundefined || type === "boolean" ) {
+ if ( this.className ) {
+ // store className if set
+ jQuery._data( this, "__className__", this.className );
+ }
+
+ // If the element has a class name or if we're passed "false",
+ // then remove the whole classname (if there was one, the above saved it).
+ // Otherwise bring back whatever was previously saved (if anything),
+ // falling back to the empty string if nothing was stored.
+ this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
+ }
+ });
+ },
+
+ hasClass: function( selector ) {
+ var className = " " + selector + " ",
+ i = 0,
+ l = this.length;
+ for ( ; i < l; i++ ) {
+ if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
+ return true;
+ }
+ }
+
+ return false;
+ },
+
+ val: function( value ) {
+ var ret, hooks, isFunction,
+ elem = this[0];
+
+ if ( !arguments.length ) {
+ if ( elem ) {
+ hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
+
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
+ return ret;
+ }
+
+ ret = elem.value;
+
+ return typeof ret === "string" ?
+ // handle most common string cases
+ ret.replace(rreturn, "") :
+ // handle cases where value is null/undef or number
+ ret == null ? "" : ret;
+ }
+
+ return;
+ }
+
+ isFunction = jQuery.isFunction( value );
+
+ return this.each(function( i ) {
+ var val,
+ self = jQuery(this);
+
+ if ( this.nodeType !== 1 ) {
+ return;
+ }
+
+ if ( isFunction ) {
+ val = value.call( this, i, self.val() );
+ } else {
+ val = value;
+ }
+
+ // Treat null/undefined as ""; convert numbers to string
+ if ( val == null ) {
+ val = "";
+ } else if ( typeof val === "number" ) {
+ val += "";
+ } else if ( jQuery.isArray( val ) ) {
+ val = jQuery.map(val, function ( value ) {
+ return value == null ? "" : value + "";
+ });
+ }
+
+ hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
+
+ // If set returns undefined, fall back to normal setting
+ if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
+ this.value = val;
+ }
+ });
+ }
+});
+
+jQuery.extend({
+ valHooks: {
+ option: {
+ get: function( elem ) {
+ // attributes.value is undefined in Blackberry 4.7 but
+ // uses .value. See #6932
+ var val = elem.attributes.value;
+ return !val || val.specified ? elem.value : elem.text;
+ }
+ },
+ select: {
+ get: function( elem ) {
+ var value, option,
+ options = elem.options,
+ index = elem.selectedIndex,
+ one = elem.type === "select-one" || index < 0,
+ values = one ? null : [],
+ max = one ? index + 1 : options.length,
+ i = index < 0 ?
+ max :
+ one ? index : 0;
+
+ // Loop through all the selected options
+ for ( ; i < max; i++ ) {
+ option = options[ i ];
+
+ // oldIE doesn't update selected after form reset (#2551)
+ if ( ( option.selected || i === index ) &&
+ // Don't return options that are disabled or in a disabled optgroup
+ ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
+ ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
+
+ // Get the specific value for the option
+ value = jQuery( option ).val();
+
+ // We don't need an array for one selects
+ if ( one ) {
+ return value;
+ }
+
+ // Multi-Selects return an array
+ values.push( value );
+ }
+ }
+
+ return values;
+ },
+
+ set: function( elem, value ) {
+ var values = jQuery.makeArray( value );
+
+ jQuery(elem).find("option").each(function() {
+ this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
+ });
+
+ if ( !values.length ) {
+ elem.selectedIndex = -1;
+ }
+ return values;
+ }
+ }
+ },
+
+ attr: function( elem, name, value ) {
+ var hooks, notxml, ret,
+ nType = elem.nodeType;
+
+ // don't get/set attributes on text, comment and attribute nodes
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+ return;
+ }
+
+ // Fallback to prop when attributes are not supported
+ if ( typeof elem.getAttribute === core_strundefined ) {
+ return jQuery.prop( elem, name, value );
+ }
+
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
+
+ // All attributes are lowercase
+ // Grab necessary hook if one is defined
+ if ( notxml ) {
+ name = name.toLowerCase();
+ hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
+ }
+
+ if ( value !== undefined ) {
+
+ if ( value === null ) {
+ jQuery.removeAttr( elem, name );
+
+ } else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
+ return ret;
+
+ } else {
+ elem.setAttribute( name, value + "" );
+ return value;
+ }
+
+ } else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
+ return ret;
+
+ } else {
+
+ // In IE9+, Flash objects don't have .getAttribute (#12945)
+ // Support: IE9+
+ if ( typeof elem.getAttribute !== core_strundefined ) {
+ ret = elem.getAttribute( name );
+ }
+
+ // Non-existent attributes return null, we normalize to undefined
+ return ret == null ?
+ undefined :
+ ret;
+ }
+ },
+
+ removeAttr: function( elem, value ) {
+ var name, propName,
+ i = 0,
+ attrNames = value && value.match( core_rnotwhite );
+
+ if ( attrNames && elem.nodeType === 1 ) {
+ while ( (name = attrNames[i++]) ) {
+ propName = jQuery.propFix[ name ] || name;
+
+ // Boolean attributes get special treatment (#10870)
+ if ( rboolean.test( name ) ) {
+ // Set corresponding property to false for boolean attributes
+ // Also clear defaultChecked/defaultSelected (if appropriate) for IE<8
+ if ( !getSetAttribute && ruseDefault.test( name ) ) {
+ elem[ jQuery.camelCase( "default-" + name ) ] =
+ elem[ propName ] = false;
+ } else {
+ elem[ propName ] = false;
+ }
+
+ // See #9699 for explanation of this approach (setting first, then removal)
+ } else {
+ jQuery.attr( elem, name, "" );
+ }
+
+ elem.removeAttribute( getSetAttribute ? name : propName );
+ }
+ }
+ },
+
+ attrHooks: {
+ type: {
+ set: function( elem, value ) {
+ if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
+ // Setting the type on a radio button after the value resets the value in IE6-9
+ // Reset value to default in case type is set after value during creation
+ var val = elem.value;
+ elem.setAttribute( "type", value );
+ if ( val ) {
+ elem.value = val;
+ }
+ return value;
+ }
+ }
+ }
+ },
+
+ propFix: {
+ tabindex: "tabIndex",
+ readonly: "readOnly",
+ "for": "htmlFor",
+ "class": "className",
+ maxlength: "maxLength",
+ cellspacing: "cellSpacing",
+ cellpadding: "cellPadding",
+ rowspan: "rowSpan",
+ colspan: "colSpan",
+ usemap: "useMap",
+ frameborder: "frameBorder",
+ contenteditable: "contentEditable"
+ },
+
+ prop: function( elem, name, value ) {
+ var ret, hooks, notxml,
+ nType = elem.nodeType;
+
+ // don't get/set properties on text, comment and attribute nodes
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+ return;
+ }
+
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
+
+ if ( notxml ) {
+ // Fix name and attach hooks
+ name = jQuery.propFix[ name ] || name;
+ hooks = jQuery.propHooks[ name ];
+ }
+
+ if ( value !== undefined ) {
+ if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
+ return ret;
+
+ } else {
+ return ( elem[ name ] = value );
+ }
+
+ } else {
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
+ return ret;
+
+ } else {
+ return elem[ name ];
+ }
+ }
+ },
+
+ propHooks: {
+ tabIndex: {
+ get: function( elem ) {
+ // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
+ // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
+ var attributeNode = elem.getAttributeNode("tabindex");
+
+ return attributeNode && attributeNode.specified ?
+ parseInt( attributeNode.value, 10 ) :
+ rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
+ 0 :
+ undefined;
+ }
+ }
+ }
+});
+
+// Hook for boolean attributes
+boolHook = {
+ get: function( elem, name ) {
+ var
+ // Use .prop to determine if this attribute is understood as boolean
+ prop = jQuery.prop( elem, name ),
+
+ // Fetch it accordingly
+ attr = typeof prop === "boolean" && elem.getAttribute( name ),
+ detail = typeof prop === "boolean" ?
+
+ getSetInput && getSetAttribute ?
+ attr != null :
+ // oldIE fabricates an empty string for missing boolean attributes
+ // and conflates checked/selected into attroperties
+ ruseDefault.test( name ) ?
+ elem[ jQuery.camelCase( "default-" + name ) ] :
+ !!attr :
+
+ // fetch an attribute node for properties not recognized as boolean
+ elem.getAttributeNode( name );
+
+ return detail && detail.value !== false ?
+ name.toLowerCase() :
+ undefined;
+ },
+ set: function( elem, value, name ) {
+ if ( value === false ) {
+ // Remove boolean attributes when set to false
+ jQuery.removeAttr( elem, name );
+ } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
+ // IE<8 needs the *property* name
+ elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
+
+ // Use defaultChecked and defaultSelected for oldIE
+ } else {
+ elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
+ }
+
+ return name;
+ }
+};
+
+// fix oldIE value attroperty
+if ( !getSetInput || !getSetAttribute ) {
+ jQuery.attrHooks.value = {
+ get: function( elem, name ) {
+ var ret = elem.getAttributeNode( name );
+ return jQuery.nodeName( elem, "input" ) ?
+
+ // Ignore the value *property* by using defaultValue
+ elem.defaultValue :
+
+ ret && ret.specified ? ret.value : undefined;
+ },
+ set: function( elem, value, name ) {
+ if ( jQuery.nodeName( elem, "input" ) ) {
+ // Does not return so that setAttribute is also used
+ elem.defaultValue = value;
+ } else {
+ // Use nodeHook if defined (#1954); otherwise setAttribute is fine
+ return nodeHook && nodeHook.set( elem, value, name );
+ }
+ }
+ };
+}
+
+// IE6/7 do not support getting/setting some attributes with get/setAttribute
+if ( !getSetAttribute ) {
+
+ // Use this for any attribute in IE6/7
+ // This fixes almost every IE6/7 issue
+ nodeHook = jQuery.valHooks.button = {
+ get: function( elem, name ) {
+ var ret = elem.getAttributeNode( name );
+ return ret && ( name === "id" || name === "name" || name === "coords" ? ret.value !== "" : ret.specified ) ?
+ ret.value :
+ undefined;
+ },
+ set: function( elem, value, name ) {
+ // Set the existing or create a new attribute node
+ var ret = elem.getAttributeNode( name );
+ if ( !ret ) {
+ elem.setAttributeNode(
+ (ret = elem.ownerDocument.createAttribute( name ))
+ );
+ }
+
+ ret.value = value += "";
+
+ // Break association with cloned elements by also using setAttribute (#9646)
+ return name === "value" || value === elem.getAttribute( name ) ?
+ value :
+ undefined;
+ }
+ };
+
+ // Set contenteditable to false on removals(#10429)
+ // Setting to empty string throws an error as an invalid value
+ jQuery.attrHooks.contenteditable = {
+ get: nodeHook.get,
+ set: function( elem, value, name ) {
+ nodeHook.set( elem, value === "" ? false : value, name );
+ }
+ };
+
+ // Set width and height to auto instead of 0 on empty string( Bug #8150 )
+ // This is for removals
+ jQuery.each([ "width", "height" ], function( i, name ) {
+ jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
+ set: function( elem, value ) {
+ if ( value === "" ) {
+ elem.setAttribute( name, "auto" );
+ return value;
+ }
+ }
+ });
+ });
+}
+
+
+// Some attributes require a special call on IE
+// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
+if ( !jQuery.support.hrefNormalized ) {
+ jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
+ jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
+ get: function( elem ) {
+ var ret = elem.getAttribute( name, 2 );
+ return ret == null ? undefined : ret;
+ }
+ });
+ });
+
+ // href/src property should get the full normalized URL (#10299/#12915)
+ jQuery.each([ "href", "src" ], function( i, name ) {
+ jQuery.propHooks[ name ] = {
+ get: function( elem ) {
+ return elem.getAttribute( name, 4 );
+ }
+ };
+ });
+}
+
+if ( !jQuery.support.style ) {
+ jQuery.attrHooks.style = {
+ get: function( elem ) {
+ // Return undefined in the case of empty string
+ // Note: IE uppercases css property names, but if we were to .toLowerCase()
+ // .cssText, that would destroy case senstitivity in URL's, like in "background"
+ return elem.style.cssText || undefined;
+ },
+ set: function( elem, value ) {
+ return ( elem.style.cssText = value + "" );
+ }
+ };
+}
+
+// Safari mis-reports the default selected property of an option
+// Accessing the parent's selectedIndex property fixes it
+if ( !jQuery.support.optSelected ) {
+ jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
+ get: function( elem ) {
+ var parent = elem.parentNode;
+
+ if ( parent ) {
+ parent.selectedIndex;
+
+ // Make sure that it also works with optgroups, see #5701
+ if ( parent.parentNode ) {
+ parent.parentNode.selectedIndex;
+ }
+ }
+ return null;
+ }
+ });
+}
+
+// IE6/7 call enctype encoding
+if ( !jQuery.support.enctype ) {
+ jQuery.propFix.enctype = "encoding";
+}
+
+// Radios and checkboxes getter/setter
+if ( !jQuery.support.checkOn ) {
+ jQuery.each([ "radio", "checkbox" ], function() {
+ jQuery.valHooks[ this ] = {
+ get: function( elem ) {
+ // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
+ return elem.getAttribute("value") === null ? "on" : elem.value;
+ }
+ };
+ });
+}
+jQuery.each([ "radio", "checkbox" ], function() {
+ jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
+ set: function( elem, value ) {
+ if ( jQuery.isArray( value ) ) {
+ return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
+ }
+ }
+ });
+});
+var rformElems = /^(?:input|select|textarea)$/i,
+ rkeyEvent = /^key/,
+ rmouseEvent = /^(?:mouse|contextmenu)|click/,
+ rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
+ rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
+
+function returnTrue() {
+ return true;
+}
+
+function returnFalse() {
+ return false;
+}
+
+/*
+ * Helper functions for managing events -- not part of the public interface.
+ * Props to Dean Edwards' addEvent library for many of the ideas.
+ */
+jQuery.event = {
+
+ global: {},
+
+ add: function( elem, types, handler, data, selector ) {
+ var tmp, events, t, handleObjIn,
+ special, eventHandle, handleObj,
+ handlers, type, namespaces, origType,
+ elemData = jQuery._data( elem );
+
+ // Don't attach events to noData or text/comment nodes (but allow plain objects)
+ if ( !elemData ) {
+ return;
+ }
+
+ // Caller can pass in an object of custom data in lieu of the handler
+ if ( handler.handler ) {
+ handleObjIn = handler;
+ handler = handleObjIn.handler;
+ selector = handleObjIn.selector;
+ }
+
+ // Make sure that the handler has a unique ID, used to find/remove it later
+ if ( !handler.guid ) {
+ handler.guid = jQuery.guid++;
+ }
+
+ // Init the element's event structure and main handler, if this is the first
+ if ( !(events = elemData.events) ) {
+ events = elemData.events = {};
+ }
+ if ( !(eventHandle = elemData.handle) ) {
+ eventHandle = elemData.handle = function( e ) {
+ // Discard the second event of a jQuery.event.trigger() and
+ // when an event is called after a page has unloaded
+ return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ?
+ jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
+ undefined;
+ };
+ // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
+ eventHandle.elem = elem;
+ }
+
+ // Handle multiple events separated by a space
+ // jQuery(...).bind("mouseover mouseout", fn);
+ types = ( types || "" ).match( core_rnotwhite ) || [""];
+ t = types.length;
+ while ( t-- ) {
+ tmp = rtypenamespace.exec( types[t] ) || [];
+ type = origType = tmp[1];
+ namespaces = ( tmp[2] || "" ).split( "." ).sort();
+
+ // If event changes its type, use the special event handlers for the changed type
+ special = jQuery.event.special[ type ] || {};
+
+ // If selector defined, determine special event api type, otherwise given type
+ type = ( selector ? special.delegateType : special.bindType ) || type;
+
+ // Update special based on newly reset type
+ special = jQuery.event.special[ type ] || {};
+
+ // handleObj is passed to all event handlers
+ handleObj = jQuery.extend({
+ type: type,
+ origType: origType,
+ data: data,
+ handler: handler,
+ guid: handler.guid,
+ selector: selector,
+ needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
+ namespace: namespaces.join(".")
+ }, handleObjIn );
+
+ // Init the event handler queue if we're the first
+ if ( !(handlers = events[ type ]) ) {
+ handlers = events[ type ] = [];
+ handlers.delegateCount = 0;
+
+ // Only use addEventListener/attachEvent if the special events handler returns false
+ if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
+ // Bind the global event handler to the element
+ if ( elem.addEventListener ) {
+ elem.addEventListener( type, eventHandle, false );
+
+ } else if ( elem.attachEvent ) {
+ elem.attachEvent( "on" + type, eventHandle );
+ }
+ }
+ }
+
+ if ( special.add ) {
+ special.add.call( elem, handleObj );
+
+ if ( !handleObj.handler.guid ) {
+ handleObj.handler.guid = handler.guid;
+ }
+ }
+
+ // Add to the element's handler list, delegates in front
+ if ( selector ) {
+ handlers.splice( handlers.delegateCount++, 0, handleObj );
+ } else {
+ handlers.push( handleObj );
+ }
+
+ // Keep track of which events have ever been used, for event optimization
+ jQuery.event.global[ type ] = true;
+ }
+
+ // Nullify elem to prevent memory leaks in IE
+ elem = null;
+ },
+
+ // Detach an event or set of events from an element
+ remove: function( elem, types, handler, selector, mappedTypes ) {
+ var j, handleObj, tmp,
+ origCount, t, events,
+ special, handlers, type,
+ namespaces, origType,
+ elemData = jQuery.hasData( elem ) && jQuery._data( elem );
+
+ if ( !elemData || !(events = elemData.events) ) {
+ return;
+ }
+
+ // Once for each type.namespace in types; type may be omitted
+ types = ( types || "" ).match( core_rnotwhite ) || [""];
+ t = types.length;
+ while ( t-- ) {
+ tmp = rtypenamespace.exec( types[t] ) || [];
+ type = origType = tmp[1];
+ namespaces = ( tmp[2] || "" ).split( "." ).sort();
+
+ // Unbind all events (on this namespace, if provided) for the element
+ if ( !type ) {
+ for ( type in events ) {
+ jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
+ }
+ continue;
+ }
+
+ special = jQuery.event.special[ type ] || {};
+ type = ( selector ? special.delegateType : special.bindType ) || type;
+ handlers = events[ type ] || [];
+ tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
+
+ // Remove matching events
+ origCount = j = handlers.length;
+ while ( j-- ) {
+ handleObj = handlers[ j ];
+
+ if ( ( mappedTypes || origType === handleObj.origType ) &&
+ ( !handler || handler.guid === handleObj.guid ) &&
+ ( !tmp || tmp.test( handleObj.namespace ) ) &&
+ ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
+ handlers.splice( j, 1 );
+
+ if ( handleObj.selector ) {
+ handlers.delegateCount--;
+ }
+ if ( special.remove ) {
+ special.remove.call( elem, handleObj );
+ }
+ }
+ }
+
+ // Remove generic event handler if we removed something and no more handlers exist
+ // (avoids potential for endless recursion during removal of special event handlers)
+ if ( origCount && !handlers.length ) {
+ if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
+ jQuery.removeEvent( elem, type, elemData.handle );
+ }
+
+ delete events[ type ];
+ }
+ }
+
+ // Remove the expando if it's no longer used
+ if ( jQuery.isEmptyObject( events ) ) {
+ delete elemData.handle;
+
+ // removeData also checks for emptiness and clears the expando if empty
+ // so use it instead of delete
+ jQuery._removeData( elem, "events" );
+ }
+ },
+
+ trigger: function( event, data, elem, onlyHandlers ) {
+ var handle, ontype, cur,
+ bubbleType, special, tmp, i,
+ eventPath = [ elem || document ],
+ type = core_hasOwn.call( event, "type" ) ? event.type : event,
+ namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
+
+ cur = tmp = elem = elem || document;
+
+ // Don't do events on text and comment nodes
+ if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
+ return;
+ }
+
+ // focus/blur morphs to focusin/out; ensure we're not firing them right now
+ if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
+ return;
+ }
+
+ if ( type.indexOf(".") >= 0 ) {
+ // Namespaced trigger; create a regexp to match event type in handle()
+ namespaces = type.split(".");
+ type = namespaces.shift();
+ namespaces.sort();
+ }
+ ontype = type.indexOf(":") < 0 && "on" + type;
+
+ // Caller can pass in a jQuery.Event object, Object, or just an event type string
+ event = event[ jQuery.expando ] ?
+ event :
+ new jQuery.Event( type, typeof event === "object" && event );
+
+ event.isTrigger = true;
+ event.namespace = namespaces.join(".");
+ event.namespace_re = event.namespace ?
+ new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
+ null;
+
+ // Clean up the event in case it is being reused
+ event.result = undefined;
+ if ( !event.target ) {
+ event.target = elem;
+ }
+
+ // Clone any incoming data and prepend the event, creating the handler arg list
+ data = data == null ?
+ [ event ] :
+ jQuery.makeArray( data, [ event ] );
+
+ // Allow special events to draw outside the lines
+ special = jQuery.event.special[ type ] || {};
+ if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
+ return;
+ }
+
+ // Determine event propagation path in advance, per W3C events spec (#9951)
+ // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
+ if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
+
+ bubbleType = special.delegateType || type;
+ if ( !rfocusMorph.test( bubbleType + type ) ) {
+ cur = cur.parentNode;
+ }
+ for ( ; cur; cur = cur.parentNode ) {
+ eventPath.push( cur );
+ tmp = cur;
+ }
+
+ // Only add window if we got to document (e.g., not plain obj or detached DOM)
+ if ( tmp === (elem.ownerDocument || document) ) {
+ eventPath.push( tmp.defaultView || tmp.parentWindow || window );
+ }
+ }
+
+ // Fire handlers on the event path
+ i = 0;
+ while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
+
+ event.type = i > 1 ?
+ bubbleType :
+ special.bindType || type;
+
+ // jQuery handler
+ handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
+ if ( handle ) {
+ handle.apply( cur, data );
+ }
+
+ // Native handler
+ handle = ontype && cur[ ontype ];
+ if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
+ event.preventDefault();
+ }
+ }
+ event.type = type;
+
+ // If nobody prevented the default action, do it now
+ if ( !onlyHandlers && !event.isDefaultPrevented() ) {
+
+ if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
+ !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
+
+ // Call a native DOM method on the target with the same name name as the event.
+ // Can't use an .isFunction() check here because IE6/7 fails that test.
+ // Don't do default actions on window, that's where global variables be (#6170)
+ if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
+
+ // Don't re-trigger an onFOO event when we call its FOO() method
+ tmp = elem[ ontype ];
+
+ if ( tmp ) {
+ elem[ ontype ] = null;
+ }
+
+ // Prevent re-triggering of the same event, since we already bubbled it above
+ jQuery.event.triggered = type;
+ try {
+ elem[ type ]();
+ } catch ( e ) {
+ // IE<9 dies on focus/blur to hidden element (#1486,#12518)
+ // only reproducible on winXP IE8 native, not IE9 in IE8 mode
+ }
+ jQuery.event.triggered = undefined;
+
+ if ( tmp ) {
+ elem[ ontype ] = tmp;
+ }
+ }
+ }
+ }
+
+ return event.result;
+ },
+
+ dispatch: function( event ) {
+
+ // Make a writable jQuery.Event from the native event object
+ event = jQuery.event.fix( event );
+
+ var i, ret, handleObj, matched, j,
+ handlerQueue = [],
+ args = core_slice.call( arguments ),
+ handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
+ special = jQuery.event.special[ event.type ] || {};
+
+ // Use the fix-ed jQuery.Event rather than the (read-only) native event
+ args[0] = event;
+ event.delegateTarget = this;
+
+ // Call the preDispatch hook for the mapped type, and let it bail if desired
+ if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
+ return;
+ }
+
+ // Determine handlers
+ handlerQueue = jQuery.event.handlers.call( this, event, handlers );
+
+ // Run delegates first; they may want to stop propagation beneath us
+ i = 0;
+ while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
+ event.currentTarget = matched.elem;
+
+ j = 0;
+ while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
+
+ // Triggered event must either 1) have no namespace, or
+ // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
+ if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
+
+ event.handleObj = handleObj;
+ event.data = handleObj.data;
+
+ ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
+ .apply( matched.elem, args );
+
+ if ( ret !== undefined ) {
+ if ( (event.result = ret) === false ) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ }
+ }
+ }
+ }
+
+ // Call the postDispatch hook for the mapped type
+ if ( special.postDispatch ) {
+ special.postDispatch.call( this, event );
+ }
+
+ return event.result;
+ },
+
+ handlers: function( event, handlers ) {
+ var sel, handleObj, matches, i,
+ handlerQueue = [],
+ delegateCount = handlers.delegateCount,
+ cur = event.target;
+
+ // Find delegate handlers
+ // Black-hole SVG instance trees (#13180)
+ // Avoid non-left-click bubbling in Firefox (#3861)
+ if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
+
+ for ( ; cur != this; cur = cur.parentNode || this ) {
+
+ // Don't check non-elements (#13208)
+ // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
+ if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) {
+ matches = [];
+ for ( i = 0; i < delegateCount; i++ ) {
+ handleObj = handlers[ i ];
+
+ // Don't conflict with Object.prototype properties (#13203)
+ sel = handleObj.selector + " ";
+
+ if ( matches[ sel ] === undefined ) {
+ matches[ sel ] = handleObj.needsContext ?
+ jQuery( sel, this ).index( cur ) >= 0 :
+ jQuery.find( sel, this, null, [ cur ] ).length;
+ }
+ if ( matches[ sel ] ) {
+ matches.push( handleObj );
+ }
+ }
+ if ( matches.length ) {
+ handlerQueue.push({ elem: cur, handlers: matches });
+ }
+ }
+ }
+ }
+
+ // Add the remaining (directly-bound) handlers
+ if ( delegateCount < handlers.length ) {
+ handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
+ }
+
+ return handlerQueue;
+ },
+
+ fix: function( event ) {
+ if ( event[ jQuery.expando ] ) {
+ return event;
+ }
+
+ // Create a writable copy of the event object and normalize some properties
+ var i, prop, copy,
+ type = event.type,
+ originalEvent = event,
+ fixHook = this.fixHooks[ type ];
+
+ if ( !fixHook ) {
+ this.fixHooks[ type ] = fixHook =
+ rmouseEvent.test( type ) ? this.mouseHooks :
+ rkeyEvent.test( type ) ? this.keyHooks :
+ {};
+ }
+ copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
+
+ event = new jQuery.Event( originalEvent );
+
+ i = copy.length;
+ while ( i-- ) {
+ prop = copy[ i ];
+ event[ prop ] = originalEvent[ prop ];
+ }
+
+ // Support: IE<9
+ // Fix target property (#1925)
+ if ( !event.target ) {
+ event.target = originalEvent.srcElement || document;
+ }
+
+ // Support: Chrome 23+, Safari?
+ // Target should not be a text node (#504, #13143)
+ if ( event.target.nodeType === 3 ) {
+ event.target = event.target.parentNode;
+ }
+
+ // Support: IE<9
+ // For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
+ event.metaKey = !!event.metaKey;
+
+ return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
+ },
+
+ // Includes some event props shared by KeyEvent and MouseEvent
+ props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
+
+ fixHooks: {},
+
+ keyHooks: {
+ props: "char charCode key keyCode".split(" "),
+ filter: function( event, original ) {
+
+ // Add which for key events
+ if ( event.which == null ) {
+ event.which = original.charCode != null ? original.charCode : original.keyCode;
+ }
+
+ return event;
+ }
+ },
+
+ mouseHooks: {
+ props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
+ filter: function( event, original ) {
+ var body, eventDoc, doc,
+ button = original.button,
+ fromElement = original.fromElement;
+
+ // Calculate pageX/Y if missing and clientX/Y available
+ if ( event.pageX == null && original.clientX != null ) {
+ eventDoc = event.target.ownerDocument || document;
+ doc = eventDoc.documentElement;
+ body = eventDoc.body;
+
+ event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
+ event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
+ }
+
+ // Add relatedTarget, if necessary
+ if ( !event.relatedTarget && fromElement ) {
+ event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
+ }
+
+ // Add which for click: 1 === left; 2 === middle; 3 === right
+ // Note: button is not normalized, so don't use it
+ if ( !event.which && button !== undefined ) {
+ event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
+ }
+
+ return event;
+ }
+ },
+
+ special: {
+ load: {
+ // Prevent triggered image.load events from bubbling to window.load
+ noBubble: true
+ },
+ click: {
+ // For checkbox, fire native event so checked state will be right
+ trigger: function() {
+ if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
+ this.click();
+ return false;
+ }
+ }
+ },
+ focus: {
+ // Fire native event if possible so blur/focus sequence is correct
+ trigger: function() {
+ if ( this !== document.activeElement && this.focus ) {
+ try {
+ this.focus();
+ return false;
+ } catch ( e ) {
+ // Support: IE<9
+ // If we error on focus to hidden element (#1486, #12518),
+ // let .trigger() run the handlers
+ }
+ }
+ },
+ delegateType: "focusin"
+ },
+ blur: {
+ trigger: function() {
+ if ( this === document.activeElement && this.blur ) {
+ this.blur();
+ return false;
+ }
+ },
+ delegateType: "focusout"
+ },
+
+ beforeunload: {
+ postDispatch: function( event ) {
+
+ // Even when returnValue equals to undefined Firefox will still show alert
+ if ( event.result !== undefined ) {
+ event.originalEvent.returnValue = event.result;
+ }
+ }
+ }
+ },
+
+ simulate: function( type, elem, event, bubble ) {
+ // Piggyback on a donor event to simulate a different one.
+ // Fake originalEvent to avoid donor's stopPropagation, but if the
+ // simulated event prevents default then we do the same on the donor.
+ var e = jQuery.extend(
+ new jQuery.Event(),
+ event,
+ { type: type,
+ isSimulated: true,
+ originalEvent: {}
+ }
+ );
+ if ( bubble ) {
+ jQuery.event.trigger( e, null, elem );
+ } else {
+ jQuery.event.dispatch.call( elem, e );
+ }
+ if ( e.isDefaultPrevented() ) {
+ event.preventDefault();
+ }
+ }
+};
+
+jQuery.removeEvent = document.removeEventListener ?
+ function( elem, type, handle ) {
+ if ( elem.removeEventListener ) {
+ elem.removeEventListener( type, handle, false );
+ }
+ } :
+ function( elem, type, handle ) {
+ var name = "on" + type;
+
+ if ( elem.detachEvent ) {
+
+ // #8545, #7054, preventing memory leaks for custom events in IE6-8
+ // detachEvent needed property on element, by name of that event, to properly expose it to GC
+ if ( typeof elem[ name ] === core_strundefined ) {
+ elem[ name ] = null;
+ }
+
+ elem.detachEvent( name, handle );
+ }
+ };
+
+jQuery.Event = function( src, props ) {
+ // Allow instantiation without the 'new' keyword
+ if ( !(this instanceof jQuery.Event) ) {
+ return new jQuery.Event( src, props );
+ }
+
+ // Event object
+ if ( src && src.type ) {
+ this.originalEvent = src;
+ this.type = src.type;
+
+ // Events bubbling up the document may have been marked as prevented
+ // by a handler lower down the tree; reflect the correct value.
+ this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
+ src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
+
+ // Event type
+ } else {
+ this.type = src;
+ }
+
+ // Put explicitly provided properties onto the event object
+ if ( props ) {
+ jQuery.extend( this, props );
+ }
+
+ // Create a timestamp if incoming event doesn't have one
+ this.timeStamp = src && src.timeStamp || jQuery.now();
+
+ // Mark it as fixed
+ this[ jQuery.expando ] = true;
+};
+
+// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
+// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
+jQuery.Event.prototype = {
+ isDefaultPrevented: returnFalse,
+ isPropagationStopped: returnFalse,
+ isImmediatePropagationStopped: returnFalse,
+
+ preventDefault: function() {
+ var e = this.originalEvent;
+
+ this.isDefaultPrevented = returnTrue;
+ if ( !e ) {
+ return;
+ }
+
+ // If preventDefault exists, run it on the original event
+ if ( e.preventDefault ) {
+ e.preventDefault();
+
+ // Support: IE
+ // Otherwise set the returnValue property of the original event to false
+ } else {
+ e.returnValue = false;
+ }
+ },
+ stopPropagation: function() {
+ var e = this.originalEvent;
+
+ this.isPropagationStopped = returnTrue;
+ if ( !e ) {
+ return;
+ }
+ // If stopPropagation exists, run it on the original event
+ if ( e.stopPropagation ) {
+ e.stopPropagation();
+ }
+
+ // Support: IE
+ // Set the cancelBubble property of the original event to true
+ e.cancelBubble = true;
+ },
+ stopImmediatePropagation: function() {
+ this.isImmediatePropagationStopped = returnTrue;
+ this.stopPropagation();
+ }
+};
+
+// Create mouseenter/leave events using mouseover/out and event-time checks
+jQuery.each({
+ mouseenter: "mouseover",
+ mouseleave: "mouseout"
+}, function( orig, fix ) {
+ jQuery.event.special[ orig ] = {
+ delegateType: fix,
+ bindType: fix,
+
+ handle: function( event ) {
+ var ret,
+ target = this,
+ related = event.relatedTarget,
+ handleObj = event.handleObj;
+
+ // For mousenter/leave call the handler if related is outside the target.
+ // NB: No relatedTarget if the mouse left/entered the browser window
+ if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
+ event.type = handleObj.origType;
+ ret = handleObj.handler.apply( this, arguments );
+ event.type = fix;
+ }
+ return ret;
+ }
+ };
+});
+
+// IE submit delegation
+if ( !jQuery.support.submitBubbles ) {
+
+ jQuery.event.special.submit = {
+ setup: function() {
+ // Only need this for delegated form submit events
+ if ( jQuery.nodeName( this, "form" ) ) {
+ return false;
+ }
+
+ // Lazy-add a submit handler when a descendant form may potentially be submitted
+ jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
+ // Node name check avoids a VML-related crash in IE (#9807)
+ var elem = e.target,
+ form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
+ if ( form && !jQuery._data( form, "submitBubbles" ) ) {
+ jQuery.event.add( form, "submit._submit", function( event ) {
+ event._submit_bubble = true;
+ });
+ jQuery._data( form, "submitBubbles", true );
+ }
+ });
+ // return undefined since we don't need an event listener
+ },
+
+ postDispatch: function( event ) {
+ // If form was submitted by the user, bubble the event up the tree
+ if ( event._submit_bubble ) {
+ delete event._submit_bubble;
+ if ( this.parentNode && !event.isTrigger ) {
+ jQuery.event.simulate( "submit", this.parentNode, event, true );
+ }
+ }
+ },
+
+ teardown: function() {
+ // Only need this for delegated form submit events
+ if ( jQuery.nodeName( this, "form" ) ) {
+ return false;
+ }
+
+ // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
+ jQuery.event.remove( this, "._submit" );
+ }
+ };
+}
+
+// IE change delegation and checkbox/radio fix
+if ( !jQuery.support.changeBubbles ) {
+
+ jQuery.event.special.change = {
+
+ setup: function() {
+
+ if ( rformElems.test( this.nodeName ) ) {
+ // IE doesn't fire change on a check/radio until blur; trigger it on click
+ // after a propertychange. Eat the blur-change in special.change.handle.
+ // This still fires onchange a second time for check/radio after blur.
+ if ( this.type === "checkbox" || this.type === "radio" ) {
+ jQuery.event.add( this, "propertychange._change", function( event ) {
+ if ( event.originalEvent.propertyName === "checked" ) {
+ this._just_changed = true;
+ }
+ });
+ jQuery.event.add( this, "click._change", function( event ) {
+ if ( this._just_changed && !event.isTrigger ) {
+ this._just_changed = false;
+ }
+ // Allow triggered, simulated change events (#11500)
+ jQuery.event.simulate( "change", this, event, true );
+ });
+ }
+ return false;
+ }
+ // Delegated event; lazy-add a change handler on descendant inputs
+ jQuery.event.add( this, "beforeactivate._change", function( e ) {
+ var elem = e.target;
+
+ if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) {
+ jQuery.event.add( elem, "change._change", function( event ) {
+ if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
+ jQuery.event.simulate( "change", this.parentNode, event, true );
+ }
+ });
+ jQuery._data( elem, "changeBubbles", true );
+ }
+ });
+ },
+
+ handle: function( event ) {
+ var elem = event.target;
+
+ // Swallow native change events from checkbox/radio, we already triggered them above
+ if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
+ return event.handleObj.handler.apply( this, arguments );
+ }
+ },
+
+ teardown: function() {
+ jQuery.event.remove( this, "._change" );
+
+ return !rformElems.test( this.nodeName );
+ }
+ };
+}
+
+// Create "bubbling" focus and blur events
+if ( !jQuery.support.focusinBubbles ) {
+ jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
+
+ // Attach a single capturing handler while someone wants focusin/focusout
+ var attaches = 0,
+ handler = function( event ) {
+ jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
+ };
+
+ jQuery.event.special[ fix ] = {
+ setup: function() {
+ if ( attaches++ === 0 ) {
+ document.addEventListener( orig, handler, true );
+ }
+ },
+ teardown: function() {
+ if ( --attaches === 0 ) {
+ document.removeEventListener( orig, handler, true );
+ }
+ }
+ };
+ });
+}
+
+jQuery.fn.extend({
+
+ on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
+ var type, origFn;
+
+ // Types can be a map of types/handlers
+ if ( typeof types === "object" ) {
+ // ( types-Object, selector, data )
+ if ( typeof selector !== "string" ) {
+ // ( types-Object, data )
+ data = data || selector;
+ selector = undefined;
+ }
+ for ( type in types ) {
+ this.on( type, selector, data, types[ type ], one );
+ }
+ return this;
+ }
+
+ if ( data == null && fn == null ) {
+ // ( types, fn )
+ fn = selector;
+ data = selector = undefined;
+ } else if ( fn == null ) {
+ if ( typeof selector === "string" ) {
+ // ( types, selector, fn )
+ fn = data;
+ data = undefined;
+ } else {
+ // ( types, data, fn )
+ fn = data;
+ data = selector;
+ selector = undefined;
+ }
+ }
+ if ( fn === false ) {
+ fn = returnFalse;
+ } else if ( !fn ) {
+ return this;
+ }
+
+ if ( one === 1 ) {
+ origFn = fn;
+ fn = function( event ) {
+ // Can use an empty set, since event contains the info
+ jQuery().off( event );
+ return origFn.apply( this, arguments );
+ };
+ // Use same guid so caller can remove using origFn
+ fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
+ }
+ return this.each( function() {
+ jQuery.event.add( this, types, fn, data, selector );
+ });
+ },
+ one: function( types, selector, data, fn ) {
+ return this.on( types, selector, data, fn, 1 );
+ },
+ off: function( types, selector, fn ) {
+ var handleObj, type;
+ if ( types && types.preventDefault && types.handleObj ) {
+ // ( event ) dispatched jQuery.Event
+ handleObj = types.handleObj;
+ jQuery( types.delegateTarget ).off(
+ handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
+ handleObj.selector,
+ handleObj.handler
+ );
+ return this;
+ }
+ if ( typeof types === "object" ) {
+ // ( types-object [, selector] )
+ for ( type in types ) {
+ this.off( type, selector, types[ type ] );
+ }
+ return this;
+ }
+ if ( selector === false || typeof selector === "function" ) {
+ // ( types [, fn] )
+ fn = selector;
+ selector = undefined;
+ }
+ if ( fn === false ) {
+ fn = returnFalse;
+ }
+ return this.each(function() {
+ jQuery.event.remove( this, types, fn, selector );
+ });
+ },
+
+ bind: function( types, data, fn ) {
+ return this.on( types, null, data, fn );
+ },
+ unbind: function( types, fn ) {
+ return this.off( types, null, fn );
+ },
+
+ delegate: function( selector, types, data, fn ) {
+ return this.on( types, selector, data, fn );
+ },
+ undelegate: function( selector, types, fn ) {
+ // ( namespace ) or ( selector, types [, fn] )
+ return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
+ },
+
+ trigger: function( type, data ) {
+ return this.each(function() {
+ jQuery.event.trigger( type, data, this );
+ });
+ },
+ triggerHandler: function( type, data ) {
+ var elem = this[0];
+ if ( elem ) {
+ return jQuery.event.trigger( type, data, elem, true );
+ }
+ }
+});
+/*!
+ * Sizzle CSS Selector Engine
+ * Copyright 2012 jQuery Foundation and other contributors
+ * Released under the MIT license
+ * http://sizzlejs.com/
+ */
+(function( window, undefined ) {
+
+var i,
+ cachedruns,
+ Expr,
+ getText,
+ isXML,
+ compile,
+ hasDuplicate,
+ outermostContext,
+
+ // Local document vars
+ setDocument,
+ document,
+ docElem,
+ documentIsXML,
+ rbuggyQSA,
+ rbuggyMatches,
+ matches,
+ contains,
+ sortOrder,
+
+ // Instance-specific data
+ expando = "sizzle" + -(new Date()),
+ preferredDoc = window.document,
+ support = {},
+ dirruns = 0,
+ done = 0,
+ classCache = createCache(),
+ tokenCache = createCache(),
+ compilerCache = createCache(),
+
+ // General-purpose constants
+ strundefined = typeof undefined,
+ MAX_NEGATIVE = 1 << 31,
+
+ // Array methods
+ arr = [],
+ pop = arr.pop,
+ push = arr.push,
+ slice = arr.slice,
+ // Use a stripped-down indexOf if we can't use a native one
+ indexOf = arr.indexOf || function( elem ) {
+ var i = 0,
+ len = this.length;
+ for ( ; i < len; i++ ) {
+ if ( this[i] === elem ) {
+ return i;
+ }
+ }
+ return -1;
+ },
+
+
+ // Regular expressions
+
+ // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
+ whitespace = "[\\x20\\t\\r\\n\\f]",
+ // http://www.w3.org/TR/css3-syntax/#characters
+ characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
+
+ // Loosely modeled on CSS identifier characters
+ // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
+ // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
+ identifier = characterEncoding.replace( "w", "w#" ),
+
+ // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
+ operators = "([*^$|!~]?=)",
+ attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
+ "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
+
+ // Prefer arguments quoted,
+ // then not containing pseudos/brackets,
+ // then attribute selectors/non-parenthetical expressions,
+ // then anything else
+ // These preferences are here to reduce the number of selectors
+ // needing tokenize in the PSEUDO preFilter
+ pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",
+
+ // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
+ rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
+
+ rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
+ rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ),
+ rpseudo = new RegExp( pseudos ),
+ ridentifier = new RegExp( "^" + identifier + "$" ),
+
+ matchExpr = {
+ "ID": new RegExp( "^#(" + characterEncoding + ")" ),
+ "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
+ "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ),
+ "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
+ "ATTR": new RegExp( "^" + attributes ),
+ "PSEUDO": new RegExp( "^" + pseudos ),
+ "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
+ "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
+ "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
+ // For use in libraries implementing .is()
+ // We use this for POS matching in `select`
+ "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
+ whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
+ },
+
+ rsibling = /[\x20\t\r\n\f]*[+~]/,
+
+ rnative = /^[^{]+\{\s*\[native code/,
+
+ // Easily-parseable/retrievable ID or TAG or CLASS selectors
+ rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
+
+ rinputs = /^(?:input|select|textarea|button)$/i,
+ rheader = /^h\d$/i,
+
+ rescape = /'|\\/g,
+ rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
+
+ // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
+ runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,
+ funescape = function( _, escaped ) {
+ var high = "0x" + escaped - 0x10000;
+ // NaN means non-codepoint
+ return high !== high ?
+ escaped :
+ // BMP codepoint
+ high < 0 ?
+ String.fromCharCode( high + 0x10000 ) :
+ // Supplemental Plane codepoint (surrogate pair)
+ String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
+ };
+
+// Use a stripped-down slice if we can't use a native one
+try {
+ slice.call( preferredDoc.documentElement.childNodes, 0 )[0].nodeType;
+} catch ( e ) {
+ slice = function( i ) {
+ var elem,
+ results = [];
+ while ( (elem = this[i++]) ) {
+ results.push( elem );
+ }
+ return results;
+ };
+}
+
+/**
+ * For feature detection
+ * @param {Function} fn The function to test for native support
+ */
+function isNative( fn ) {
+ return rnative.test( fn + "" );
+}
+
+/**
+ * Create key-value caches of limited size
+ * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
+ * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
+ * deleting the oldest entry
+ */
+function createCache() {
+ var cache,
+ keys = [];
+
+ return (cache = function( key, value ) {
+ // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
+ if ( keys.push( key += " " ) > Expr.cacheLength ) {
+ // Only keep the most recent entries
+ delete cache[ keys.shift() ];
+ }
+ return (cache[ key ] = value);
+ });
+}
+
+/**
+ * Mark a function for special use by Sizzle
+ * @param {Function} fn The function to mark
+ */
+function markFunction( fn ) {
+ fn[ expando ] = true;
+ return fn;
+}
+
+/**
+ * Support testing using an element
+ * @param {Function} fn Passed the created div and expects a boolean result
+ */
+function assert( fn ) {
+ var div = document.createElement("div");
+
+ try {
+ return fn( div );
+ } catch (e) {
+ return false;
+ } finally {
+ // release memory in IE
+ div = null;
+ }
+}
+
+function Sizzle( selector, context, results, seed ) {
+ var match, elem, m, nodeType,
+ // QSA vars
+ i, groups, old, nid, newContext, newSelector;
+
+ if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
+ setDocument( context );
+ }
+
+ context = context || document;
+ results = results || [];
+
+ if ( !selector || typeof selector !== "string" ) {
+ return results;
+ }
+
+ if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
+ return [];
+ }
+
+ if ( !documentIsXML && !seed ) {
+
+ // Shortcuts
+ if ( (match = rquickExpr.exec( selector )) ) {
+ // Speed-up: Sizzle("#ID")
+ if ( (m = match[1]) ) {
+ if ( nodeType === 9 ) {
+ elem = context.getElementById( m );
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ if ( elem && elem.parentNode ) {
+ // Handle the case where IE, Opera, and Webkit return items
+ // by name instead of ID
+ if ( elem.id === m ) {
+ results.push( elem );
+ return results;
+ }
+ } else {
+ return results;
+ }
+ } else {
+ // Context is not a document
+ if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
+ contains( context, elem ) && elem.id === m ) {
+ results.push( elem );
+ return results;
+ }
+ }
+
+ // Speed-up: Sizzle("TAG")
+ } else if ( match[2] ) {
+ push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );
+ return results;
+
+ // Speed-up: Sizzle(".CLASS")
+ } else if ( (m = match[3]) && support.getByClassName && context.getElementsByClassName ) {
+ push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
+ return results;
+ }
+ }
+
+ // QSA path
+ if ( support.qsa && !rbuggyQSA.test(selector) ) {
+ old = true;
+ nid = expando;
+ newContext = context;
+ newSelector = nodeType === 9 && selector;
+
+ // qSA works strangely on Element-rooted queries
+ // We can work around this by specifying an extra ID on the root
+ // and working up from there (Thanks to Andrew Dupont for the technique)
+ // IE 8 doesn't work on object elements
+ if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
+ groups = tokenize( selector );
+
+ if ( (old = context.getAttribute("id")) ) {
+ nid = old.replace( rescape, "\\$&" );
+ } else {
+ context.setAttribute( "id", nid );
+ }
+ nid = "[id='" + nid + "'] ";
+
+ i = groups.length;
+ while ( i-- ) {
+ groups[i] = nid + toSelector( groups[i] );
+ }
+ newContext = rsibling.test( selector ) && context.parentNode || context;
+ newSelector = groups.join(",");
+ }
+
+ if ( newSelector ) {
+ try {
+ push.apply( results, slice.call( newContext.querySelectorAll(
+ newSelector
+ ), 0 ) );
+ return results;
+ } catch(qsaError) {
+ } finally {
+ if ( !old ) {
+ context.removeAttribute("id");
+ }
+ }
+ }
+ }
+ }
+
+ // All others
+ return select( selector.replace( rtrim, "$1" ), context, results, seed );
+}
+
+/**
+ * Detect xml
+ * @param {Element|Object} elem An element or a document
+ */
+isXML = Sizzle.isXML = function( elem ) {
+ // documentElement is verified for cases where it doesn't yet exist
+ // (such as loading iframes in IE - #4833)
+ var documentElement = elem && (elem.ownerDocument || elem).documentElement;
+ return documentElement ? documentElement.nodeName !== "HTML" : false;
+};
+
+/**
+ * Sets document-related variables once based on the current document
+ * @param {Element|Object} [doc] An element or document object to use to set the document
+ * @returns {Object} Returns the current document
+ */
+setDocument = Sizzle.setDocument = function( node ) {
+ var doc = node ? node.ownerDocument || node : preferredDoc;
+
+ // If no document and documentElement is available, return
+ if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
+ return document;
+ }
+
+ // Set our document
+ document = doc;
+ docElem = doc.documentElement;
+
+ // Support tests
+ documentIsXML = isXML( doc );
+
+ // Check if getElementsByTagName("*") returns only elements
+ support.tagNameNoComments = assert(function( div ) {
+ div.appendChild( doc.createComment("") );
+ return !div.getElementsByTagName("*").length;
+ });
+
+ // Check if attributes should be retrieved by attribute nodes
+ support.attributes = assert(function( div ) {
+ div.innerHTML = " ";
+ var type = typeof div.lastChild.getAttribute("multiple");
+ // IE8 returns a string for some attributes even when not present
+ return type !== "boolean" && type !== "string";
+ });
+
+ // Check if getElementsByClassName can be trusted
+ support.getByClassName = assert(function( div ) {
+ // Opera can't find a second classname (in 9.6)
+ div.innerHTML = "
";
+ if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) {
+ return false;
+ }
+
+ // Safari 3.2 caches class attributes and doesn't catch changes
+ div.lastChild.className = "e";
+ return div.getElementsByClassName("e").length === 2;
+ });
+
+ // Check if getElementById returns elements by name
+ // Check if getElementsByName privileges form controls or returns elements by ID
+ support.getByName = assert(function( div ) {
+ // Inject content
+ div.id = expando + 0;
+ div.innerHTML = "
";
+ docElem.insertBefore( div, docElem.firstChild );
+
+ // Test
+ var pass = doc.getElementsByName &&
+ // buggy browsers will return fewer than the correct 2
+ doc.getElementsByName( expando ).length === 2 +
+ // buggy browsers will return more than the correct 0
+ doc.getElementsByName( expando + 0 ).length;
+ support.getIdNotName = !doc.getElementById( expando );
+
+ // Cleanup
+ docElem.removeChild( div );
+
+ return pass;
+ });
+
+ // IE6/7 return modified attributes
+ Expr.attrHandle = assert(function( div ) {
+ div.innerHTML = " ";
+ return div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&
+ div.firstChild.getAttribute("href") === "#";
+ }) ?
+ {} :
+ {
+ "href": function( elem ) {
+ return elem.getAttribute( "href", 2 );
+ },
+ "type": function( elem ) {
+ return elem.getAttribute("type");
+ }
+ };
+
+ // ID find and filter
+ if ( support.getIdNotName ) {
+ Expr.find["ID"] = function( id, context ) {
+ if ( typeof context.getElementById !== strundefined && !documentIsXML ) {
+ var m = context.getElementById( id );
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ return m && m.parentNode ? [m] : [];
+ }
+ };
+ Expr.filter["ID"] = function( id ) {
+ var attrId = id.replace( runescape, funescape );
+ return function( elem ) {
+ return elem.getAttribute("id") === attrId;
+ };
+ };
+ } else {
+ Expr.find["ID"] = function( id, context ) {
+ if ( typeof context.getElementById !== strundefined && !documentIsXML ) {
+ var m = context.getElementById( id );
+
+ return m ?
+ m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?
+ [m] :
+ undefined :
+ [];
+ }
+ };
+ Expr.filter["ID"] = function( id ) {
+ var attrId = id.replace( runescape, funescape );
+ return function( elem ) {
+ var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
+ return node && node.value === attrId;
+ };
+ };
+ }
+
+ // Tag
+ Expr.find["TAG"] = support.tagNameNoComments ?
+ function( tag, context ) {
+ if ( typeof context.getElementsByTagName !== strundefined ) {
+ return context.getElementsByTagName( tag );
+ }
+ } :
+ function( tag, context ) {
+ var elem,
+ tmp = [],
+ i = 0,
+ results = context.getElementsByTagName( tag );
+
+ // Filter out possible comments
+ if ( tag === "*" ) {
+ while ( (elem = results[i++]) ) {
+ if ( elem.nodeType === 1 ) {
+ tmp.push( elem );
+ }
+ }
+
+ return tmp;
+ }
+ return results;
+ };
+
+ // Name
+ Expr.find["NAME"] = support.getByName && function( tag, context ) {
+ if ( typeof context.getElementsByName !== strundefined ) {
+ return context.getElementsByName( name );
+ }
+ };
+
+ // Class
+ Expr.find["CLASS"] = support.getByClassName && function( className, context ) {
+ if ( typeof context.getElementsByClassName !== strundefined && !documentIsXML ) {
+ return context.getElementsByClassName( className );
+ }
+ };
+
+ // QSA and matchesSelector support
+
+ // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
+ rbuggyMatches = [];
+
+ // qSa(:focus) reports false when true (Chrome 21),
+ // no need to also add to buggyMatches since matches checks buggyQSA
+ // A support test would require too much code (would include document ready)
+ rbuggyQSA = [ ":focus" ];
+
+ if ( (support.qsa = isNative(doc.querySelectorAll)) ) {
+ // Build QSA regex
+ // Regex strategy adopted from Diego Perini
+ assert(function( div ) {
+ // Select is set to empty string on purpose
+ // This is to test IE's treatment of not explictly
+ // setting a boolean content attribute,
+ // since its presence should be enough
+ // http://bugs.jquery.com/ticket/12359
+ div.innerHTML = " ";
+
+ // IE8 - Some boolean attributes are not treated correctly
+ if ( !div.querySelectorAll("[selected]").length ) {
+ rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );
+ }
+
+ // Webkit/Opera - :checked should return selected option elements
+ // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
+ // IE8 throws error here and will not see later tests
+ if ( !div.querySelectorAll(":checked").length ) {
+ rbuggyQSA.push(":checked");
+ }
+ });
+
+ assert(function( div ) {
+
+ // Opera 10-12/IE8 - ^= $= *= and empty values
+ // Should not select anything
+ div.innerHTML = " ";
+ if ( div.querySelectorAll("[i^='']").length ) {
+ rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );
+ }
+
+ // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
+ // IE8 throws error here and will not see later tests
+ if ( !div.querySelectorAll(":enabled").length ) {
+ rbuggyQSA.push( ":enabled", ":disabled" );
+ }
+
+ // Opera 10-11 does not throw on post-comma invalid pseudos
+ div.querySelectorAll("*,:x");
+ rbuggyQSA.push(",.*:");
+ });
+ }
+
+ if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector ||
+ docElem.mozMatchesSelector ||
+ docElem.webkitMatchesSelector ||
+ docElem.oMatchesSelector ||
+ docElem.msMatchesSelector) )) ) {
+
+ assert(function( div ) {
+ // Check to see if it's possible to do matchesSelector
+ // on a disconnected node (IE 9)
+ support.disconnectedMatch = matches.call( div, "div" );
+
+ // This should fail with an exception
+ // Gecko does not error, returns false instead
+ matches.call( div, "[s!='']:x" );
+ rbuggyMatches.push( "!=", pseudos );
+ });
+ }
+
+ rbuggyQSA = new RegExp( rbuggyQSA.join("|") );
+ rbuggyMatches = new RegExp( rbuggyMatches.join("|") );
+
+ // Element contains another
+ // Purposefully does not implement inclusive descendent
+ // As in, an element does not contain itself
+ contains = isNative(docElem.contains) || docElem.compareDocumentPosition ?
+ function( a, b ) {
+ var adown = a.nodeType === 9 ? a.documentElement : a,
+ bup = b && b.parentNode;
+ return a === bup || !!( bup && bup.nodeType === 1 && (
+ adown.contains ?
+ adown.contains( bup ) :
+ a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
+ ));
+ } :
+ function( a, b ) {
+ if ( b ) {
+ while ( (b = b.parentNode) ) {
+ if ( b === a ) {
+ return true;
+ }
+ }
+ }
+ return false;
+ };
+
+ // Document order sorting
+ sortOrder = docElem.compareDocumentPosition ?
+ function( a, b ) {
+ var compare;
+
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+ }
+
+ if ( (compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b )) ) {
+ if ( compare & 1 || a.parentNode && a.parentNode.nodeType === 11 ) {
+ if ( a === doc || contains( preferredDoc, a ) ) {
+ return -1;
+ }
+ if ( b === doc || contains( preferredDoc, b ) ) {
+ return 1;
+ }
+ return 0;
+ }
+ return compare & 4 ? -1 : 1;
+ }
+
+ return a.compareDocumentPosition ? -1 : 1;
+ } :
+ function( a, b ) {
+ var cur,
+ i = 0,
+ aup = a.parentNode,
+ bup = b.parentNode,
+ ap = [ a ],
+ bp = [ b ];
+
+ // Exit early if the nodes are identical
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+
+ // Parentless nodes are either documents or disconnected
+ } else if ( !aup || !bup ) {
+ return a === doc ? -1 :
+ b === doc ? 1 :
+ aup ? -1 :
+ bup ? 1 :
+ 0;
+
+ // If the nodes are siblings, we can do a quick check
+ } else if ( aup === bup ) {
+ return siblingCheck( a, b );
+ }
+
+ // Otherwise we need full lists of their ancestors for comparison
+ cur = a;
+ while ( (cur = cur.parentNode) ) {
+ ap.unshift( cur );
+ }
+ cur = b;
+ while ( (cur = cur.parentNode) ) {
+ bp.unshift( cur );
+ }
+
+ // Walk down the tree looking for a discrepancy
+ while ( ap[i] === bp[i] ) {
+ i++;
+ }
+
+ return i ?
+ // Do a sibling check if the nodes have a common ancestor
+ siblingCheck( ap[i], bp[i] ) :
+
+ // Otherwise nodes in our document sort first
+ ap[i] === preferredDoc ? -1 :
+ bp[i] === preferredDoc ? 1 :
+ 0;
+ };
+
+ // Always assume the presence of duplicates if sort doesn't
+ // pass them to our comparison function (as in Google Chrome).
+ hasDuplicate = false;
+ [0, 0].sort( sortOrder );
+ support.detectDuplicates = hasDuplicate;
+
+ return document;
+};
+
+Sizzle.matches = function( expr, elements ) {
+ return Sizzle( expr, null, null, elements );
+};
+
+Sizzle.matchesSelector = function( elem, expr ) {
+ // Set document vars if needed
+ if ( ( elem.ownerDocument || elem ) !== document ) {
+ setDocument( elem );
+ }
+
+ // Make sure that attribute selectors are quoted
+ expr = expr.replace( rattributeQuotes, "='$1']" );
+
+ // rbuggyQSA always contains :focus, so no need for an existence check
+ if ( support.matchesSelector && !documentIsXML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) {
+ try {
+ var ret = matches.call( elem, expr );
+
+ // IE 9's matchesSelector returns false on disconnected nodes
+ if ( ret || support.disconnectedMatch ||
+ // As well, disconnected nodes are said to be in a document
+ // fragment in IE 9
+ elem.document && elem.document.nodeType !== 11 ) {
+ return ret;
+ }
+ } catch(e) {}
+ }
+
+ return Sizzle( expr, document, null, [elem] ).length > 0;
+};
+
+Sizzle.contains = function( context, elem ) {
+ // Set document vars if needed
+ if ( ( context.ownerDocument || context ) !== document ) {
+ setDocument( context );
+ }
+ return contains( context, elem );
+};
+
+Sizzle.attr = function( elem, name ) {
+ var val;
+
+ // Set document vars if needed
+ if ( ( elem.ownerDocument || elem ) !== document ) {
+ setDocument( elem );
+ }
+
+ if ( !documentIsXML ) {
+ name = name.toLowerCase();
+ }
+ if ( (val = Expr.attrHandle[ name ]) ) {
+ return val( elem );
+ }
+ if ( documentIsXML || support.attributes ) {
+ return elem.getAttribute( name );
+ }
+ return ( (val = elem.getAttributeNode( name )) || elem.getAttribute( name ) ) && elem[ name ] === true ?
+ name :
+ val && val.specified ? val.value : null;
+};
+
+Sizzle.error = function( msg ) {
+ throw new Error( "Syntax error, unrecognized expression: " + msg );
+};
+
+// Document sorting and removing duplicates
+Sizzle.uniqueSort = function( results ) {
+ var elem,
+ duplicates = [],
+ i = 1,
+ j = 0;
+
+ // Unless we *know* we can detect duplicates, assume their presence
+ hasDuplicate = !support.detectDuplicates;
+ results.sort( sortOrder );
+
+ if ( hasDuplicate ) {
+ for ( ; (elem = results[i]); i++ ) {
+ if ( elem === results[ i - 1 ] ) {
+ j = duplicates.push( i );
+ }
+ }
+ while ( j-- ) {
+ results.splice( duplicates[ j ], 1 );
+ }
+ }
+
+ return results;
+};
+
+function siblingCheck( a, b ) {
+ var cur = b && a,
+ diff = cur && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE );
+
+ // Use IE sourceIndex if available on both nodes
+ if ( diff ) {
+ return diff;
+ }
+
+ // Check if b follows a
+ if ( cur ) {
+ while ( (cur = cur.nextSibling) ) {
+ if ( cur === b ) {
+ return -1;
+ }
+ }
+ }
+
+ return a ? 1 : -1;
+}
+
+// Returns a function to use in pseudos for input types
+function createInputPseudo( type ) {
+ return function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return name === "input" && elem.type === type;
+ };
+}
+
+// Returns a function to use in pseudos for buttons
+function createButtonPseudo( type ) {
+ return function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return (name === "input" || name === "button") && elem.type === type;
+ };
+}
+
+// Returns a function to use in pseudos for positionals
+function createPositionalPseudo( fn ) {
+ return markFunction(function( argument ) {
+ argument = +argument;
+ return markFunction(function( seed, matches ) {
+ var j,
+ matchIndexes = fn( [], seed.length, argument ),
+ i = matchIndexes.length;
+
+ // Match elements found at the specified indexes
+ while ( i-- ) {
+ if ( seed[ (j = matchIndexes[i]) ] ) {
+ seed[j] = !(matches[j] = seed[j]);
+ }
+ }
+ });
+ });
+}
+
+/**
+ * Utility function for retrieving the text value of an array of DOM nodes
+ * @param {Array|Element} elem
+ */
+getText = Sizzle.getText = function( elem ) {
+ var node,
+ ret = "",
+ i = 0,
+ nodeType = elem.nodeType;
+
+ if ( !nodeType ) {
+ // If no nodeType, this is expected to be an array
+ for ( ; (node = elem[i]); i++ ) {
+ // Do not traverse comment nodes
+ ret += getText( node );
+ }
+ } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
+ // Use textContent for elements
+ // innerText usage removed for consistency of new lines (see #11153)
+ if ( typeof elem.textContent === "string" ) {
+ return elem.textContent;
+ } else {
+ // Traverse its children
+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
+ ret += getText( elem );
+ }
+ }
+ } else if ( nodeType === 3 || nodeType === 4 ) {
+ return elem.nodeValue;
+ }
+ // Do not include comment or processing instruction nodes
+
+ return ret;
+};
+
+Expr = Sizzle.selectors = {
+
+ // Can be adjusted by the user
+ cacheLength: 50,
+
+ createPseudo: markFunction,
+
+ match: matchExpr,
+
+ find: {},
+
+ relative: {
+ ">": { dir: "parentNode", first: true },
+ " ": { dir: "parentNode" },
+ "+": { dir: "previousSibling", first: true },
+ "~": { dir: "previousSibling" }
+ },
+
+ preFilter: {
+ "ATTR": function( match ) {
+ match[1] = match[1].replace( runescape, funescape );
+
+ // Move the given value to match[3] whether quoted or unquoted
+ match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
+
+ if ( match[2] === "~=" ) {
+ match[3] = " " + match[3] + " ";
+ }
+
+ return match.slice( 0, 4 );
+ },
+
+ "CHILD": function( match ) {
+ /* matches from matchExpr["CHILD"]
+ 1 type (only|nth|...)
+ 2 what (child|of-type)
+ 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
+ 4 xn-component of xn+y argument ([+-]?\d*n|)
+ 5 sign of xn-component
+ 6 x of xn-component
+ 7 sign of y-component
+ 8 y of y-component
+ */
+ match[1] = match[1].toLowerCase();
+
+ if ( match[1].slice( 0, 3 ) === "nth" ) {
+ // nth-* requires argument
+ if ( !match[3] ) {
+ Sizzle.error( match[0] );
+ }
+
+ // numeric x and y parameters for Expr.filter.CHILD
+ // remember that false/true cast respectively to 0/1
+ match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
+ match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
+
+ // other types prohibit arguments
+ } else if ( match[3] ) {
+ Sizzle.error( match[0] );
+ }
+
+ return match;
+ },
+
+ "PSEUDO": function( match ) {
+ var excess,
+ unquoted = !match[5] && match[2];
+
+ if ( matchExpr["CHILD"].test( match[0] ) ) {
+ return null;
+ }
+
+ // Accept quoted arguments as-is
+ if ( match[4] ) {
+ match[2] = match[4];
+
+ // Strip excess characters from unquoted arguments
+ } else if ( unquoted && rpseudo.test( unquoted ) &&
+ // Get excess from tokenize (recursively)
+ (excess = tokenize( unquoted, true )) &&
+ // advance to the next closing parenthesis
+ (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
+
+ // excess is a negative index
+ match[0] = match[0].slice( 0, excess );
+ match[2] = unquoted.slice( 0, excess );
+ }
+
+ // Return only captures needed by the pseudo filter method (type and argument)
+ return match.slice( 0, 3 );
+ }
+ },
+
+ filter: {
+
+ "TAG": function( nodeName ) {
+ if ( nodeName === "*" ) {
+ return function() { return true; };
+ }
+
+ nodeName = nodeName.replace( runescape, funescape ).toLowerCase();
+ return function( elem ) {
+ return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
+ };
+ },
+
+ "CLASS": function( className ) {
+ var pattern = classCache[ className + " " ];
+
+ return pattern ||
+ (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
+ classCache( className, function( elem ) {
+ return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
+ });
+ },
+
+ "ATTR": function( name, operator, check ) {
+ return function( elem ) {
+ var result = Sizzle.attr( elem, name );
+
+ if ( result == null ) {
+ return operator === "!=";
+ }
+ if ( !operator ) {
+ return true;
+ }
+
+ result += "";
+
+ return operator === "=" ? result === check :
+ operator === "!=" ? result !== check :
+ operator === "^=" ? check && result.indexOf( check ) === 0 :
+ operator === "*=" ? check && result.indexOf( check ) > -1 :
+ operator === "$=" ? check && result.slice( -check.length ) === check :
+ operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
+ operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
+ false;
+ };
+ },
+
+ "CHILD": function( type, what, argument, first, last ) {
+ var simple = type.slice( 0, 3 ) !== "nth",
+ forward = type.slice( -4 ) !== "last",
+ ofType = what === "of-type";
+
+ return first === 1 && last === 0 ?
+
+ // Shortcut for :nth-*(n)
+ function( elem ) {
+ return !!elem.parentNode;
+ } :
+
+ function( elem, context, xml ) {
+ var cache, outerCache, node, diff, nodeIndex, start,
+ dir = simple !== forward ? "nextSibling" : "previousSibling",
+ parent = elem.parentNode,
+ name = ofType && elem.nodeName.toLowerCase(),
+ useCache = !xml && !ofType;
+
+ if ( parent ) {
+
+ // :(first|last|only)-(child|of-type)
+ if ( simple ) {
+ while ( dir ) {
+ node = elem;
+ while ( (node = node[ dir ]) ) {
+ if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
+ return false;
+ }
+ }
+ // Reverse direction for :only-* (if we haven't yet done so)
+ start = dir = type === "only" && !start && "nextSibling";
+ }
+ return true;
+ }
+
+ start = [ forward ? parent.firstChild : parent.lastChild ];
+
+ // non-xml :nth-child(...) stores cache data on `parent`
+ if ( forward && useCache ) {
+ // Seek `elem` from a previously-cached index
+ outerCache = parent[ expando ] || (parent[ expando ] = {});
+ cache = outerCache[ type ] || [];
+ nodeIndex = cache[0] === dirruns && cache[1];
+ diff = cache[0] === dirruns && cache[2];
+ node = nodeIndex && parent.childNodes[ nodeIndex ];
+
+ while ( (node = ++nodeIndex && node && node[ dir ] ||
+
+ // Fallback to seeking `elem` from the start
+ (diff = nodeIndex = 0) || start.pop()) ) {
+
+ // When found, cache indexes on `parent` and break
+ if ( node.nodeType === 1 && ++diff && node === elem ) {
+ outerCache[ type ] = [ dirruns, nodeIndex, diff ];
+ break;
+ }
+ }
+
+ // Use previously-cached element index if available
+ } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
+ diff = cache[1];
+
+ // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
+ } else {
+ // Use the same loop as above to seek `elem` from the start
+ while ( (node = ++nodeIndex && node && node[ dir ] ||
+ (diff = nodeIndex = 0) || start.pop()) ) {
+
+ if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
+ // Cache the index of each encountered element
+ if ( useCache ) {
+ (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
+ }
+
+ if ( node === elem ) {
+ break;
+ }
+ }
+ }
+ }
+
+ // Incorporate the offset, then check against cycle size
+ diff -= last;
+ return diff === first || ( diff % first === 0 && diff / first >= 0 );
+ }
+ };
+ },
+
+ "PSEUDO": function( pseudo, argument ) {
+ // pseudo-class names are case-insensitive
+ // http://www.w3.org/TR/selectors/#pseudo-classes
+ // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
+ // Remember that setFilters inherits from pseudos
+ var args,
+ fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
+ Sizzle.error( "unsupported pseudo: " + pseudo );
+
+ // The user may use createPseudo to indicate that
+ // arguments are needed to create the filter function
+ // just as Sizzle does
+ if ( fn[ expando ] ) {
+ return fn( argument );
+ }
+
+ // But maintain support for old signatures
+ if ( fn.length > 1 ) {
+ args = [ pseudo, pseudo, "", argument ];
+ return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
+ markFunction(function( seed, matches ) {
+ var idx,
+ matched = fn( seed, argument ),
+ i = matched.length;
+ while ( i-- ) {
+ idx = indexOf.call( seed, matched[i] );
+ seed[ idx ] = !( matches[ idx ] = matched[i] );
+ }
+ }) :
+ function( elem ) {
+ return fn( elem, 0, args );
+ };
+ }
+
+ return fn;
+ }
+ },
+
+ pseudos: {
+ // Potentially complex pseudos
+ "not": markFunction(function( selector ) {
+ // Trim the selector passed to compile
+ // to avoid treating leading and trailing
+ // spaces as combinators
+ var input = [],
+ results = [],
+ matcher = compile( selector.replace( rtrim, "$1" ) );
+
+ return matcher[ expando ] ?
+ markFunction(function( seed, matches, context, xml ) {
+ var elem,
+ unmatched = matcher( seed, null, xml, [] ),
+ i = seed.length;
+
+ // Match elements unmatched by `matcher`
+ while ( i-- ) {
+ if ( (elem = unmatched[i]) ) {
+ seed[i] = !(matches[i] = elem);
+ }
+ }
+ }) :
+ function( elem, context, xml ) {
+ input[0] = elem;
+ matcher( input, null, xml, results );
+ return !results.pop();
+ };
+ }),
+
+ "has": markFunction(function( selector ) {
+ return function( elem ) {
+ return Sizzle( selector, elem ).length > 0;
+ };
+ }),
+
+ "contains": markFunction(function( text ) {
+ return function( elem ) {
+ return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
+ };
+ }),
+
+ // "Whether an element is represented by a :lang() selector
+ // is based solely on the element's language value
+ // being equal to the identifier C,
+ // or beginning with the identifier C immediately followed by "-".
+ // The matching of C against the element's language value is performed case-insensitively.
+ // The identifier C does not have to be a valid language name."
+ // http://www.w3.org/TR/selectors/#lang-pseudo
+ "lang": markFunction( function( lang ) {
+ // lang value must be a valid identifider
+ if ( !ridentifier.test(lang || "") ) {
+ Sizzle.error( "unsupported lang: " + lang );
+ }
+ lang = lang.replace( runescape, funescape ).toLowerCase();
+ return function( elem ) {
+ var elemLang;
+ do {
+ if ( (elemLang = documentIsXML ?
+ elem.getAttribute("xml:lang") || elem.getAttribute("lang") :
+ elem.lang) ) {
+
+ elemLang = elemLang.toLowerCase();
+ return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
+ }
+ } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
+ return false;
+ };
+ }),
+
+ // Miscellaneous
+ "target": function( elem ) {
+ var hash = window.location && window.location.hash;
+ return hash && hash.slice( 1 ) === elem.id;
+ },
+
+ "root": function( elem ) {
+ return elem === docElem;
+ },
+
+ "focus": function( elem ) {
+ return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
+ },
+
+ // Boolean properties
+ "enabled": function( elem ) {
+ return elem.disabled === false;
+ },
+
+ "disabled": function( elem ) {
+ return elem.disabled === true;
+ },
+
+ "checked": function( elem ) {
+ // In CSS3, :checked should return both checked and selected elements
+ // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
+ var nodeName = elem.nodeName.toLowerCase();
+ return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
+ },
+
+ "selected": function( elem ) {
+ // Accessing this property makes selected-by-default
+ // options in Safari work properly
+ if ( elem.parentNode ) {
+ elem.parentNode.selectedIndex;
+ }
+
+ return elem.selected === true;
+ },
+
+ // Contents
+ "empty": function( elem ) {
+ // http://www.w3.org/TR/selectors/#empty-pseudo
+ // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
+ // not comment, processing instructions, or others
+ // Thanks to Diego Perini for the nodeName shortcut
+ // Greater than "@" means alpha characters (specifically not starting with "#" or "?")
+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
+ if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) {
+ return false;
+ }
+ }
+ return true;
+ },
+
+ "parent": function( elem ) {
+ return !Expr.pseudos["empty"]( elem );
+ },
+
+ // Element/input types
+ "header": function( elem ) {
+ return rheader.test( elem.nodeName );
+ },
+
+ "input": function( elem ) {
+ return rinputs.test( elem.nodeName );
+ },
+
+ "button": function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return name === "input" && elem.type === "button" || name === "button";
+ },
+
+ "text": function( elem ) {
+ var attr;
+ // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
+ // use getAttribute instead to test this case
+ return elem.nodeName.toLowerCase() === "input" &&
+ elem.type === "text" &&
+ ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type );
+ },
+
+ // Position-in-collection
+ "first": createPositionalPseudo(function() {
+ return [ 0 ];
+ }),
+
+ "last": createPositionalPseudo(function( matchIndexes, length ) {
+ return [ length - 1 ];
+ }),
+
+ "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ return [ argument < 0 ? argument + length : argument ];
+ }),
+
+ "even": createPositionalPseudo(function( matchIndexes, length ) {
+ var i = 0;
+ for ( ; i < length; i += 2 ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ }),
+
+ "odd": createPositionalPseudo(function( matchIndexes, length ) {
+ var i = 1;
+ for ( ; i < length; i += 2 ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ }),
+
+ "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ var i = argument < 0 ? argument + length : argument;
+ for ( ; --i >= 0; ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ }),
+
+ "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ var i = argument < 0 ? argument + length : argument;
+ for ( ; ++i < length; ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ })
+ }
+};
+
+// Add button/input type pseudos
+for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
+ Expr.pseudos[ i ] = createInputPseudo( i );
+}
+for ( i in { submit: true, reset: true } ) {
+ Expr.pseudos[ i ] = createButtonPseudo( i );
+}
+
+function tokenize( selector, parseOnly ) {
+ var matched, match, tokens, type,
+ soFar, groups, preFilters,
+ cached = tokenCache[ selector + " " ];
+
+ if ( cached ) {
+ return parseOnly ? 0 : cached.slice( 0 );
+ }
+
+ soFar = selector;
+ groups = [];
+ preFilters = Expr.preFilter;
+
+ while ( soFar ) {
+
+ // Comma and first run
+ if ( !matched || (match = rcomma.exec( soFar )) ) {
+ if ( match ) {
+ // Don't consume trailing commas as valid
+ soFar = soFar.slice( match[0].length ) || soFar;
+ }
+ groups.push( tokens = [] );
+ }
+
+ matched = false;
+
+ // Combinators
+ if ( (match = rcombinators.exec( soFar )) ) {
+ matched = match.shift();
+ tokens.push( {
+ value: matched,
+ // Cast descendant combinators to space
+ type: match[0].replace( rtrim, " " )
+ } );
+ soFar = soFar.slice( matched.length );
+ }
+
+ // Filters
+ for ( type in Expr.filter ) {
+ if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
+ (match = preFilters[ type ]( match ))) ) {
+ matched = match.shift();
+ tokens.push( {
+ value: matched,
+ type: type,
+ matches: match
+ } );
+ soFar = soFar.slice( matched.length );
+ }
+ }
+
+ if ( !matched ) {
+ break;
+ }
+ }
+
+ // Return the length of the invalid excess
+ // if we're just parsing
+ // Otherwise, throw an error or return tokens
+ return parseOnly ?
+ soFar.length :
+ soFar ?
+ Sizzle.error( selector ) :
+ // Cache the tokens
+ tokenCache( selector, groups ).slice( 0 );
+}
+
+function toSelector( tokens ) {
+ var i = 0,
+ len = tokens.length,
+ selector = "";
+ for ( ; i < len; i++ ) {
+ selector += tokens[i].value;
+ }
+ return selector;
+}
+
+function addCombinator( matcher, combinator, base ) {
+ var dir = combinator.dir,
+ checkNonElements = base && dir === "parentNode",
+ doneName = done++;
+
+ return combinator.first ?
+ // Check against closest ancestor/preceding element
+ function( elem, context, xml ) {
+ while ( (elem = elem[ dir ]) ) {
+ if ( elem.nodeType === 1 || checkNonElements ) {
+ return matcher( elem, context, xml );
+ }
+ }
+ } :
+
+ // Check against all ancestor/preceding elements
+ function( elem, context, xml ) {
+ var data, cache, outerCache,
+ dirkey = dirruns + " " + doneName;
+
+ // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
+ if ( xml ) {
+ while ( (elem = elem[ dir ]) ) {
+ if ( elem.nodeType === 1 || checkNonElements ) {
+ if ( matcher( elem, context, xml ) ) {
+ return true;
+ }
+ }
+ }
+ } else {
+ while ( (elem = elem[ dir ]) ) {
+ if ( elem.nodeType === 1 || checkNonElements ) {
+ outerCache = elem[ expando ] || (elem[ expando ] = {});
+ if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) {
+ if ( (data = cache[1]) === true || data === cachedruns ) {
+ return data === true;
+ }
+ } else {
+ cache = outerCache[ dir ] = [ dirkey ];
+ cache[1] = matcher( elem, context, xml ) || cachedruns;
+ if ( cache[1] === true ) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ };
+}
+
+function elementMatcher( matchers ) {
+ return matchers.length > 1 ?
+ function( elem, context, xml ) {
+ var i = matchers.length;
+ while ( i-- ) {
+ if ( !matchers[i]( elem, context, xml ) ) {
+ return false;
+ }
+ }
+ return true;
+ } :
+ matchers[0];
+}
+
+function condense( unmatched, map, filter, context, xml ) {
+ var elem,
+ newUnmatched = [],
+ i = 0,
+ len = unmatched.length,
+ mapped = map != null;
+
+ for ( ; i < len; i++ ) {
+ if ( (elem = unmatched[i]) ) {
+ if ( !filter || filter( elem, context, xml ) ) {
+ newUnmatched.push( elem );
+ if ( mapped ) {
+ map.push( i );
+ }
+ }
+ }
+ }
+
+ return newUnmatched;
+}
+
+function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
+ if ( postFilter && !postFilter[ expando ] ) {
+ postFilter = setMatcher( postFilter );
+ }
+ if ( postFinder && !postFinder[ expando ] ) {
+ postFinder = setMatcher( postFinder, postSelector );
+ }
+ return markFunction(function( seed, results, context, xml ) {
+ var temp, i, elem,
+ preMap = [],
+ postMap = [],
+ preexisting = results.length,
+
+ // Get initial elements from seed or context
+ elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
+
+ // Prefilter to get matcher input, preserving a map for seed-results synchronization
+ matcherIn = preFilter && ( seed || !selector ) ?
+ condense( elems, preMap, preFilter, context, xml ) :
+ elems,
+
+ matcherOut = matcher ?
+ // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
+ postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
+
+ // ...intermediate processing is necessary
+ [] :
+
+ // ...otherwise use results directly
+ results :
+ matcherIn;
+
+ // Find primary matches
+ if ( matcher ) {
+ matcher( matcherIn, matcherOut, context, xml );
+ }
+
+ // Apply postFilter
+ if ( postFilter ) {
+ temp = condense( matcherOut, postMap );
+ postFilter( temp, [], context, xml );
+
+ // Un-match failing elements by moving them back to matcherIn
+ i = temp.length;
+ while ( i-- ) {
+ if ( (elem = temp[i]) ) {
+ matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
+ }
+ }
+ }
+
+ if ( seed ) {
+ if ( postFinder || preFilter ) {
+ if ( postFinder ) {
+ // Get the final matcherOut by condensing this intermediate into postFinder contexts
+ temp = [];
+ i = matcherOut.length;
+ while ( i-- ) {
+ if ( (elem = matcherOut[i]) ) {
+ // Restore matcherIn since elem is not yet a final match
+ temp.push( (matcherIn[i] = elem) );
+ }
+ }
+ postFinder( null, (matcherOut = []), temp, xml );
+ }
+
+ // Move matched elements from seed to results to keep them synchronized
+ i = matcherOut.length;
+ while ( i-- ) {
+ if ( (elem = matcherOut[i]) &&
+ (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
+
+ seed[temp] = !(results[temp] = elem);
+ }
+ }
+ }
+
+ // Add elements to results, through postFinder if defined
+ } else {
+ matcherOut = condense(
+ matcherOut === results ?
+ matcherOut.splice( preexisting, matcherOut.length ) :
+ matcherOut
+ );
+ if ( postFinder ) {
+ postFinder( null, results, matcherOut, xml );
+ } else {
+ push.apply( results, matcherOut );
+ }
+ }
+ });
+}
+
+function matcherFromTokens( tokens ) {
+ var checkContext, matcher, j,
+ len = tokens.length,
+ leadingRelative = Expr.relative[ tokens[0].type ],
+ implicitRelative = leadingRelative || Expr.relative[" "],
+ i = leadingRelative ? 1 : 0,
+
+ // The foundational matcher ensures that elements are reachable from top-level context(s)
+ matchContext = addCombinator( function( elem ) {
+ return elem === checkContext;
+ }, implicitRelative, true ),
+ matchAnyContext = addCombinator( function( elem ) {
+ return indexOf.call( checkContext, elem ) > -1;
+ }, implicitRelative, true ),
+ matchers = [ function( elem, context, xml ) {
+ return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
+ (checkContext = context).nodeType ?
+ matchContext( elem, context, xml ) :
+ matchAnyContext( elem, context, xml ) );
+ } ];
+
+ for ( ; i < len; i++ ) {
+ if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
+ matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
+ } else {
+ matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
+
+ // Return special upon seeing a positional matcher
+ if ( matcher[ expando ] ) {
+ // Find the next relative operator (if any) for proper handling
+ j = ++i;
+ for ( ; j < len; j++ ) {
+ if ( Expr.relative[ tokens[j].type ] ) {
+ break;
+ }
+ }
+ return setMatcher(
+ i > 1 && elementMatcher( matchers ),
+ i > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ),
+ matcher,
+ i < j && matcherFromTokens( tokens.slice( i, j ) ),
+ j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
+ j < len && toSelector( tokens )
+ );
+ }
+ matchers.push( matcher );
+ }
+ }
+
+ return elementMatcher( matchers );
+}
+
+function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
+ // A counter to specify which element is currently being matched
+ var matcherCachedRuns = 0,
+ bySet = setMatchers.length > 0,
+ byElement = elementMatchers.length > 0,
+ superMatcher = function( seed, context, xml, results, expandContext ) {
+ var elem, j, matcher,
+ setMatched = [],
+ matchedCount = 0,
+ i = "0",
+ unmatched = seed && [],
+ outermost = expandContext != null,
+ contextBackup = outermostContext,
+ // We must always have either seed elements or context
+ elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
+ // Use integer dirruns iff this is the outermost matcher
+ dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1);
+
+ if ( outermost ) {
+ outermostContext = context !== document && context;
+ cachedruns = matcherCachedRuns;
+ }
+
+ // Add elements passing elementMatchers directly to results
+ // Keep `i` a string if there are no elements so `matchedCount` will be "00" below
+ for ( ; (elem = elems[i]) != null; i++ ) {
+ if ( byElement && elem ) {
+ j = 0;
+ while ( (matcher = elementMatchers[j++]) ) {
+ if ( matcher( elem, context, xml ) ) {
+ results.push( elem );
+ break;
+ }
+ }
+ if ( outermost ) {
+ dirruns = dirrunsUnique;
+ cachedruns = ++matcherCachedRuns;
+ }
+ }
+
+ // Track unmatched elements for set filters
+ if ( bySet ) {
+ // They will have gone through all possible matchers
+ if ( (elem = !matcher && elem) ) {
+ matchedCount--;
+ }
+
+ // Lengthen the array for every element, matched or not
+ if ( seed ) {
+ unmatched.push( elem );
+ }
+ }
+ }
+
+ // Apply set filters to unmatched elements
+ matchedCount += i;
+ if ( bySet && i !== matchedCount ) {
+ j = 0;
+ while ( (matcher = setMatchers[j++]) ) {
+ matcher( unmatched, setMatched, context, xml );
+ }
+
+ if ( seed ) {
+ // Reintegrate element matches to eliminate the need for sorting
+ if ( matchedCount > 0 ) {
+ while ( i-- ) {
+ if ( !(unmatched[i] || setMatched[i]) ) {
+ setMatched[i] = pop.call( results );
+ }
+ }
+ }
+
+ // Discard index placeholder values to get only actual matches
+ setMatched = condense( setMatched );
+ }
+
+ // Add matches to results
+ push.apply( results, setMatched );
+
+ // Seedless set matches succeeding multiple successful matchers stipulate sorting
+ if ( outermost && !seed && setMatched.length > 0 &&
+ ( matchedCount + setMatchers.length ) > 1 ) {
+
+ Sizzle.uniqueSort( results );
+ }
+ }
+
+ // Override manipulation of globals by nested matchers
+ if ( outermost ) {
+ dirruns = dirrunsUnique;
+ outermostContext = contextBackup;
+ }
+
+ return unmatched;
+ };
+
+ return bySet ?
+ markFunction( superMatcher ) :
+ superMatcher;
+}
+
+compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
+ var i,
+ setMatchers = [],
+ elementMatchers = [],
+ cached = compilerCache[ selector + " " ];
+
+ if ( !cached ) {
+ // Generate a function of recursive functions that can be used to check each element
+ if ( !group ) {
+ group = tokenize( selector );
+ }
+ i = group.length;
+ while ( i-- ) {
+ cached = matcherFromTokens( group[i] );
+ if ( cached[ expando ] ) {
+ setMatchers.push( cached );
+ } else {
+ elementMatchers.push( cached );
+ }
+ }
+
+ // Cache the compiled function
+ cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
+ }
+ return cached;
+};
+
+function multipleContexts( selector, contexts, results ) {
+ var i = 0,
+ len = contexts.length;
+ for ( ; i < len; i++ ) {
+ Sizzle( selector, contexts[i], results );
+ }
+ return results;
+}
+
+function select( selector, context, results, seed ) {
+ var i, tokens, token, type, find,
+ match = tokenize( selector );
+
+ if ( !seed ) {
+ // Try to minimize operations if there is only one group
+ if ( match.length === 1 ) {
+
+ // Take a shortcut and set the context if the root selector is an ID
+ tokens = match[0] = match[0].slice( 0 );
+ if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
+ context.nodeType === 9 && !documentIsXML &&
+ Expr.relative[ tokens[1].type ] ) {
+
+ context = Expr.find["ID"]( token.matches[0].replace( runescape, funescape ), context )[0];
+ if ( !context ) {
+ return results;
+ }
+
+ selector = selector.slice( tokens.shift().value.length );
+ }
+
+ // Fetch a seed set for right-to-left matching
+ i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
+ while ( i-- ) {
+ token = tokens[i];
+
+ // Abort if we hit a combinator
+ if ( Expr.relative[ (type = token.type) ] ) {
+ break;
+ }
+ if ( (find = Expr.find[ type ]) ) {
+ // Search, expanding context for leading sibling combinators
+ if ( (seed = find(
+ token.matches[0].replace( runescape, funescape ),
+ rsibling.test( tokens[0].type ) && context.parentNode || context
+ )) ) {
+
+ // If seed is empty or no tokens remain, we can return early
+ tokens.splice( i, 1 );
+ selector = seed.length && toSelector( tokens );
+ if ( !selector ) {
+ push.apply( results, slice.call( seed, 0 ) );
+ return results;
+ }
+
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ // Compile and execute a filtering function
+ // Provide `match` to avoid retokenization if we modified the selector above
+ compile( selector, match )(
+ seed,
+ context,
+ documentIsXML,
+ results,
+ rsibling.test( selector )
+ );
+ return results;
+}
+
+// Deprecated
+Expr.pseudos["nth"] = Expr.pseudos["eq"];
+
+// Easy API for creating new setFilters
+function setFilters() {}
+Expr.filters = setFilters.prototype = Expr.pseudos;
+Expr.setFilters = new setFilters();
+
+// Initialize with the default document
+setDocument();
+
+// Override sizzle attribute retrieval
+Sizzle.attr = jQuery.attr;
+jQuery.find = Sizzle;
+jQuery.expr = Sizzle.selectors;
+jQuery.expr[":"] = jQuery.expr.pseudos;
+jQuery.unique = Sizzle.uniqueSort;
+jQuery.text = Sizzle.getText;
+jQuery.isXMLDoc = Sizzle.isXML;
+jQuery.contains = Sizzle.contains;
+
+
+})( window );
+var runtil = /Until$/,
+ rparentsprev = /^(?:parents|prev(?:Until|All))/,
+ isSimple = /^.[^:#\[\.,]*$/,
+ rneedsContext = jQuery.expr.match.needsContext,
+ // methods guaranteed to produce a unique set when starting from a unique set
+ guaranteedUnique = {
+ children: true,
+ contents: true,
+ next: true,
+ prev: true
+ };
+
+jQuery.fn.extend({
+ find: function( selector ) {
+ var i, ret, self,
+ len = this.length;
+
+ if ( typeof selector !== "string" ) {
+ self = this;
+ return this.pushStack( jQuery( selector ).filter(function() {
+ for ( i = 0; i < len; i++ ) {
+ if ( jQuery.contains( self[ i ], this ) ) {
+ return true;
+ }
+ }
+ }) );
+ }
+
+ ret = [];
+ for ( i = 0; i < len; i++ ) {
+ jQuery.find( selector, this[ i ], ret );
+ }
+
+ // Needed because $( selector, context ) becomes $( context ).find( selector )
+ ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
+ ret.selector = ( this.selector ? this.selector + " " : "" ) + selector;
+ return ret;
+ },
+
+ has: function( target ) {
+ var i,
+ targets = jQuery( target, this ),
+ len = targets.length;
+
+ return this.filter(function() {
+ for ( i = 0; i < len; i++ ) {
+ if ( jQuery.contains( this, targets[i] ) ) {
+ return true;
+ }
+ }
+ });
+ },
+
+ not: function( selector ) {
+ return this.pushStack( winnow(this, selector, false) );
+ },
+
+ filter: function( selector ) {
+ return this.pushStack( winnow(this, selector, true) );
+ },
+
+ is: function( selector ) {
+ return !!selector && (
+ typeof selector === "string" ?
+ // If this is a positional/relative selector, check membership in the returned set
+ // so $("p:first").is("p:last") won't return true for a doc with two "p".
+ rneedsContext.test( selector ) ?
+ jQuery( selector, this.context ).index( this[0] ) >= 0 :
+ jQuery.filter( selector, this ).length > 0 :
+ this.filter( selector ).length > 0 );
+ },
+
+ closest: function( selectors, context ) {
+ var cur,
+ i = 0,
+ l = this.length,
+ ret = [],
+ pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
+ jQuery( selectors, context || this.context ) :
+ 0;
+
+ for ( ; i < l; i++ ) {
+ cur = this[i];
+
+ while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) {
+ if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
+ ret.push( cur );
+ break;
+ }
+ cur = cur.parentNode;
+ }
+ }
+
+ return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret );
+ },
+
+ // Determine the position of an element within
+ // the matched set of elements
+ index: function( elem ) {
+
+ // No argument, return index in parent
+ if ( !elem ) {
+ return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1;
+ }
+
+ // index in selector
+ if ( typeof elem === "string" ) {
+ return jQuery.inArray( this[0], jQuery( elem ) );
+ }
+
+ // Locate the position of the desired element
+ return jQuery.inArray(
+ // If it receives a jQuery object, the first element is used
+ elem.jquery ? elem[0] : elem, this );
+ },
+
+ add: function( selector, context ) {
+ var set = typeof selector === "string" ?
+ jQuery( selector, context ) :
+ jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
+ all = jQuery.merge( this.get(), set );
+
+ return this.pushStack( jQuery.unique(all) );
+ },
+
+ addBack: function( selector ) {
+ return this.add( selector == null ?
+ this.prevObject : this.prevObject.filter(selector)
+ );
+ }
+});
+
+jQuery.fn.andSelf = jQuery.fn.addBack;
+
+function sibling( cur, dir ) {
+ do {
+ cur = cur[ dir ];
+ } while ( cur && cur.nodeType !== 1 );
+
+ return cur;
+}
+
+jQuery.each({
+ parent: function( elem ) {
+ var parent = elem.parentNode;
+ return parent && parent.nodeType !== 11 ? parent : null;
+ },
+ parents: function( elem ) {
+ return jQuery.dir( elem, "parentNode" );
+ },
+ parentsUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "parentNode", until );
+ },
+ next: function( elem ) {
+ return sibling( elem, "nextSibling" );
+ },
+ prev: function( elem ) {
+ return sibling( elem, "previousSibling" );
+ },
+ nextAll: function( elem ) {
+ return jQuery.dir( elem, "nextSibling" );
+ },
+ prevAll: function( elem ) {
+ return jQuery.dir( elem, "previousSibling" );
+ },
+ nextUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "nextSibling", until );
+ },
+ prevUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "previousSibling", until );
+ },
+ siblings: function( elem ) {
+ return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
+ },
+ children: function( elem ) {
+ return jQuery.sibling( elem.firstChild );
+ },
+ contents: function( elem ) {
+ return jQuery.nodeName( elem, "iframe" ) ?
+ elem.contentDocument || elem.contentWindow.document :
+ jQuery.merge( [], elem.childNodes );
+ }
+}, function( name, fn ) {
+ jQuery.fn[ name ] = function( until, selector ) {
+ var ret = jQuery.map( this, fn, until );
+
+ if ( !runtil.test( name ) ) {
+ selector = until;
+ }
+
+ if ( selector && typeof selector === "string" ) {
+ ret = jQuery.filter( selector, ret );
+ }
+
+ ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
+
+ if ( this.length > 1 && rparentsprev.test( name ) ) {
+ ret = ret.reverse();
+ }
+
+ return this.pushStack( ret );
+ };
+});
+
+jQuery.extend({
+ filter: function( expr, elems, not ) {
+ if ( not ) {
+ expr = ":not(" + expr + ")";
+ }
+
+ return elems.length === 1 ?
+ jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
+ jQuery.find.matches(expr, elems);
+ },
+
+ dir: function( elem, dir, until ) {
+ var matched = [],
+ cur = elem[ dir ];
+
+ while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
+ if ( cur.nodeType === 1 ) {
+ matched.push( cur );
+ }
+ cur = cur[dir];
+ }
+ return matched;
+ },
+
+ sibling: function( n, elem ) {
+ var r = [];
+
+ for ( ; n; n = n.nextSibling ) {
+ if ( n.nodeType === 1 && n !== elem ) {
+ r.push( n );
+ }
+ }
+
+ return r;
+ }
+});
+
+// Implement the identical functionality for filter and not
+function winnow( elements, qualifier, keep ) {
+
+ // Can't pass null or undefined to indexOf in Firefox 4
+ // Set to 0 to skip string check
+ qualifier = qualifier || 0;
+
+ if ( jQuery.isFunction( qualifier ) ) {
+ return jQuery.grep(elements, function( elem, i ) {
+ var retVal = !!qualifier.call( elem, i, elem );
+ return retVal === keep;
+ });
+
+ } else if ( qualifier.nodeType ) {
+ return jQuery.grep(elements, function( elem ) {
+ return ( elem === qualifier ) === keep;
+ });
+
+ } else if ( typeof qualifier === "string" ) {
+ var filtered = jQuery.grep(elements, function( elem ) {
+ return elem.nodeType === 1;
+ });
+
+ if ( isSimple.test( qualifier ) ) {
+ return jQuery.filter(qualifier, filtered, !keep);
+ } else {
+ qualifier = jQuery.filter( qualifier, filtered );
+ }
+ }
+
+ return jQuery.grep(elements, function( elem ) {
+ return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
+ });
+}
+function createSafeFragment( document ) {
+ var list = nodeNames.split( "|" ),
+ safeFrag = document.createDocumentFragment();
+
+ if ( safeFrag.createElement ) {
+ while ( list.length ) {
+ safeFrag.createElement(
+ list.pop()
+ );
+ }
+ }
+ return safeFrag;
+}
+
+var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
+ "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
+ rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
+ rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
+ rleadingWhitespace = /^\s+/,
+ rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
+ rtagName = /<([\w:]+)/,
+ rtbody = /\s*$/g,
+
+ // We have to close these tags to support XHTML (#13200)
+ wrapMap = {
+ option: [ 1, "", " " ],
+ legend: [ 1, "", " " ],
+ area: [ 1, "", " " ],
+ param: [ 1, "", " " ],
+ thead: [ 1, "" ],
+ tr: [ 2, "" ],
+ col: [ 2, "" ],
+ td: [ 3, "" ],
+
+ // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
+ // unless wrapped in a div with non-breaking characters in front of it.
+ _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X", "
" ]
+ },
+ safeFragment = createSafeFragment( document ),
+ fragmentDiv = safeFragment.appendChild( document.createElement("div") );
+
+wrapMap.optgroup = wrapMap.option;
+wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
+wrapMap.th = wrapMap.td;
+
+jQuery.fn.extend({
+ text: function( value ) {
+ return jQuery.access( this, function( value ) {
+ return value === undefined ?
+ jQuery.text( this ) :
+ this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
+ }, null, value, arguments.length );
+ },
+
+ wrapAll: function( html ) {
+ if ( jQuery.isFunction( html ) ) {
+ return this.each(function(i) {
+ jQuery(this).wrapAll( html.call(this, i) );
+ });
+ }
+
+ if ( this[0] ) {
+ // The elements to wrap the target around
+ var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
+
+ if ( this[0].parentNode ) {
+ wrap.insertBefore( this[0] );
+ }
+
+ wrap.map(function() {
+ var elem = this;
+
+ while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
+ elem = elem.firstChild;
+ }
+
+ return elem;
+ }).append( this );
+ }
+
+ return this;
+ },
+
+ wrapInner: function( html ) {
+ if ( jQuery.isFunction( html ) ) {
+ return this.each(function(i) {
+ jQuery(this).wrapInner( html.call(this, i) );
+ });
+ }
+
+ return this.each(function() {
+ var self = jQuery( this ),
+ contents = self.contents();
+
+ if ( contents.length ) {
+ contents.wrapAll( html );
+
+ } else {
+ self.append( html );
+ }
+ });
+ },
+
+ wrap: function( html ) {
+ var isFunction = jQuery.isFunction( html );
+
+ return this.each(function(i) {
+ jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
+ });
+ },
+
+ unwrap: function() {
+ return this.parent().each(function() {
+ if ( !jQuery.nodeName( this, "body" ) ) {
+ jQuery( this ).replaceWith( this.childNodes );
+ }
+ }).end();
+ },
+
+ append: function() {
+ return this.domManip(arguments, true, function( elem ) {
+ if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
+ this.appendChild( elem );
+ }
+ });
+ },
+
+ prepend: function() {
+ return this.domManip(arguments, true, function( elem ) {
+ if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
+ this.insertBefore( elem, this.firstChild );
+ }
+ });
+ },
+
+ before: function() {
+ return this.domManip( arguments, false, function( elem ) {
+ if ( this.parentNode ) {
+ this.parentNode.insertBefore( elem, this );
+ }
+ });
+ },
+
+ after: function() {
+ return this.domManip( arguments, false, function( elem ) {
+ if ( this.parentNode ) {
+ this.parentNode.insertBefore( elem, this.nextSibling );
+ }
+ });
+ },
+
+ // keepData is for internal use only--do not document
+ remove: function( selector, keepData ) {
+ var elem,
+ i = 0;
+
+ for ( ; (elem = this[i]) != null; i++ ) {
+ if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) {
+ if ( !keepData && elem.nodeType === 1 ) {
+ jQuery.cleanData( getAll( elem ) );
+ }
+
+ if ( elem.parentNode ) {
+ if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
+ setGlobalEval( getAll( elem, "script" ) );
+ }
+ elem.parentNode.removeChild( elem );
+ }
+ }
+ }
+
+ return this;
+ },
+
+ empty: function() {
+ var elem,
+ i = 0;
+
+ for ( ; (elem = this[i]) != null; i++ ) {
+ // Remove element nodes and prevent memory leaks
+ if ( elem.nodeType === 1 ) {
+ jQuery.cleanData( getAll( elem, false ) );
+ }
+
+ // Remove any remaining nodes
+ while ( elem.firstChild ) {
+ elem.removeChild( elem.firstChild );
+ }
+
+ // If this is a select, ensure that it displays empty (#12336)
+ // Support: IE<9
+ if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
+ elem.options.length = 0;
+ }
+ }
+
+ return this;
+ },
+
+ clone: function( dataAndEvents, deepDataAndEvents ) {
+ dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
+ deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
+
+ return this.map( function () {
+ return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
+ });
+ },
+
+ html: function( value ) {
+ return jQuery.access( this, function( value ) {
+ var elem = this[0] || {},
+ i = 0,
+ l = this.length;
+
+ if ( value === undefined ) {
+ return elem.nodeType === 1 ?
+ elem.innerHTML.replace( rinlinejQuery, "" ) :
+ undefined;
+ }
+
+ // See if we can take a shortcut and just use innerHTML
+ if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
+ ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&
+ ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
+ !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
+
+ value = value.replace( rxhtmlTag, "<$1>$2>" );
+
+ try {
+ for (; i < l; i++ ) {
+ // Remove element nodes and prevent memory leaks
+ elem = this[i] || {};
+ if ( elem.nodeType === 1 ) {
+ jQuery.cleanData( getAll( elem, false ) );
+ elem.innerHTML = value;
+ }
+ }
+
+ elem = 0;
+
+ // If using innerHTML throws an exception, use the fallback method
+ } catch(e) {}
+ }
+
+ if ( elem ) {
+ this.empty().append( value );
+ }
+ }, null, value, arguments.length );
+ },
+
+ replaceWith: function( value ) {
+ var isFunc = jQuery.isFunction( value );
+
+ // Make sure that the elements are removed from the DOM before they are inserted
+ // this can help fix replacing a parent with child elements
+ if ( !isFunc && typeof value !== "string" ) {
+ value = jQuery( value ).not( this ).detach();
+ }
+
+ return this.domManip( [ value ], true, function( elem ) {
+ var next = this.nextSibling,
+ parent = this.parentNode;
+
+ if ( parent ) {
+ jQuery( this ).remove();
+ parent.insertBefore( elem, next );
+ }
+ });
+ },
+
+ detach: function( selector ) {
+ return this.remove( selector, true );
+ },
+
+ domManip: function( args, table, callback ) {
+
+ // Flatten any nested arrays
+ args = core_concat.apply( [], args );
+
+ var first, node, hasScripts,
+ scripts, doc, fragment,
+ i = 0,
+ l = this.length,
+ set = this,
+ iNoClone = l - 1,
+ value = args[0],
+ isFunction = jQuery.isFunction( value );
+
+ // We can't cloneNode fragments that contain checked, in WebKit
+ if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) {
+ return this.each(function( index ) {
+ var self = set.eq( index );
+ if ( isFunction ) {
+ args[0] = value.call( this, index, table ? self.html() : undefined );
+ }
+ self.domManip( args, table, callback );
+ });
+ }
+
+ if ( l ) {
+ fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
+ first = fragment.firstChild;
+
+ if ( fragment.childNodes.length === 1 ) {
+ fragment = first;
+ }
+
+ if ( first ) {
+ table = table && jQuery.nodeName( first, "tr" );
+ scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
+ hasScripts = scripts.length;
+
+ // Use the original fragment for the last item instead of the first because it can end up
+ // being emptied incorrectly in certain situations (#8070).
+ for ( ; i < l; i++ ) {
+ node = fragment;
+
+ if ( i !== iNoClone ) {
+ node = jQuery.clone( node, true, true );
+
+ // Keep references to cloned scripts for later restoration
+ if ( hasScripts ) {
+ jQuery.merge( scripts, getAll( node, "script" ) );
+ }
+ }
+
+ callback.call(
+ table && jQuery.nodeName( this[i], "table" ) ?
+ findOrAppend( this[i], "tbody" ) :
+ this[i],
+ node,
+ i
+ );
+ }
+
+ if ( hasScripts ) {
+ doc = scripts[ scripts.length - 1 ].ownerDocument;
+
+ // Reenable scripts
+ jQuery.map( scripts, restoreScript );
+
+ // Evaluate executable scripts on first document insertion
+ for ( i = 0; i < hasScripts; i++ ) {
+ node = scripts[ i ];
+ if ( rscriptType.test( node.type || "" ) &&
+ !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
+
+ if ( node.src ) {
+ // Hope ajax is available...
+ jQuery.ajax({
+ url: node.src,
+ type: "GET",
+ dataType: "script",
+ async: false,
+ global: false,
+ "throws": true
+ });
+ } else {
+ jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );
+ }
+ }
+ }
+ }
+
+ // Fix #11809: Avoid leaking memory
+ fragment = first = null;
+ }
+ }
+
+ return this;
+ }
+});
+
+function findOrAppend( elem, tag ) {
+ return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) );
+}
+
+// Replace/restore the type attribute of script elements for safe DOM manipulation
+function disableScript( elem ) {
+ var attr = elem.getAttributeNode("type");
+ elem.type = ( attr && attr.specified ) + "/" + elem.type;
+ return elem;
+}
+function restoreScript( elem ) {
+ var match = rscriptTypeMasked.exec( elem.type );
+ if ( match ) {
+ elem.type = match[1];
+ } else {
+ elem.removeAttribute("type");
+ }
+ return elem;
+}
+
+// Mark scripts as having already been evaluated
+function setGlobalEval( elems, refElements ) {
+ var elem,
+ i = 0;
+ for ( ; (elem = elems[i]) != null; i++ ) {
+ jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
+ }
+}
+
+function cloneCopyEvent( src, dest ) {
+
+ if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
+ return;
+ }
+
+ var type, i, l,
+ oldData = jQuery._data( src ),
+ curData = jQuery._data( dest, oldData ),
+ events = oldData.events;
+
+ if ( events ) {
+ delete curData.handle;
+ curData.events = {};
+
+ for ( type in events ) {
+ for ( i = 0, l = events[ type ].length; i < l; i++ ) {
+ jQuery.event.add( dest, type, events[ type ][ i ] );
+ }
+ }
+ }
+
+ // make the cloned public data object a copy from the original
+ if ( curData.data ) {
+ curData.data = jQuery.extend( {}, curData.data );
+ }
+}
+
+function fixCloneNodeIssues( src, dest ) {
+ var nodeName, e, data;
+
+ // We do not need to do anything for non-Elements
+ if ( dest.nodeType !== 1 ) {
+ return;
+ }
+
+ nodeName = dest.nodeName.toLowerCase();
+
+ // IE6-8 copies events bound via attachEvent when using cloneNode.
+ if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) {
+ data = jQuery._data( dest );
+
+ for ( e in data.events ) {
+ jQuery.removeEvent( dest, e, data.handle );
+ }
+
+ // Event data gets referenced instead of copied if the expando gets copied too
+ dest.removeAttribute( jQuery.expando );
+ }
+
+ // IE blanks contents when cloning scripts, and tries to evaluate newly-set text
+ if ( nodeName === "script" && dest.text !== src.text ) {
+ disableScript( dest ).text = src.text;
+ restoreScript( dest );
+
+ // IE6-10 improperly clones children of object elements using classid.
+ // IE10 throws NoModificationAllowedError if parent is null, #12132.
+ } else if ( nodeName === "object" ) {
+ if ( dest.parentNode ) {
+ dest.outerHTML = src.outerHTML;
+ }
+
+ // This path appears unavoidable for IE9. When cloning an object
+ // element in IE9, the outerHTML strategy above is not sufficient.
+ // If the src has innerHTML and the destination does not,
+ // copy the src.innerHTML into the dest.innerHTML. #10324
+ if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
+ dest.innerHTML = src.innerHTML;
+ }
+
+ } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) {
+ // IE6-8 fails to persist the checked state of a cloned checkbox
+ // or radio button. Worse, IE6-7 fail to give the cloned element
+ // a checked appearance if the defaultChecked value isn't also set
+
+ dest.defaultChecked = dest.checked = src.checked;
+
+ // IE6-7 get confused and end up setting the value of a cloned
+ // checkbox/radio button to an empty string instead of "on"
+ if ( dest.value !== src.value ) {
+ dest.value = src.value;
+ }
+
+ // IE6-8 fails to return the selected option to the default selected
+ // state when cloning options
+ } else if ( nodeName === "option" ) {
+ dest.defaultSelected = dest.selected = src.defaultSelected;
+
+ // IE6-8 fails to set the defaultValue to the correct value when
+ // cloning other types of input fields
+ } else if ( nodeName === "input" || nodeName === "textarea" ) {
+ dest.defaultValue = src.defaultValue;
+ }
+}
+
+jQuery.each({
+ appendTo: "append",
+ prependTo: "prepend",
+ insertBefore: "before",
+ insertAfter: "after",
+ replaceAll: "replaceWith"
+}, function( name, original ) {
+ jQuery.fn[ name ] = function( selector ) {
+ var elems,
+ i = 0,
+ ret = [],
+ insert = jQuery( selector ),
+ last = insert.length - 1;
+
+ for ( ; i <= last; i++ ) {
+ elems = i === last ? this : this.clone(true);
+ jQuery( insert[i] )[ original ]( elems );
+
+ // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
+ core_push.apply( ret, elems.get() );
+ }
+
+ return this.pushStack( ret );
+ };
+});
+
+function getAll( context, tag ) {
+ var elems, elem,
+ i = 0,
+ found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) :
+ typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) :
+ undefined;
+
+ if ( !found ) {
+ for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {
+ if ( !tag || jQuery.nodeName( elem, tag ) ) {
+ found.push( elem );
+ } else {
+ jQuery.merge( found, getAll( elem, tag ) );
+ }
+ }
+ }
+
+ return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
+ jQuery.merge( [ context ], found ) :
+ found;
+}
+
+// Used in buildFragment, fixes the defaultChecked property
+function fixDefaultChecked( elem ) {
+ if ( manipulation_rcheckableType.test( elem.type ) ) {
+ elem.defaultChecked = elem.checked;
+ }
+}
+
+jQuery.extend({
+ clone: function( elem, dataAndEvents, deepDataAndEvents ) {
+ var destElements, node, clone, i, srcElements,
+ inPage = jQuery.contains( elem.ownerDocument, elem );
+
+ if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
+ clone = elem.cloneNode( true );
+
+ // IE<=8 does not properly clone detached, unknown element nodes
+ } else {
+ fragmentDiv.innerHTML = elem.outerHTML;
+ fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
+ }
+
+ if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
+ (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
+
+ // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
+ destElements = getAll( clone );
+ srcElements = getAll( elem );
+
+ // Fix all IE cloning issues
+ for ( i = 0; (node = srcElements[i]) != null; ++i ) {
+ // Ensure that the destination node is not null; Fixes #9587
+ if ( destElements[i] ) {
+ fixCloneNodeIssues( node, destElements[i] );
+ }
+ }
+ }
+
+ // Copy the events from the original to the clone
+ if ( dataAndEvents ) {
+ if ( deepDataAndEvents ) {
+ srcElements = srcElements || getAll( elem );
+ destElements = destElements || getAll( clone );
+
+ for ( i = 0; (node = srcElements[i]) != null; i++ ) {
+ cloneCopyEvent( node, destElements[i] );
+ }
+ } else {
+ cloneCopyEvent( elem, clone );
+ }
+ }
+
+ // Preserve script evaluation history
+ destElements = getAll( clone, "script" );
+ if ( destElements.length > 0 ) {
+ setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
+ }
+
+ destElements = srcElements = node = null;
+
+ // Return the cloned set
+ return clone;
+ },
+
+ buildFragment: function( elems, context, scripts, selection ) {
+ var j, elem, contains,
+ tmp, tag, tbody, wrap,
+ l = elems.length,
+
+ // Ensure a safe fragment
+ safe = createSafeFragment( context ),
+
+ nodes = [],
+ i = 0;
+
+ for ( ; i < l; i++ ) {
+ elem = elems[ i ];
+
+ if ( elem || elem === 0 ) {
+
+ // Add nodes directly
+ if ( jQuery.type( elem ) === "object" ) {
+ jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
+
+ // Convert non-html into a text node
+ } else if ( !rhtml.test( elem ) ) {
+ nodes.push( context.createTextNode( elem ) );
+
+ // Convert html into DOM nodes
+ } else {
+ tmp = tmp || safe.appendChild( context.createElement("div") );
+
+ // Deserialize a standard representation
+ tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
+ wrap = wrapMap[ tag ] || wrapMap._default;
+
+ tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1>$2>" ) + wrap[2];
+
+ // Descend through wrappers to the right content
+ j = wrap[0];
+ while ( j-- ) {
+ tmp = tmp.lastChild;
+ }
+
+ // Manually add leading whitespace removed by IE
+ if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
+ nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
+ }
+
+ // Remove IE's autoinserted from table fragments
+ if ( !jQuery.support.tbody ) {
+
+ // String was a , *may* have spurious
+ elem = tag === "table" && !rtbody.test( elem ) ?
+ tmp.firstChild :
+
+ // String was a bare or
+ wrap[1] === "" && !rtbody.test( elem ) ?
+ tmp :
+ 0;
+
+ j = elem && elem.childNodes.length;
+ while ( j-- ) {
+ if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
+ elem.removeChild( tbody );
+ }
+ }
+ }
+
+ jQuery.merge( nodes, tmp.childNodes );
+
+ // Fix #12392 for WebKit and IE > 9
+ tmp.textContent = "";
+
+ // Fix #12392 for oldIE
+ while ( tmp.firstChild ) {
+ tmp.removeChild( tmp.firstChild );
+ }
+
+ // Remember the top-level container for proper cleanup
+ tmp = safe.lastChild;
+ }
+ }
+ }
+
+ // Fix #11356: Clear elements from fragment
+ if ( tmp ) {
+ safe.removeChild( tmp );
+ }
+
+ // Reset defaultChecked for any radios and checkboxes
+ // about to be appended to the DOM in IE 6/7 (#8060)
+ if ( !jQuery.support.appendChecked ) {
+ jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
+ }
+
+ i = 0;
+ while ( (elem = nodes[ i++ ]) ) {
+
+ // #4087 - If origin and destination elements are the same, and this is
+ // that element, do not do anything
+ if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
+ continue;
+ }
+
+ contains = jQuery.contains( elem.ownerDocument, elem );
+
+ // Append to fragment
+ tmp = getAll( safe.appendChild( elem ), "script" );
+
+ // Preserve script evaluation history
+ if ( contains ) {
+ setGlobalEval( tmp );
+ }
+
+ // Capture executables
+ if ( scripts ) {
+ j = 0;
+ while ( (elem = tmp[ j++ ]) ) {
+ if ( rscriptType.test( elem.type || "" ) ) {
+ scripts.push( elem );
+ }
+ }
+ }
+ }
+
+ tmp = null;
+
+ return safe;
+ },
+
+ cleanData: function( elems, /* internal */ acceptData ) {
+ var elem, type, id, data,
+ i = 0,
+ internalKey = jQuery.expando,
+ cache = jQuery.cache,
+ deleteExpando = jQuery.support.deleteExpando,
+ special = jQuery.event.special;
+
+ for ( ; (elem = elems[i]) != null; i++ ) {
+
+ if ( acceptData || jQuery.acceptData( elem ) ) {
+
+ id = elem[ internalKey ];
+ data = id && cache[ id ];
+
+ if ( data ) {
+ if ( data.events ) {
+ for ( type in data.events ) {
+ if ( special[ type ] ) {
+ jQuery.event.remove( elem, type );
+
+ // This is a shortcut to avoid jQuery.event.remove's overhead
+ } else {
+ jQuery.removeEvent( elem, type, data.handle );
+ }
+ }
+ }
+
+ // Remove cache only if it was not already removed by jQuery.event.remove
+ if ( cache[ id ] ) {
+
+ delete cache[ id ];
+
+ // IE does not allow us to delete expando properties from nodes,
+ // nor does it have a removeAttribute function on Document nodes;
+ // we must handle all of these cases
+ if ( deleteExpando ) {
+ delete elem[ internalKey ];
+
+ } else if ( typeof elem.removeAttribute !== core_strundefined ) {
+ elem.removeAttribute( internalKey );
+
+ } else {
+ elem[ internalKey ] = null;
+ }
+
+ core_deletedIds.push( id );
+ }
+ }
+ }
+ }
+ }
+});
+var iframe, getStyles, curCSS,
+ ralpha = /alpha\([^)]*\)/i,
+ ropacity = /opacity\s*=\s*([^)]*)/,
+ rposition = /^(top|right|bottom|left)$/,
+ // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
+ // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
+ rdisplayswap = /^(none|table(?!-c[ea]).+)/,
+ rmargin = /^margin/,
+ rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
+ rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
+ rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ),
+ elemdisplay = { BODY: "block" },
+
+ cssShow = { position: "absolute", visibility: "hidden", display: "block" },
+ cssNormalTransform = {
+ letterSpacing: 0,
+ fontWeight: 400
+ },
+
+ cssExpand = [ "Top", "Right", "Bottom", "Left" ],
+ cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
+
+// return a css property mapped to a potentially vendor prefixed property
+function vendorPropName( style, name ) {
+
+ // shortcut for names that are not vendor prefixed
+ if ( name in style ) {
+ return name;
+ }
+
+ // check for vendor prefixed names
+ var capName = name.charAt(0).toUpperCase() + name.slice(1),
+ origName = name,
+ i = cssPrefixes.length;
+
+ while ( i-- ) {
+ name = cssPrefixes[ i ] + capName;
+ if ( name in style ) {
+ return name;
+ }
+ }
+
+ return origName;
+}
+
+function isHidden( elem, el ) {
+ // isHidden might be called from jQuery#filter function;
+ // in that case, element will be second argument
+ elem = el || elem;
+ return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
+}
+
+function showHide( elements, show ) {
+ var display, elem, hidden,
+ values = [],
+ index = 0,
+ length = elements.length;
+
+ for ( ; index < length; index++ ) {
+ elem = elements[ index ];
+ if ( !elem.style ) {
+ continue;
+ }
+
+ values[ index ] = jQuery._data( elem, "olddisplay" );
+ display = elem.style.display;
+ if ( show ) {
+ // Reset the inline display of this element to learn if it is
+ // being hidden by cascaded rules or not
+ if ( !values[ index ] && display === "none" ) {
+ elem.style.display = "";
+ }
+
+ // Set elements which have been overridden with display: none
+ // in a stylesheet to whatever the default browser style is
+ // for such an element
+ if ( elem.style.display === "" && isHidden( elem ) ) {
+ values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
+ }
+ } else {
+
+ if ( !values[ index ] ) {
+ hidden = isHidden( elem );
+
+ if ( display && display !== "none" || !hidden ) {
+ jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
+ }
+ }
+ }
+ }
+
+ // Set the display of most of the elements in a second loop
+ // to avoid the constant reflow
+ for ( index = 0; index < length; index++ ) {
+ elem = elements[ index ];
+ if ( !elem.style ) {
+ continue;
+ }
+ if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
+ elem.style.display = show ? values[ index ] || "" : "none";
+ }
+ }
+
+ return elements;
+}
+
+jQuery.fn.extend({
+ css: function( name, value ) {
+ return jQuery.access( this, function( elem, name, value ) {
+ var len, styles,
+ map = {},
+ i = 0;
+
+ if ( jQuery.isArray( name ) ) {
+ styles = getStyles( elem );
+ len = name.length;
+
+ for ( ; i < len; i++ ) {
+ map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
+ }
+
+ return map;
+ }
+
+ return value !== undefined ?
+ jQuery.style( elem, name, value ) :
+ jQuery.css( elem, name );
+ }, name, value, arguments.length > 1 );
+ },
+ show: function() {
+ return showHide( this, true );
+ },
+ hide: function() {
+ return showHide( this );
+ },
+ toggle: function( state ) {
+ var bool = typeof state === "boolean";
+
+ return this.each(function() {
+ if ( bool ? state : isHidden( this ) ) {
+ jQuery( this ).show();
+ } else {
+ jQuery( this ).hide();
+ }
+ });
+ }
+});
+
+jQuery.extend({
+ // Add in style property hooks for overriding the default
+ // behavior of getting and setting a style property
+ cssHooks: {
+ opacity: {
+ get: function( elem, computed ) {
+ if ( computed ) {
+ // We should always get a number back from opacity
+ var ret = curCSS( elem, "opacity" );
+ return ret === "" ? "1" : ret;
+ }
+ }
+ }
+ },
+
+ // Exclude the following css properties to add px
+ cssNumber: {
+ "columnCount": true,
+ "fillOpacity": true,
+ "fontWeight": true,
+ "lineHeight": true,
+ "opacity": true,
+ "orphans": true,
+ "widows": true,
+ "zIndex": true,
+ "zoom": true
+ },
+
+ // Add in properties whose names you wish to fix before
+ // setting or getting the value
+ cssProps: {
+ // normalize float css property
+ "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
+ },
+
+ // Get and set the style property on a DOM Node
+ style: function( elem, name, value, extra ) {
+ // Don't set styles on text and comment nodes
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
+ return;
+ }
+
+ // Make sure that we're working with the right name
+ var ret, type, hooks,
+ origName = jQuery.camelCase( name ),
+ style = elem.style;
+
+ name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
+
+ // gets hook for the prefixed version
+ // followed by the unprefixed version
+ hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
+
+ // Check if we're setting a value
+ if ( value !== undefined ) {
+ type = typeof value;
+
+ // convert relative number strings (+= or -=) to relative numbers. #7345
+ if ( type === "string" && (ret = rrelNum.exec( value )) ) {
+ value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
+ // Fixes bug #9237
+ type = "number";
+ }
+
+ // Make sure that NaN and null values aren't set. See: #7116
+ if ( value == null || type === "number" && isNaN( value ) ) {
+ return;
+ }
+
+ // If a number was passed in, add 'px' to the (except for certain CSS properties)
+ if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
+ value += "px";
+ }
+
+ // Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
+ // but it would mean to define eight (for every problematic property) identical functions
+ if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
+ style[ name ] = "inherit";
+ }
+
+ // If a hook was provided, use that value, otherwise just set the specified value
+ if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
+
+ // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
+ // Fixes bug #5509
+ try {
+ style[ name ] = value;
+ } catch(e) {}
+ }
+
+ } else {
+ // If a hook was provided get the non-computed value from there
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
+ return ret;
+ }
+
+ // Otherwise just get the value from the style object
+ return style[ name ];
+ }
+ },
+
+ css: function( elem, name, extra, styles ) {
+ var num, val, hooks,
+ origName = jQuery.camelCase( name );
+
+ // Make sure that we're working with the right name
+ name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
+
+ // gets hook for the prefixed version
+ // followed by the unprefixed version
+ hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
+
+ // If a hook was provided get the computed value from there
+ if ( hooks && "get" in hooks ) {
+ val = hooks.get( elem, true, extra );
+ }
+
+ // Otherwise, if a way to get the computed value exists, use that
+ if ( val === undefined ) {
+ val = curCSS( elem, name, styles );
+ }
+
+ //convert "normal" to computed value
+ if ( val === "normal" && name in cssNormalTransform ) {
+ val = cssNormalTransform[ name ];
+ }
+
+ // Return, converting to number if forced or a qualifier was provided and val looks numeric
+ if ( extra === "" || extra ) {
+ num = parseFloat( val );
+ return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
+ }
+ return val;
+ },
+
+ // A method for quickly swapping in/out CSS properties to get correct calculations
+ swap: function( elem, options, callback, args ) {
+ var ret, name,
+ old = {};
+
+ // Remember the old values, and insert the new ones
+ for ( name in options ) {
+ old[ name ] = elem.style[ name ];
+ elem.style[ name ] = options[ name ];
+ }
+
+ ret = callback.apply( elem, args || [] );
+
+ // Revert the old values
+ for ( name in options ) {
+ elem.style[ name ] = old[ name ];
+ }
+
+ return ret;
+ }
+});
+
+// NOTE: we've included the "window" in window.getComputedStyle
+// because jsdom on node.js will break without it.
+if ( window.getComputedStyle ) {
+ getStyles = function( elem ) {
+ return window.getComputedStyle( elem, null );
+ };
+
+ curCSS = function( elem, name, _computed ) {
+ var width, minWidth, maxWidth,
+ computed = _computed || getStyles( elem ),
+
+ // getPropertyValue is only needed for .css('filter') in IE9, see #12537
+ ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined,
+ style = elem.style;
+
+ if ( computed ) {
+
+ if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
+ ret = jQuery.style( elem, name );
+ }
+
+ // A tribute to the "awesome hack by Dean Edwards"
+ // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
+ // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
+ // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
+ if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
+
+ // Remember the original values
+ width = style.width;
+ minWidth = style.minWidth;
+ maxWidth = style.maxWidth;
+
+ // Put in the new values to get a computed value out
+ style.minWidth = style.maxWidth = style.width = ret;
+ ret = computed.width;
+
+ // Revert the changed values
+ style.width = width;
+ style.minWidth = minWidth;
+ style.maxWidth = maxWidth;
+ }
+ }
+
+ return ret;
+ };
+} else if ( document.documentElement.currentStyle ) {
+ getStyles = function( elem ) {
+ return elem.currentStyle;
+ };
+
+ curCSS = function( elem, name, _computed ) {
+ var left, rs, rsLeft,
+ computed = _computed || getStyles( elem ),
+ ret = computed ? computed[ name ] : undefined,
+ style = elem.style;
+
+ // Avoid setting ret to empty string here
+ // so we don't default to auto
+ if ( ret == null && style && style[ name ] ) {
+ ret = style[ name ];
+ }
+
+ // From the awesome hack by Dean Edwards
+ // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
+
+ // If we're not dealing with a regular pixel number
+ // but a number that has a weird ending, we need to convert it to pixels
+ // but not position css attributes, as those are proportional to the parent element instead
+ // and we can't measure the parent instead because it might trigger a "stacking dolls" problem
+ if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
+
+ // Remember the original values
+ left = style.left;
+ rs = elem.runtimeStyle;
+ rsLeft = rs && rs.left;
+
+ // Put in the new values to get a computed value out
+ if ( rsLeft ) {
+ rs.left = elem.currentStyle.left;
+ }
+ style.left = name === "fontSize" ? "1em" : ret;
+ ret = style.pixelLeft + "px";
+
+ // Revert the changed values
+ style.left = left;
+ if ( rsLeft ) {
+ rs.left = rsLeft;
+ }
+ }
+
+ return ret === "" ? "auto" : ret;
+ };
+}
+
+function setPositiveNumber( elem, value, subtract ) {
+ var matches = rnumsplit.exec( value );
+ return matches ?
+ // Guard against undefined "subtract", e.g., when used as in cssHooks
+ Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
+ value;
+}
+
+function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
+ var i = extra === ( isBorderBox ? "border" : "content" ) ?
+ // If we already have the right measurement, avoid augmentation
+ 4 :
+ // Otherwise initialize for horizontal or vertical properties
+ name === "width" ? 1 : 0,
+
+ val = 0;
+
+ for ( ; i < 4; i += 2 ) {
+ // both box models exclude margin, so add it if we want it
+ if ( extra === "margin" ) {
+ val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
+ }
+
+ if ( isBorderBox ) {
+ // border-box includes padding, so remove it if we want content
+ if ( extra === "content" ) {
+ val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
+ }
+
+ // at this point, extra isn't border nor margin, so remove border
+ if ( extra !== "margin" ) {
+ val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
+ }
+ } else {
+ // at this point, extra isn't content, so add padding
+ val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
+
+ // at this point, extra isn't content nor padding, so add border
+ if ( extra !== "padding" ) {
+ val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
+ }
+ }
+ }
+
+ return val;
+}
+
+function getWidthOrHeight( elem, name, extra ) {
+
+ // Start with offset property, which is equivalent to the border-box value
+ var valueIsBorderBox = true,
+ val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
+ styles = getStyles( elem ),
+ isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
+
+ // some non-html elements return undefined for offsetWidth, so check for null/undefined
+ // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
+ // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
+ if ( val <= 0 || val == null ) {
+ // Fall back to computed then uncomputed css if necessary
+ val = curCSS( elem, name, styles );
+ if ( val < 0 || val == null ) {
+ val = elem.style[ name ];
+ }
+
+ // Computed unit is not pixels. Stop here and return.
+ if ( rnumnonpx.test(val) ) {
+ return val;
+ }
+
+ // we need the check for style in case a browser which returns unreliable values
+ // for getComputedStyle silently falls back to the reliable elem.style
+ valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
+
+ // Normalize "", auto, and prepare for extra
+ val = parseFloat( val ) || 0;
+ }
+
+ // use the active box-sizing model to add/subtract irrelevant styles
+ return ( val +
+ augmentWidthOrHeight(
+ elem,
+ name,
+ extra || ( isBorderBox ? "border" : "content" ),
+ valueIsBorderBox,
+ styles
+ )
+ ) + "px";
+}
+
+// Try to determine the default display value of an element
+function css_defaultDisplay( nodeName ) {
+ var doc = document,
+ display = elemdisplay[ nodeName ];
+
+ if ( !display ) {
+ display = actualDisplay( nodeName, doc );
+
+ // If the simple way fails, read from inside an iframe
+ if ( display === "none" || !display ) {
+ // Use the already-created iframe if possible
+ iframe = ( iframe ||
+ jQuery("")
+ .css( "cssText", "display:block !important" )
+ ).appendTo( doc.documentElement );
+
+ // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
+ doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;
+ doc.write("");
+ doc.close();
+
+ display = actualDisplay( nodeName, doc );
+ iframe.detach();
+ }
+
+ // Store the correct default display
+ elemdisplay[ nodeName ] = display;
+ }
+
+ return display;
+}
+
+// Called ONLY from within css_defaultDisplay
+function actualDisplay( name, doc ) {
+ var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
+ display = jQuery.css( elem[0], "display" );
+ elem.remove();
+ return display;
+}
+
+jQuery.each([ "height", "width" ], function( i, name ) {
+ jQuery.cssHooks[ name ] = {
+ get: function( elem, computed, extra ) {
+ if ( computed ) {
+ // certain elements can have dimension info if we invisibly show them
+ // however, it must have a current display style that would benefit from this
+ return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ?
+ jQuery.swap( elem, cssShow, function() {
+ return getWidthOrHeight( elem, name, extra );
+ }) :
+ getWidthOrHeight( elem, name, extra );
+ }
+ },
+
+ set: function( elem, value, extra ) {
+ var styles = extra && getStyles( elem );
+ return setPositiveNumber( elem, value, extra ?
+ augmentWidthOrHeight(
+ elem,
+ name,
+ extra,
+ jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
+ styles
+ ) : 0
+ );
+ }
+ };
+});
+
+if ( !jQuery.support.opacity ) {
+ jQuery.cssHooks.opacity = {
+ get: function( elem, computed ) {
+ // IE uses filters for opacity
+ return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
+ ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
+ computed ? "1" : "";
+ },
+
+ set: function( elem, value ) {
+ var style = elem.style,
+ currentStyle = elem.currentStyle,
+ opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
+ filter = currentStyle && currentStyle.filter || style.filter || "";
+
+ // IE has trouble with opacity if it does not have layout
+ // Force it by setting the zoom level
+ style.zoom = 1;
+
+ // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
+ // if value === "", then remove inline opacity #12685
+ if ( ( value >= 1 || value === "" ) &&
+ jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
+ style.removeAttribute ) {
+
+ // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
+ // if "filter:" is present at all, clearType is disabled, we want to avoid this
+ // style.removeAttribute is IE Only, but so apparently is this code path...
+ style.removeAttribute( "filter" );
+
+ // if there is no filter style applied in a css rule or unset inline opacity, we are done
+ if ( value === "" || currentStyle && !currentStyle.filter ) {
+ return;
+ }
+ }
+
+ // otherwise, set new filter values
+ style.filter = ralpha.test( filter ) ?
+ filter.replace( ralpha, opacity ) :
+ filter + " " + opacity;
+ }
+ };
+}
+
+// These hooks cannot be added until DOM ready because the support test
+// for it is not run until after DOM ready
+jQuery(function() {
+ if ( !jQuery.support.reliableMarginRight ) {
+ jQuery.cssHooks.marginRight = {
+ get: function( elem, computed ) {
+ if ( computed ) {
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+ // Work around by temporarily setting element display to inline-block
+ return jQuery.swap( elem, { "display": "inline-block" },
+ curCSS, [ elem, "marginRight" ] );
+ }
+ }
+ };
+ }
+
+ // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
+ // getComputedStyle returns percent when specified for top/left/bottom/right
+ // rather than make the css module depend on the offset module, we just check for it here
+ if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
+ jQuery.each( [ "top", "left" ], function( i, prop ) {
+ jQuery.cssHooks[ prop ] = {
+ get: function( elem, computed ) {
+ if ( computed ) {
+ computed = curCSS( elem, prop );
+ // if curCSS returns percentage, fallback to offset
+ return rnumnonpx.test( computed ) ?
+ jQuery( elem ).position()[ prop ] + "px" :
+ computed;
+ }
+ }
+ };
+ });
+ }
+
+});
+
+if ( jQuery.expr && jQuery.expr.filters ) {
+ jQuery.expr.filters.hidden = function( elem ) {
+ // Support: Opera <= 12.12
+ // Opera reports offsetWidths and offsetHeights less than zero on some elements
+ return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 ||
+ (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
+ };
+
+ jQuery.expr.filters.visible = function( elem ) {
+ return !jQuery.expr.filters.hidden( elem );
+ };
+}
+
+// These hooks are used by animate to expand properties
+jQuery.each({
+ margin: "",
+ padding: "",
+ border: "Width"
+}, function( prefix, suffix ) {
+ jQuery.cssHooks[ prefix + suffix ] = {
+ expand: function( value ) {
+ var i = 0,
+ expanded = {},
+
+ // assumes a single number if not a string
+ parts = typeof value === "string" ? value.split(" ") : [ value ];
+
+ for ( ; i < 4; i++ ) {
+ expanded[ prefix + cssExpand[ i ] + suffix ] =
+ parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
+ }
+
+ return expanded;
+ }
+ };
+
+ if ( !rmargin.test( prefix ) ) {
+ jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
+ }
+});
+var r20 = /%20/g,
+ rbracket = /\[\]$/,
+ rCRLF = /\r?\n/g,
+ rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
+ rsubmittable = /^(?:input|select|textarea|keygen)/i;
+
+jQuery.fn.extend({
+ serialize: function() {
+ return jQuery.param( this.serializeArray() );
+ },
+ serializeArray: function() {
+ return this.map(function(){
+ // Can add propHook for "elements" to filter or add form elements
+ var elements = jQuery.prop( this, "elements" );
+ return elements ? jQuery.makeArray( elements ) : this;
+ })
+ .filter(function(){
+ var type = this.type;
+ // Use .is(":disabled") so that fieldset[disabled] works
+ return this.name && !jQuery( this ).is( ":disabled" ) &&
+ rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
+ ( this.checked || !manipulation_rcheckableType.test( type ) );
+ })
+ .map(function( i, elem ){
+ var val = jQuery( this ).val();
+
+ return val == null ?
+ null :
+ jQuery.isArray( val ) ?
+ jQuery.map( val, function( val ){
+ return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
+ }) :
+ { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
+ }).get();
+ }
+});
+
+//Serialize an array of form elements or a set of
+//key/values into a query string
+jQuery.param = function( a, traditional ) {
+ var prefix,
+ s = [],
+ add = function( key, value ) {
+ // If value is a function, invoke it and return its value
+ value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
+ s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
+ };
+
+ // Set traditional to true for jQuery <= 1.3.2 behavior.
+ if ( traditional === undefined ) {
+ traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
+ }
+
+ // If an array was passed in, assume that it is an array of form elements.
+ if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
+ // Serialize the form elements
+ jQuery.each( a, function() {
+ add( this.name, this.value );
+ });
+
+ } else {
+ // If traditional, encode the "old" way (the way 1.3.2 or older
+ // did it), otherwise encode params recursively.
+ for ( prefix in a ) {
+ buildParams( prefix, a[ prefix ], traditional, add );
+ }
+ }
+
+ // Return the resulting serialization
+ return s.join( "&" ).replace( r20, "+" );
+};
+
+function buildParams( prefix, obj, traditional, add ) {
+ var name;
+
+ if ( jQuery.isArray( obj ) ) {
+ // Serialize array item.
+ jQuery.each( obj, function( i, v ) {
+ if ( traditional || rbracket.test( prefix ) ) {
+ // Treat each array item as a scalar.
+ add( prefix, v );
+
+ } else {
+ // Item is non-scalar (array or object), encode its numeric index.
+ buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
+ }
+ });
+
+ } else if ( !traditional && jQuery.type( obj ) === "object" ) {
+ // Serialize object item.
+ for ( name in obj ) {
+ buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
+ }
+
+ } else {
+ // Serialize scalar item.
+ add( prefix, obj );
+ }
+}
+jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
+ "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
+ "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
+
+ // Handle event binding
+ jQuery.fn[ name ] = function( data, fn ) {
+ return arguments.length > 0 ?
+ this.on( name, null, data, fn ) :
+ this.trigger( name );
+ };
+});
+
+jQuery.fn.hover = function( fnOver, fnOut ) {
+ return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
+};
+var
+ // Document location
+ ajaxLocParts,
+ ajaxLocation,
+ ajax_nonce = jQuery.now(),
+
+ ajax_rquery = /\?/,
+ rhash = /#.*$/,
+ rts = /([?&])_=[^&]*/,
+ rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
+ // #7653, #8125, #8152: local protocol detection
+ rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
+ rnoContent = /^(?:GET|HEAD)$/,
+ rprotocol = /^\/\//,
+ rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
+
+ // Keep a copy of the old load method
+ _load = jQuery.fn.load,
+
+ /* Prefilters
+ * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
+ * 2) These are called:
+ * - BEFORE asking for a transport
+ * - AFTER param serialization (s.data is a string if s.processData is true)
+ * 3) key is the dataType
+ * 4) the catchall symbol "*" can be used
+ * 5) execution will start with transport dataType and THEN continue down to "*" if needed
+ */
+ prefilters = {},
+
+ /* Transports bindings
+ * 1) key is the dataType
+ * 2) the catchall symbol "*" can be used
+ * 3) selection will start with transport dataType and THEN go to "*" if needed
+ */
+ transports = {},
+
+ // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
+ allTypes = "*/".concat("*");
+
+// #8138, IE may throw an exception when accessing
+// a field from window.location if document.domain has been set
+try {
+ ajaxLocation = location.href;
+} catch( e ) {
+ // Use the href attribute of an A element
+ // since IE will modify it given document.location
+ ajaxLocation = document.createElement( "a" );
+ ajaxLocation.href = "";
+ ajaxLocation = ajaxLocation.href;
+}
+
+// Segment location into parts
+ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
+
+// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
+function addToPrefiltersOrTransports( structure ) {
+
+ // dataTypeExpression is optional and defaults to "*"
+ return function( dataTypeExpression, func ) {
+
+ if ( typeof dataTypeExpression !== "string" ) {
+ func = dataTypeExpression;
+ dataTypeExpression = "*";
+ }
+
+ var dataType,
+ i = 0,
+ dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];
+
+ if ( jQuery.isFunction( func ) ) {
+ // For each dataType in the dataTypeExpression
+ while ( (dataType = dataTypes[i++]) ) {
+ // Prepend if requested
+ if ( dataType[0] === "+" ) {
+ dataType = dataType.slice( 1 ) || "*";
+ (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
+
+ // Otherwise append
+ } else {
+ (structure[ dataType ] = structure[ dataType ] || []).push( func );
+ }
+ }
+ }
+ };
+}
+
+// Base inspection function for prefilters and transports
+function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
+
+ var inspected = {},
+ seekingTransport = ( structure === transports );
+
+ function inspect( dataType ) {
+ var selected;
+ inspected[ dataType ] = true;
+ jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
+ var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
+ if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
+ options.dataTypes.unshift( dataTypeOrTransport );
+ inspect( dataTypeOrTransport );
+ return false;
+ } else if ( seekingTransport ) {
+ return !( selected = dataTypeOrTransport );
+ }
+ });
+ return selected;
+ }
+
+ return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
+}
+
+// A special extend for ajax options
+// that takes "flat" options (not to be deep extended)
+// Fixes #9887
+function ajaxExtend( target, src ) {
+ var deep, key,
+ flatOptions = jQuery.ajaxSettings.flatOptions || {};
+
+ for ( key in src ) {
+ if ( src[ key ] !== undefined ) {
+ ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
+ }
+ }
+ if ( deep ) {
+ jQuery.extend( true, target, deep );
+ }
+
+ return target;
+}
+
+jQuery.fn.load = function( url, params, callback ) {
+ if ( typeof url !== "string" && _load ) {
+ return _load.apply( this, arguments );
+ }
+
+ var selector, response, type,
+ self = this,
+ off = url.indexOf(" ");
+
+ if ( off >= 0 ) {
+ selector = url.slice( off, url.length );
+ url = url.slice( 0, off );
+ }
+
+ // If it's a function
+ if ( jQuery.isFunction( params ) ) {
+
+ // We assume that it's the callback
+ callback = params;
+ params = undefined;
+
+ // Otherwise, build a param string
+ } else if ( params && typeof params === "object" ) {
+ type = "POST";
+ }
+
+ // If we have elements to modify, make the request
+ if ( self.length > 0 ) {
+ jQuery.ajax({
+ url: url,
+
+ // if "type" variable is undefined, then "GET" method will be used
+ type: type,
+ dataType: "html",
+ data: params
+ }).done(function( responseText ) {
+
+ // Save response for use in complete callback
+ response = arguments;
+
+ self.html( selector ?
+
+ // If a selector was specified, locate the right elements in a dummy div
+ // Exclude scripts to avoid IE 'Permission Denied' errors
+ jQuery("").append( jQuery.parseHTML( responseText ) ).find( selector ) :
+
+ // Otherwise use the full result
+ responseText );
+
+ }).complete( callback && function( jqXHR, status ) {
+ self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
+ });
+ }
+
+ return this;
+};
+
+// Attach a bunch of functions for handling common AJAX events
+jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){
+ jQuery.fn[ type ] = function( fn ){
+ return this.on( type, fn );
+ };
+});
+
+jQuery.each( [ "get", "post" ], function( i, method ) {
+ jQuery[ method ] = function( url, data, callback, type ) {
+ // shift arguments if data argument was omitted
+ if ( jQuery.isFunction( data ) ) {
+ type = type || callback;
+ callback = data;
+ data = undefined;
+ }
+
+ return jQuery.ajax({
+ url: url,
+ type: method,
+ dataType: type,
+ data: data,
+ success: callback
+ });
+ };
+});
+
+jQuery.extend({
+
+ // Counter for holding the number of active queries
+ active: 0,
+
+ // Last-Modified header cache for next request
+ lastModified: {},
+ etag: {},
+
+ ajaxSettings: {
+ url: ajaxLocation,
+ type: "GET",
+ isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
+ global: true,
+ processData: true,
+ async: true,
+ contentType: "application/x-www-form-urlencoded; charset=UTF-8",
+ /*
+ timeout: 0,
+ data: null,
+ dataType: null,
+ username: null,
+ password: null,
+ cache: null,
+ throws: false,
+ traditional: false,
+ headers: {},
+ */
+
+ accepts: {
+ "*": allTypes,
+ text: "text/plain",
+ html: "text/html",
+ xml: "application/xml, text/xml",
+ json: "application/json, text/javascript"
+ },
+
+ contents: {
+ xml: /xml/,
+ html: /html/,
+ json: /json/
+ },
+
+ responseFields: {
+ xml: "responseXML",
+ text: "responseText"
+ },
+
+ // Data converters
+ // Keys separate source (or catchall "*") and destination types with a single space
+ converters: {
+
+ // Convert anything to text
+ "* text": window.String,
+
+ // Text to html (true = no transformation)
+ "text html": true,
+
+ // Evaluate text as a json expression
+ "text json": jQuery.parseJSON,
+
+ // Parse text as xml
+ "text xml": jQuery.parseXML
+ },
+
+ // For options that shouldn't be deep extended:
+ // you can add your own custom options here if
+ // and when you create one that shouldn't be
+ // deep extended (see ajaxExtend)
+ flatOptions: {
+ url: true,
+ context: true
+ }
+ },
+
+ // Creates a full fledged settings object into target
+ // with both ajaxSettings and settings fields.
+ // If target is omitted, writes into ajaxSettings.
+ ajaxSetup: function( target, settings ) {
+ return settings ?
+
+ // Building a settings object
+ ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
+
+ // Extending ajaxSettings
+ ajaxExtend( jQuery.ajaxSettings, target );
+ },
+
+ ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
+ ajaxTransport: addToPrefiltersOrTransports( transports ),
+
+ // Main method
+ ajax: function( url, options ) {
+
+ // If url is an object, simulate pre-1.5 signature
+ if ( typeof url === "object" ) {
+ options = url;
+ url = undefined;
+ }
+
+ // Force options to be an object
+ options = options || {};
+
+ var // Cross-domain detection vars
+ parts,
+ // Loop variable
+ i,
+ // URL without anti-cache param
+ cacheURL,
+ // Response headers as string
+ responseHeadersString,
+ // timeout handle
+ timeoutTimer,
+
+ // To know if global events are to be dispatched
+ fireGlobals,
+
+ transport,
+ // Response headers
+ responseHeaders,
+ // Create the final options object
+ s = jQuery.ajaxSetup( {}, options ),
+ // Callbacks context
+ callbackContext = s.context || s,
+ // Context for global events is callbackContext if it is a DOM node or jQuery collection
+ globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
+ jQuery( callbackContext ) :
+ jQuery.event,
+ // Deferreds
+ deferred = jQuery.Deferred(),
+ completeDeferred = jQuery.Callbacks("once memory"),
+ // Status-dependent callbacks
+ statusCode = s.statusCode || {},
+ // Headers (they are sent all at once)
+ requestHeaders = {},
+ requestHeadersNames = {},
+ // The jqXHR state
+ state = 0,
+ // Default abort message
+ strAbort = "canceled",
+ // Fake xhr
+ jqXHR = {
+ readyState: 0,
+
+ // Builds headers hashtable if needed
+ getResponseHeader: function( key ) {
+ var match;
+ if ( state === 2 ) {
+ if ( !responseHeaders ) {
+ responseHeaders = {};
+ while ( (match = rheaders.exec( responseHeadersString )) ) {
+ responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
+ }
+ }
+ match = responseHeaders[ key.toLowerCase() ];
+ }
+ return match == null ? null : match;
+ },
+
+ // Raw string
+ getAllResponseHeaders: function() {
+ return state === 2 ? responseHeadersString : null;
+ },
+
+ // Caches the header
+ setRequestHeader: function( name, value ) {
+ var lname = name.toLowerCase();
+ if ( !state ) {
+ name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
+ requestHeaders[ name ] = value;
+ }
+ return this;
+ },
+
+ // Overrides response content-type header
+ overrideMimeType: function( type ) {
+ if ( !state ) {
+ s.mimeType = type;
+ }
+ return this;
+ },
+
+ // Status-dependent callbacks
+ statusCode: function( map ) {
+ var code;
+ if ( map ) {
+ if ( state < 2 ) {
+ for ( code in map ) {
+ // Lazy-add the new callback in a way that preserves old ones
+ statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
+ }
+ } else {
+ // Execute the appropriate callbacks
+ jqXHR.always( map[ jqXHR.status ] );
+ }
+ }
+ return this;
+ },
+
+ // Cancel the request
+ abort: function( statusText ) {
+ var finalText = statusText || strAbort;
+ if ( transport ) {
+ transport.abort( finalText );
+ }
+ done( 0, finalText );
+ return this;
+ }
+ };
+
+ // Attach deferreds
+ deferred.promise( jqXHR ).complete = completeDeferred.add;
+ jqXHR.success = jqXHR.done;
+ jqXHR.error = jqXHR.fail;
+
+ // Remove hash character (#7531: and string promotion)
+ // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
+ // Handle falsy url in the settings object (#10093: consistency with old signature)
+ // We also use the url parameter if available
+ s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
+
+ // Alias method option to type as per ticket #12004
+ s.type = options.method || options.type || s.method || s.type;
+
+ // Extract dataTypes list
+ s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""];
+
+ // A cross-domain request is in order when we have a protocol:host:port mismatch
+ if ( s.crossDomain == null ) {
+ parts = rurl.exec( s.url.toLowerCase() );
+ s.crossDomain = !!( parts &&
+ ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
+ ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
+ ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
+ );
+ }
+
+ // Convert data if not already a string
+ if ( s.data && s.processData && typeof s.data !== "string" ) {
+ s.data = jQuery.param( s.data, s.traditional );
+ }
+
+ // Apply prefilters
+ inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
+
+ // If request was aborted inside a prefilter, stop there
+ if ( state === 2 ) {
+ return jqXHR;
+ }
+
+ // We can fire global events as of now if asked to
+ fireGlobals = s.global;
+
+ // Watch for a new set of requests
+ if ( fireGlobals && jQuery.active++ === 0 ) {
+ jQuery.event.trigger("ajaxStart");
+ }
+
+ // Uppercase the type
+ s.type = s.type.toUpperCase();
+
+ // Determine if request has content
+ s.hasContent = !rnoContent.test( s.type );
+
+ // Save the URL in case we're toying with the If-Modified-Since
+ // and/or If-None-Match header later on
+ cacheURL = s.url;
+
+ // More options handling for requests with no content
+ if ( !s.hasContent ) {
+
+ // If data is available, append data to url
+ if ( s.data ) {
+ cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
+ // #9682: remove data so that it's not used in an eventual retry
+ delete s.data;
+ }
+
+ // Add anti-cache in url if needed
+ if ( s.cache === false ) {
+ s.url = rts.test( cacheURL ) ?
+
+ // If there is already a '_' parameter, set its value
+ cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) :
+
+ // Otherwise add one to the end
+ cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++;
+ }
+ }
+
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
+ if ( s.ifModified ) {
+ if ( jQuery.lastModified[ cacheURL ] ) {
+ jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
+ }
+ if ( jQuery.etag[ cacheURL ] ) {
+ jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
+ }
+ }
+
+ // Set the correct header, if data is being sent
+ if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
+ jqXHR.setRequestHeader( "Content-Type", s.contentType );
+ }
+
+ // Set the Accepts header for the server, depending on the dataType
+ jqXHR.setRequestHeader(
+ "Accept",
+ s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
+ s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
+ s.accepts[ "*" ]
+ );
+
+ // Check for headers option
+ for ( i in s.headers ) {
+ jqXHR.setRequestHeader( i, s.headers[ i ] );
+ }
+
+ // Allow custom headers/mimetypes and early abort
+ if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
+ // Abort if not done already and return
+ return jqXHR.abort();
+ }
+
+ // aborting is no longer a cancellation
+ strAbort = "abort";
+
+ // Install callbacks on deferreds
+ for ( i in { success: 1, error: 1, complete: 1 } ) {
+ jqXHR[ i ]( s[ i ] );
+ }
+
+ // Get transport
+ transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
+
+ // If no transport, we auto-abort
+ if ( !transport ) {
+ done( -1, "No Transport" );
+ } else {
+ jqXHR.readyState = 1;
+
+ // Send global event
+ if ( fireGlobals ) {
+ globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
+ }
+ // Timeout
+ if ( s.async && s.timeout > 0 ) {
+ timeoutTimer = setTimeout(function() {
+ jqXHR.abort("timeout");
+ }, s.timeout );
+ }
+
+ try {
+ state = 1;
+ transport.send( requestHeaders, done );
+ } catch ( e ) {
+ // Propagate exception as error if not done
+ if ( state < 2 ) {
+ done( -1, e );
+ // Simply rethrow otherwise
+ } else {
+ throw e;
+ }
+ }
+ }
+
+ // Callback for when everything is done
+ function done( status, nativeStatusText, responses, headers ) {
+ var isSuccess, success, error, response, modified,
+ statusText = nativeStatusText;
+
+ // Called once
+ if ( state === 2 ) {
+ return;
+ }
+
+ // State is "done" now
+ state = 2;
+
+ // Clear timeout if it exists
+ if ( timeoutTimer ) {
+ clearTimeout( timeoutTimer );
+ }
+
+ // Dereference transport for early garbage collection
+ // (no matter how long the jqXHR object will be used)
+ transport = undefined;
+
+ // Cache response headers
+ responseHeadersString = headers || "";
+
+ // Set readyState
+ jqXHR.readyState = status > 0 ? 4 : 0;
+
+ // Get response data
+ if ( responses ) {
+ response = ajaxHandleResponses( s, jqXHR, responses );
+ }
+
+ // If successful, handle type chaining
+ if ( status >= 200 && status < 300 || status === 304 ) {
+
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
+ if ( s.ifModified ) {
+ modified = jqXHR.getResponseHeader("Last-Modified");
+ if ( modified ) {
+ jQuery.lastModified[ cacheURL ] = modified;
+ }
+ modified = jqXHR.getResponseHeader("etag");
+ if ( modified ) {
+ jQuery.etag[ cacheURL ] = modified;
+ }
+ }
+
+ // if no content
+ if ( status === 204 ) {
+ isSuccess = true;
+ statusText = "nocontent";
+
+ // if not modified
+ } else if ( status === 304 ) {
+ isSuccess = true;
+ statusText = "notmodified";
+
+ // If we have data, let's convert it
+ } else {
+ isSuccess = ajaxConvert( s, response );
+ statusText = isSuccess.state;
+ success = isSuccess.data;
+ error = isSuccess.error;
+ isSuccess = !error;
+ }
+ } else {
+ // We extract error from statusText
+ // then normalize statusText and status for non-aborts
+ error = statusText;
+ if ( status || !statusText ) {
+ statusText = "error";
+ if ( status < 0 ) {
+ status = 0;
+ }
+ }
+ }
+
+ // Set data for the fake xhr object
+ jqXHR.status = status;
+ jqXHR.statusText = ( nativeStatusText || statusText ) + "";
+
+ // Success/Error
+ if ( isSuccess ) {
+ deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
+ } else {
+ deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
+ }
+
+ // Status-dependent callbacks
+ jqXHR.statusCode( statusCode );
+ statusCode = undefined;
+
+ if ( fireGlobals ) {
+ globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
+ [ jqXHR, s, isSuccess ? success : error ] );
+ }
+
+ // Complete
+ completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
+
+ if ( fireGlobals ) {
+ globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
+ // Handle the global AJAX counter
+ if ( !( --jQuery.active ) ) {
+ jQuery.event.trigger("ajaxStop");
+ }
+ }
+ }
+
+ return jqXHR;
+ },
+
+ getScript: function( url, callback ) {
+ return jQuery.get( url, undefined, callback, "script" );
+ },
+
+ getJSON: function( url, data, callback ) {
+ return jQuery.get( url, data, callback, "json" );
+ }
+});
+
+/* Handles responses to an ajax request:
+ * - sets all responseXXX fields accordingly
+ * - finds the right dataType (mediates between content-type and expected dataType)
+ * - returns the corresponding response
+ */
+function ajaxHandleResponses( s, jqXHR, responses ) {
+ var firstDataType, ct, finalDataType, type,
+ contents = s.contents,
+ dataTypes = s.dataTypes,
+ responseFields = s.responseFields;
+
+ // Fill responseXXX fields
+ for ( type in responseFields ) {
+ if ( type in responses ) {
+ jqXHR[ responseFields[type] ] = responses[ type ];
+ }
+ }
+
+ // Remove auto dataType and get content-type in the process
+ while( dataTypes[ 0 ] === "*" ) {
+ dataTypes.shift();
+ if ( ct === undefined ) {
+ ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
+ }
+ }
+
+ // Check if we're dealing with a known content-type
+ if ( ct ) {
+ for ( type in contents ) {
+ if ( contents[ type ] && contents[ type ].test( ct ) ) {
+ dataTypes.unshift( type );
+ break;
+ }
+ }
+ }
+
+ // Check to see if we have a response for the expected dataType
+ if ( dataTypes[ 0 ] in responses ) {
+ finalDataType = dataTypes[ 0 ];
+ } else {
+ // Try convertible dataTypes
+ for ( type in responses ) {
+ if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
+ finalDataType = type;
+ break;
+ }
+ if ( !firstDataType ) {
+ firstDataType = type;
+ }
+ }
+ // Or just use first one
+ finalDataType = finalDataType || firstDataType;
+ }
+
+ // If we found a dataType
+ // We add the dataType to the list if needed
+ // and return the corresponding response
+ if ( finalDataType ) {
+ if ( finalDataType !== dataTypes[ 0 ] ) {
+ dataTypes.unshift( finalDataType );
+ }
+ return responses[ finalDataType ];
+ }
+}
+
+// Chain conversions given the request and the original response
+function ajaxConvert( s, response ) {
+ var conv2, current, conv, tmp,
+ converters = {},
+ i = 0,
+ // Work with a copy of dataTypes in case we need to modify it for conversion
+ dataTypes = s.dataTypes.slice(),
+ prev = dataTypes[ 0 ];
+
+ // Apply the dataFilter if provided
+ if ( s.dataFilter ) {
+ response = s.dataFilter( response, s.dataType );
+ }
+
+ // Create converters map with lowercased keys
+ if ( dataTypes[ 1 ] ) {
+ for ( conv in s.converters ) {
+ converters[ conv.toLowerCase() ] = s.converters[ conv ];
+ }
+ }
+
+ // Convert to each sequential dataType, tolerating list modification
+ for ( ; (current = dataTypes[++i]); ) {
+
+ // There's only work to do if current dataType is non-auto
+ if ( current !== "*" ) {
+
+ // Convert response if prev dataType is non-auto and differs from current
+ if ( prev !== "*" && prev !== current ) {
+
+ // Seek a direct converter
+ conv = converters[ prev + " " + current ] || converters[ "* " + current ];
+
+ // If none found, seek a pair
+ if ( !conv ) {
+ for ( conv2 in converters ) {
+
+ // If conv2 outputs current
+ tmp = conv2.split(" ");
+ if ( tmp[ 1 ] === current ) {
+
+ // If prev can be converted to accepted input
+ conv = converters[ prev + " " + tmp[ 0 ] ] ||
+ converters[ "* " + tmp[ 0 ] ];
+ if ( conv ) {
+ // Condense equivalence converters
+ if ( conv === true ) {
+ conv = converters[ conv2 ];
+
+ // Otherwise, insert the intermediate dataType
+ } else if ( converters[ conv2 ] !== true ) {
+ current = tmp[ 0 ];
+ dataTypes.splice( i--, 0, current );
+ }
+
+ break;
+ }
+ }
+ }
+ }
+
+ // Apply converter (if not an equivalence)
+ if ( conv !== true ) {
+
+ // Unless errors are allowed to bubble, catch and return them
+ if ( conv && s["throws"] ) {
+ response = conv( response );
+ } else {
+ try {
+ response = conv( response );
+ } catch ( e ) {
+ return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
+ }
+ }
+ }
+ }
+
+ // Update prev for next iteration
+ prev = current;
+ }
+ }
+
+ return { state: "success", data: response };
+}
+// Install script dataType
+jQuery.ajaxSetup({
+ accepts: {
+ script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
+ },
+ contents: {
+ script: /(?:java|ecma)script/
+ },
+ converters: {
+ "text script": function( text ) {
+ jQuery.globalEval( text );
+ return text;
+ }
+ }
+});
+
+// Handle cache's special case and global
+jQuery.ajaxPrefilter( "script", function( s ) {
+ if ( s.cache === undefined ) {
+ s.cache = false;
+ }
+ if ( s.crossDomain ) {
+ s.type = "GET";
+ s.global = false;
+ }
+});
+
+// Bind script tag hack transport
+jQuery.ajaxTransport( "script", function(s) {
+
+ // This transport only deals with cross domain requests
+ if ( s.crossDomain ) {
+
+ var script,
+ head = document.head || jQuery("head")[0] || document.documentElement;
+
+ return {
+
+ send: function( _, callback ) {
+
+ script = document.createElement("script");
+
+ script.async = true;
+
+ if ( s.scriptCharset ) {
+ script.charset = s.scriptCharset;
+ }
+
+ script.src = s.url;
+
+ // Attach handlers for all browsers
+ script.onload = script.onreadystatechange = function( _, isAbort ) {
+
+ if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
+
+ // Handle memory leak in IE
+ script.onload = script.onreadystatechange = null;
+
+ // Remove the script
+ if ( script.parentNode ) {
+ script.parentNode.removeChild( script );
+ }
+
+ // Dereference the script
+ script = null;
+
+ // Callback if not abort
+ if ( !isAbort ) {
+ callback( 200, "success" );
+ }
+ }
+ };
+
+ // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
+ // Use native DOM manipulation to avoid our domManip AJAX trickery
+ head.insertBefore( script, head.firstChild );
+ },
+
+ abort: function() {
+ if ( script ) {
+ script.onload( undefined, true );
+ }
+ }
+ };
+ }
+});
+var oldCallbacks = [],
+ rjsonp = /(=)\?(?=&|$)|\?\?/;
+
+// Default jsonp settings
+jQuery.ajaxSetup({
+ jsonp: "callback",
+ jsonpCallback: function() {
+ var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) );
+ this[ callback ] = true;
+ return callback;
+ }
+});
+
+// Detect, normalize options and install callbacks for jsonp requests
+jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
+
+ var callbackName, overwritten, responseContainer,
+ jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
+ "url" :
+ typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
+ );
+
+ // Handle iff the expected data type is "jsonp" or we have a parameter to set
+ if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
+
+ // Get callback name, remembering preexisting value associated with it
+ callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
+ s.jsonpCallback() :
+ s.jsonpCallback;
+
+ // Insert callback into url or form data
+ if ( jsonProp ) {
+ s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
+ } else if ( s.jsonp !== false ) {
+ s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
+ }
+
+ // Use data converter to retrieve json after script execution
+ s.converters["script json"] = function() {
+ if ( !responseContainer ) {
+ jQuery.error( callbackName + " was not called" );
+ }
+ return responseContainer[ 0 ];
+ };
+
+ // force json dataType
+ s.dataTypes[ 0 ] = "json";
+
+ // Install callback
+ overwritten = window[ callbackName ];
+ window[ callbackName ] = function() {
+ responseContainer = arguments;
+ };
+
+ // Clean-up function (fires after converters)
+ jqXHR.always(function() {
+ // Restore preexisting value
+ window[ callbackName ] = overwritten;
+
+ // Save back as free
+ if ( s[ callbackName ] ) {
+ // make sure that re-using the options doesn't screw things around
+ s.jsonpCallback = originalSettings.jsonpCallback;
+
+ // save the callback name for future use
+ oldCallbacks.push( callbackName );
+ }
+
+ // Call if it was a function and we have a response
+ if ( responseContainer && jQuery.isFunction( overwritten ) ) {
+ overwritten( responseContainer[ 0 ] );
+ }
+
+ responseContainer = overwritten = undefined;
+ });
+
+ // Delegate to script
+ return "script";
+ }
+});
+var xhrCallbacks, xhrSupported,
+ xhrId = 0,
+ // #5280: Internet Explorer will keep connections alive if we don't abort on unload
+ xhrOnUnloadAbort = window.ActiveXObject && function() {
+ // Abort all pending requests
+ var key;
+ for ( key in xhrCallbacks ) {
+ xhrCallbacks[ key ]( undefined, true );
+ }
+ };
+
+// Functions to create xhrs
+function createStandardXHR() {
+ try {
+ return new window.XMLHttpRequest();
+ } catch( e ) {}
+}
+
+function createActiveXHR() {
+ try {
+ return new window.ActiveXObject("Microsoft.XMLHTTP");
+ } catch( e ) {}
+}
+
+// Create the request object
+// (This is still attached to ajaxSettings for backward compatibility)
+jQuery.ajaxSettings.xhr = window.ActiveXObject ?
+ /* Microsoft failed to properly
+ * implement the XMLHttpRequest in IE7 (can't request local files),
+ * so we use the ActiveXObject when it is available
+ * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
+ * we need a fallback.
+ */
+ function() {
+ return !this.isLocal && createStandardXHR() || createActiveXHR();
+ } :
+ // For all other browsers, use the standard XMLHttpRequest object
+ createStandardXHR;
+
+// Determine support properties
+xhrSupported = jQuery.ajaxSettings.xhr();
+jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
+xhrSupported = jQuery.support.ajax = !!xhrSupported;
+
+// Create transport if the browser can provide an xhr
+if ( xhrSupported ) {
+
+ jQuery.ajaxTransport(function( s ) {
+ // Cross domain only allowed if supported through XMLHttpRequest
+ if ( !s.crossDomain || jQuery.support.cors ) {
+
+ var callback;
+
+ return {
+ send: function( headers, complete ) {
+
+ // Get a new xhr
+ var handle, i,
+ xhr = s.xhr();
+
+ // Open the socket
+ // Passing null username, generates a login popup on Opera (#2865)
+ if ( s.username ) {
+ xhr.open( s.type, s.url, s.async, s.username, s.password );
+ } else {
+ xhr.open( s.type, s.url, s.async );
+ }
+
+ // Apply custom fields if provided
+ if ( s.xhrFields ) {
+ for ( i in s.xhrFields ) {
+ xhr[ i ] = s.xhrFields[ i ];
+ }
+ }
+
+ // Override mime type if needed
+ if ( s.mimeType && xhr.overrideMimeType ) {
+ xhr.overrideMimeType( s.mimeType );
+ }
+
+ // X-Requested-With header
+ // For cross-domain requests, seeing as conditions for a preflight are
+ // akin to a jigsaw puzzle, we simply never set it to be sure.
+ // (it can always be set on a per-request basis or even using ajaxSetup)
+ // For same-domain requests, won't change header if already provided.
+ if ( !s.crossDomain && !headers["X-Requested-With"] ) {
+ headers["X-Requested-With"] = "XMLHttpRequest";
+ }
+
+ // Need an extra try/catch for cross domain requests in Firefox 3
+ try {
+ for ( i in headers ) {
+ xhr.setRequestHeader( i, headers[ i ] );
+ }
+ } catch( err ) {}
+
+ // Do send the request
+ // This may raise an exception which is actually
+ // handled in jQuery.ajax (so no try/catch here)
+ xhr.send( ( s.hasContent && s.data ) || null );
+
+ // Listener
+ callback = function( _, isAbort ) {
+ var status, responseHeaders, statusText, responses;
+
+ // Firefox throws exceptions when accessing properties
+ // of an xhr when a network error occurred
+ // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
+ try {
+
+ // Was never called and is aborted or complete
+ if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
+
+ // Only called once
+ callback = undefined;
+
+ // Do not keep as active anymore
+ if ( handle ) {
+ xhr.onreadystatechange = jQuery.noop;
+ if ( xhrOnUnloadAbort ) {
+ delete xhrCallbacks[ handle ];
+ }
+ }
+
+ // If it's an abort
+ if ( isAbort ) {
+ // Abort it manually if needed
+ if ( xhr.readyState !== 4 ) {
+ xhr.abort();
+ }
+ } else {
+ responses = {};
+ status = xhr.status;
+ responseHeaders = xhr.getAllResponseHeaders();
+
+ // When requesting binary data, IE6-9 will throw an exception
+ // on any attempt to access responseText (#11426)
+ if ( typeof xhr.responseText === "string" ) {
+ responses.text = xhr.responseText;
+ }
+
+ // Firefox throws an exception when accessing
+ // statusText for faulty cross-domain requests
+ try {
+ statusText = xhr.statusText;
+ } catch( e ) {
+ // We normalize with Webkit giving an empty statusText
+ statusText = "";
+ }
+
+ // Filter status for non standard behaviors
+
+ // If the request is local and we have data: assume a success
+ // (success with no data won't get notified, that's the best we
+ // can do given current implementations)
+ if ( !status && s.isLocal && !s.crossDomain ) {
+ status = responses.text ? 200 : 404;
+ // IE - #1450: sometimes returns 1223 when it should be 204
+ } else if ( status === 1223 ) {
+ status = 204;
+ }
+ }
+ }
+ } catch( firefoxAccessException ) {
+ if ( !isAbort ) {
+ complete( -1, firefoxAccessException );
+ }
+ }
+
+ // Call complete if needed
+ if ( responses ) {
+ complete( status, statusText, responses, responseHeaders );
+ }
+ };
+
+ if ( !s.async ) {
+ // if we're in sync mode we fire the callback
+ callback();
+ } else if ( xhr.readyState === 4 ) {
+ // (IE6 & IE7) if it's in cache and has been
+ // retrieved directly we need to fire the callback
+ setTimeout( callback );
+ } else {
+ handle = ++xhrId;
+ if ( xhrOnUnloadAbort ) {
+ // Create the active xhrs callbacks list if needed
+ // and attach the unload handler
+ if ( !xhrCallbacks ) {
+ xhrCallbacks = {};
+ jQuery( window ).unload( xhrOnUnloadAbort );
+ }
+ // Add to list of active xhrs callbacks
+ xhrCallbacks[ handle ] = callback;
+ }
+ xhr.onreadystatechange = callback;
+ }
+ },
+
+ abort: function() {
+ if ( callback ) {
+ callback( undefined, true );
+ }
+ }
+ };
+ }
+ });
+}
+var fxNow, timerId,
+ rfxtypes = /^(?:toggle|show|hide)$/,
+ rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
+ rrun = /queueHooks$/,
+ animationPrefilters = [ defaultPrefilter ],
+ tweeners = {
+ "*": [function( prop, value ) {
+ var end, unit,
+ tween = this.createTween( prop, value ),
+ parts = rfxnum.exec( value ),
+ target = tween.cur(),
+ start = +target || 0,
+ scale = 1,
+ maxIterations = 20;
+
+ if ( parts ) {
+ end = +parts[2];
+ unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" );
+
+ // We need to compute starting value
+ if ( unit !== "px" && start ) {
+ // Iteratively approximate from a nonzero starting point
+ // Prefer the current property, because this process will be trivial if it uses the same units
+ // Fallback to end or a simple constant
+ start = jQuery.css( tween.elem, prop, true ) || end || 1;
+
+ do {
+ // If previous iteration zeroed out, double until we get *something*
+ // Use a string for doubling factor so we don't accidentally see scale as unchanged below
+ scale = scale || ".5";
+
+ // Adjust and apply
+ start = start / scale;
+ jQuery.style( tween.elem, prop, start + unit );
+
+ // Update scale, tolerating zero or NaN from tween.cur()
+ // And breaking the loop if scale is unchanged or perfect, or if we've just had enough
+ } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
+ }
+
+ tween.unit = unit;
+ tween.start = start;
+ // If a +=/-= token was provided, we're doing a relative animation
+ tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end;
+ }
+ return tween;
+ }]
+ };
+
+// Animations created synchronously will run synchronously
+function createFxNow() {
+ setTimeout(function() {
+ fxNow = undefined;
+ });
+ return ( fxNow = jQuery.now() );
+}
+
+function createTweens( animation, props ) {
+ jQuery.each( props, function( prop, value ) {
+ var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
+ index = 0,
+ length = collection.length;
+ for ( ; index < length; index++ ) {
+ if ( collection[ index ].call( animation, prop, value ) ) {
+
+ // we're done with this property
+ return;
+ }
+ }
+ });
+}
+
+function Animation( elem, properties, options ) {
+ var result,
+ stopped,
+ index = 0,
+ length = animationPrefilters.length,
+ deferred = jQuery.Deferred().always( function() {
+ // don't match elem in the :animated selector
+ delete tick.elem;
+ }),
+ tick = function() {
+ if ( stopped ) {
+ return false;
+ }
+ var currentTime = fxNow || createFxNow(),
+ remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
+ // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
+ temp = remaining / animation.duration || 0,
+ percent = 1 - temp,
+ index = 0,
+ length = animation.tweens.length;
+
+ for ( ; index < length ; index++ ) {
+ animation.tweens[ index ].run( percent );
+ }
+
+ deferred.notifyWith( elem, [ animation, percent, remaining ]);
+
+ if ( percent < 1 && length ) {
+ return remaining;
+ } else {
+ deferred.resolveWith( elem, [ animation ] );
+ return false;
+ }
+ },
+ animation = deferred.promise({
+ elem: elem,
+ props: jQuery.extend( {}, properties ),
+ opts: jQuery.extend( true, { specialEasing: {} }, options ),
+ originalProperties: properties,
+ originalOptions: options,
+ startTime: fxNow || createFxNow(),
+ duration: options.duration,
+ tweens: [],
+ createTween: function( prop, end ) {
+ var tween = jQuery.Tween( elem, animation.opts, prop, end,
+ animation.opts.specialEasing[ prop ] || animation.opts.easing );
+ animation.tweens.push( tween );
+ return tween;
+ },
+ stop: function( gotoEnd ) {
+ var index = 0,
+ // if we are going to the end, we want to run all the tweens
+ // otherwise we skip this part
+ length = gotoEnd ? animation.tweens.length : 0;
+ if ( stopped ) {
+ return this;
+ }
+ stopped = true;
+ for ( ; index < length ; index++ ) {
+ animation.tweens[ index ].run( 1 );
+ }
+
+ // resolve when we played the last frame
+ // otherwise, reject
+ if ( gotoEnd ) {
+ deferred.resolveWith( elem, [ animation, gotoEnd ] );
+ } else {
+ deferred.rejectWith( elem, [ animation, gotoEnd ] );
+ }
+ return this;
+ }
+ }),
+ props = animation.props;
+
+ propFilter( props, animation.opts.specialEasing );
+
+ for ( ; index < length ; index++ ) {
+ result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
+ if ( result ) {
+ return result;
+ }
+ }
+
+ createTweens( animation, props );
+
+ if ( jQuery.isFunction( animation.opts.start ) ) {
+ animation.opts.start.call( elem, animation );
+ }
+
+ jQuery.fx.timer(
+ jQuery.extend( tick, {
+ elem: elem,
+ anim: animation,
+ queue: animation.opts.queue
+ })
+ );
+
+ // attach callbacks from options
+ return animation.progress( animation.opts.progress )
+ .done( animation.opts.done, animation.opts.complete )
+ .fail( animation.opts.fail )
+ .always( animation.opts.always );
+}
+
+function propFilter( props, specialEasing ) {
+ var value, name, index, easing, hooks;
+
+ // camelCase, specialEasing and expand cssHook pass
+ for ( index in props ) {
+ name = jQuery.camelCase( index );
+ easing = specialEasing[ name ];
+ value = props[ index ];
+ if ( jQuery.isArray( value ) ) {
+ easing = value[ 1 ];
+ value = props[ index ] = value[ 0 ];
+ }
+
+ if ( index !== name ) {
+ props[ name ] = value;
+ delete props[ index ];
+ }
+
+ hooks = jQuery.cssHooks[ name ];
+ if ( hooks && "expand" in hooks ) {
+ value = hooks.expand( value );
+ delete props[ name ];
+
+ // not quite $.extend, this wont overwrite keys already present.
+ // also - reusing 'index' from above because we have the correct "name"
+ for ( index in value ) {
+ if ( !( index in props ) ) {
+ props[ index ] = value[ index ];
+ specialEasing[ index ] = easing;
+ }
+ }
+ } else {
+ specialEasing[ name ] = easing;
+ }
+ }
+}
+
+jQuery.Animation = jQuery.extend( Animation, {
+
+ tweener: function( props, callback ) {
+ if ( jQuery.isFunction( props ) ) {
+ callback = props;
+ props = [ "*" ];
+ } else {
+ props = props.split(" ");
+ }
+
+ var prop,
+ index = 0,
+ length = props.length;
+
+ for ( ; index < length ; index++ ) {
+ prop = props[ index ];
+ tweeners[ prop ] = tweeners[ prop ] || [];
+ tweeners[ prop ].unshift( callback );
+ }
+ },
+
+ prefilter: function( callback, prepend ) {
+ if ( prepend ) {
+ animationPrefilters.unshift( callback );
+ } else {
+ animationPrefilters.push( callback );
+ }
+ }
+});
+
+function defaultPrefilter( elem, props, opts ) {
+ /*jshint validthis:true */
+ var prop, index, length,
+ value, dataShow, toggle,
+ tween, hooks, oldfire,
+ anim = this,
+ style = elem.style,
+ orig = {},
+ handled = [],
+ hidden = elem.nodeType && isHidden( elem );
+
+ // handle queue: false promises
+ if ( !opts.queue ) {
+ hooks = jQuery._queueHooks( elem, "fx" );
+ if ( hooks.unqueued == null ) {
+ hooks.unqueued = 0;
+ oldfire = hooks.empty.fire;
+ hooks.empty.fire = function() {
+ if ( !hooks.unqueued ) {
+ oldfire();
+ }
+ };
+ }
+ hooks.unqueued++;
+
+ anim.always(function() {
+ // doing this makes sure that the complete handler will be called
+ // before this completes
+ anim.always(function() {
+ hooks.unqueued--;
+ if ( !jQuery.queue( elem, "fx" ).length ) {
+ hooks.empty.fire();
+ }
+ });
+ });
+ }
+
+ // height/width overflow pass
+ if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
+ // Make sure that nothing sneaks out
+ // Record all 3 overflow attributes because IE does not
+ // change the overflow attribute when overflowX and
+ // overflowY are set to the same value
+ opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
+
+ // Set display property to inline-block for height/width
+ // animations on inline elements that are having width/height animated
+ if ( jQuery.css( elem, "display" ) === "inline" &&
+ jQuery.css( elem, "float" ) === "none" ) {
+
+ // inline-level elements accept inline-block;
+ // block-level elements need to be inline with layout
+ if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
+ style.display = "inline-block";
+
+ } else {
+ style.zoom = 1;
+ }
+ }
+ }
+
+ if ( opts.overflow ) {
+ style.overflow = "hidden";
+ if ( !jQuery.support.shrinkWrapBlocks ) {
+ anim.always(function() {
+ style.overflow = opts.overflow[ 0 ];
+ style.overflowX = opts.overflow[ 1 ];
+ style.overflowY = opts.overflow[ 2 ];
+ });
+ }
+ }
+
+
+ // show/hide pass
+ for ( index in props ) {
+ value = props[ index ];
+ if ( rfxtypes.exec( value ) ) {
+ delete props[ index ];
+ toggle = toggle || value === "toggle";
+ if ( value === ( hidden ? "hide" : "show" ) ) {
+ continue;
+ }
+ handled.push( index );
+ }
+ }
+
+ length = handled.length;
+ if ( length ) {
+ dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} );
+ if ( "hidden" in dataShow ) {
+ hidden = dataShow.hidden;
+ }
+
+ // store state if its toggle - enables .stop().toggle() to "reverse"
+ if ( toggle ) {
+ dataShow.hidden = !hidden;
+ }
+ if ( hidden ) {
+ jQuery( elem ).show();
+ } else {
+ anim.done(function() {
+ jQuery( elem ).hide();
+ });
+ }
+ anim.done(function() {
+ var prop;
+ jQuery._removeData( elem, "fxshow" );
+ for ( prop in orig ) {
+ jQuery.style( elem, prop, orig[ prop ] );
+ }
+ });
+ for ( index = 0 ; index < length ; index++ ) {
+ prop = handled[ index ];
+ tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 );
+ orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop );
+
+ if ( !( prop in dataShow ) ) {
+ dataShow[ prop ] = tween.start;
+ if ( hidden ) {
+ tween.end = tween.start;
+ tween.start = prop === "width" || prop === "height" ? 1 : 0;
+ }
+ }
+ }
+ }
+}
+
+function Tween( elem, options, prop, end, easing ) {
+ return new Tween.prototype.init( elem, options, prop, end, easing );
+}
+jQuery.Tween = Tween;
+
+Tween.prototype = {
+ constructor: Tween,
+ init: function( elem, options, prop, end, easing, unit ) {
+ this.elem = elem;
+ this.prop = prop;
+ this.easing = easing || "swing";
+ this.options = options;
+ this.start = this.now = this.cur();
+ this.end = end;
+ this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
+ },
+ cur: function() {
+ var hooks = Tween.propHooks[ this.prop ];
+
+ return hooks && hooks.get ?
+ hooks.get( this ) :
+ Tween.propHooks._default.get( this );
+ },
+ run: function( percent ) {
+ var eased,
+ hooks = Tween.propHooks[ this.prop ];
+
+ if ( this.options.duration ) {
+ this.pos = eased = jQuery.easing[ this.easing ](
+ percent, this.options.duration * percent, 0, 1, this.options.duration
+ );
+ } else {
+ this.pos = eased = percent;
+ }
+ this.now = ( this.end - this.start ) * eased + this.start;
+
+ if ( this.options.step ) {
+ this.options.step.call( this.elem, this.now, this );
+ }
+
+ if ( hooks && hooks.set ) {
+ hooks.set( this );
+ } else {
+ Tween.propHooks._default.set( this );
+ }
+ return this;
+ }
+};
+
+Tween.prototype.init.prototype = Tween.prototype;
+
+Tween.propHooks = {
+ _default: {
+ get: function( tween ) {
+ var result;
+
+ if ( tween.elem[ tween.prop ] != null &&
+ (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
+ return tween.elem[ tween.prop ];
+ }
+
+ // passing an empty string as a 3rd parameter to .css will automatically
+ // attempt a parseFloat and fallback to a string if the parse fails
+ // so, simple values such as "10px" are parsed to Float.
+ // complex values such as "rotate(1rad)" are returned as is.
+ result = jQuery.css( tween.elem, tween.prop, "" );
+ // Empty strings, null, undefined and "auto" are converted to 0.
+ return !result || result === "auto" ? 0 : result;
+ },
+ set: function( tween ) {
+ // use step hook for back compat - use cssHook if its there - use .style if its
+ // available and use plain properties where available
+ if ( jQuery.fx.step[ tween.prop ] ) {
+ jQuery.fx.step[ tween.prop ]( tween );
+ } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
+ jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
+ } else {
+ tween.elem[ tween.prop ] = tween.now;
+ }
+ }
+ }
+};
+
+// Remove in 2.0 - this supports IE8's panic based approach
+// to setting things on disconnected nodes
+
+Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
+ set: function( tween ) {
+ if ( tween.elem.nodeType && tween.elem.parentNode ) {
+ tween.elem[ tween.prop ] = tween.now;
+ }
+ }
+};
+
+jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
+ var cssFn = jQuery.fn[ name ];
+ jQuery.fn[ name ] = function( speed, easing, callback ) {
+ return speed == null || typeof speed === "boolean" ?
+ cssFn.apply( this, arguments ) :
+ this.animate( genFx( name, true ), speed, easing, callback );
+ };
+});
+
+jQuery.fn.extend({
+ fadeTo: function( speed, to, easing, callback ) {
+
+ // show any hidden elements after setting opacity to 0
+ return this.filter( isHidden ).css( "opacity", 0 ).show()
+
+ // animate to the value specified
+ .end().animate({ opacity: to }, speed, easing, callback );
+ },
+ animate: function( prop, speed, easing, callback ) {
+ var empty = jQuery.isEmptyObject( prop ),
+ optall = jQuery.speed( speed, easing, callback ),
+ doAnimation = function() {
+ // Operate on a copy of prop so per-property easing won't be lost
+ var anim = Animation( this, jQuery.extend( {}, prop ), optall );
+ doAnimation.finish = function() {
+ anim.stop( true );
+ };
+ // Empty animations, or finishing resolves immediately
+ if ( empty || jQuery._data( this, "finish" ) ) {
+ anim.stop( true );
+ }
+ };
+ doAnimation.finish = doAnimation;
+
+ return empty || optall.queue === false ?
+ this.each( doAnimation ) :
+ this.queue( optall.queue, doAnimation );
+ },
+ stop: function( type, clearQueue, gotoEnd ) {
+ var stopQueue = function( hooks ) {
+ var stop = hooks.stop;
+ delete hooks.stop;
+ stop( gotoEnd );
+ };
+
+ if ( typeof type !== "string" ) {
+ gotoEnd = clearQueue;
+ clearQueue = type;
+ type = undefined;
+ }
+ if ( clearQueue && type !== false ) {
+ this.queue( type || "fx", [] );
+ }
+
+ return this.each(function() {
+ var dequeue = true,
+ index = type != null && type + "queueHooks",
+ timers = jQuery.timers,
+ data = jQuery._data( this );
+
+ if ( index ) {
+ if ( data[ index ] && data[ index ].stop ) {
+ stopQueue( data[ index ] );
+ }
+ } else {
+ for ( index in data ) {
+ if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
+ stopQueue( data[ index ] );
+ }
+ }
+ }
+
+ for ( index = timers.length; index--; ) {
+ if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
+ timers[ index ].anim.stop( gotoEnd );
+ dequeue = false;
+ timers.splice( index, 1 );
+ }
+ }
+
+ // start the next in the queue if the last step wasn't forced
+ // timers currently will call their complete callbacks, which will dequeue
+ // but only if they were gotoEnd
+ if ( dequeue || !gotoEnd ) {
+ jQuery.dequeue( this, type );
+ }
+ });
+ },
+ finish: function( type ) {
+ if ( type !== false ) {
+ type = type || "fx";
+ }
+ return this.each(function() {
+ var index,
+ data = jQuery._data( this ),
+ queue = data[ type + "queue" ],
+ hooks = data[ type + "queueHooks" ],
+ timers = jQuery.timers,
+ length = queue ? queue.length : 0;
+
+ // enable finishing flag on private data
+ data.finish = true;
+
+ // empty the queue first
+ jQuery.queue( this, type, [] );
+
+ if ( hooks && hooks.cur && hooks.cur.finish ) {
+ hooks.cur.finish.call( this );
+ }
+
+ // look for any active animations, and finish them
+ for ( index = timers.length; index--; ) {
+ if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
+ timers[ index ].anim.stop( true );
+ timers.splice( index, 1 );
+ }
+ }
+
+ // look for any animations in the old queue and finish them
+ for ( index = 0; index < length; index++ ) {
+ if ( queue[ index ] && queue[ index ].finish ) {
+ queue[ index ].finish.call( this );
+ }
+ }
+
+ // turn off finishing flag
+ delete data.finish;
+ });
+ }
+});
+
+// Generate parameters to create a standard animation
+function genFx( type, includeWidth ) {
+ var which,
+ attrs = { height: type },
+ i = 0;
+
+ // if we include width, step value is 1 to do all cssExpand values,
+ // if we don't include width, step value is 2 to skip over Left and Right
+ includeWidth = includeWidth? 1 : 0;
+ for( ; i < 4 ; i += 2 - includeWidth ) {
+ which = cssExpand[ i ];
+ attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
+ }
+
+ if ( includeWidth ) {
+ attrs.opacity = attrs.width = type;
+ }
+
+ return attrs;
+}
+
+// Generate shortcuts for custom animations
+jQuery.each({
+ slideDown: genFx("show"),
+ slideUp: genFx("hide"),
+ slideToggle: genFx("toggle"),
+ fadeIn: { opacity: "show" },
+ fadeOut: { opacity: "hide" },
+ fadeToggle: { opacity: "toggle" }
+}, function( name, props ) {
+ jQuery.fn[ name ] = function( speed, easing, callback ) {
+ return this.animate( props, speed, easing, callback );
+ };
+});
+
+jQuery.speed = function( speed, easing, fn ) {
+ var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
+ complete: fn || !fn && easing ||
+ jQuery.isFunction( speed ) && speed,
+ duration: speed,
+ easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
+ };
+
+ opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
+ opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
+
+ // normalize opt.queue - true/undefined/null -> "fx"
+ if ( opt.queue == null || opt.queue === true ) {
+ opt.queue = "fx";
+ }
+
+ // Queueing
+ opt.old = opt.complete;
+
+ opt.complete = function() {
+ if ( jQuery.isFunction( opt.old ) ) {
+ opt.old.call( this );
+ }
+
+ if ( opt.queue ) {
+ jQuery.dequeue( this, opt.queue );
+ }
+ };
+
+ return opt;
+};
+
+jQuery.easing = {
+ linear: function( p ) {
+ return p;
+ },
+ swing: function( p ) {
+ return 0.5 - Math.cos( p*Math.PI ) / 2;
+ }
+};
+
+jQuery.timers = [];
+jQuery.fx = Tween.prototype.init;
+jQuery.fx.tick = function() {
+ var timer,
+ timers = jQuery.timers,
+ i = 0;
+
+ fxNow = jQuery.now();
+
+ for ( ; i < timers.length; i++ ) {
+ timer = timers[ i ];
+ // Checks the timer has not already been removed
+ if ( !timer() && timers[ i ] === timer ) {
+ timers.splice( i--, 1 );
+ }
+ }
+
+ if ( !timers.length ) {
+ jQuery.fx.stop();
+ }
+ fxNow = undefined;
+};
+
+jQuery.fx.timer = function( timer ) {
+ if ( timer() && jQuery.timers.push( timer ) ) {
+ jQuery.fx.start();
+ }
+};
+
+jQuery.fx.interval = 13;
+
+jQuery.fx.start = function() {
+ if ( !timerId ) {
+ timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
+ }
+};
+
+jQuery.fx.stop = function() {
+ clearInterval( timerId );
+ timerId = null;
+};
+
+jQuery.fx.speeds = {
+ slow: 600,
+ fast: 200,
+ // Default speed
+ _default: 400
+};
+
+// Back Compat <1.8 extension point
+jQuery.fx.step = {};
+
+if ( jQuery.expr && jQuery.expr.filters ) {
+ jQuery.expr.filters.animated = function( elem ) {
+ return jQuery.grep(jQuery.timers, function( fn ) {
+ return elem === fn.elem;
+ }).length;
+ };
+}
+jQuery.fn.offset = function( options ) {
+ if ( arguments.length ) {
+ return options === undefined ?
+ this :
+ this.each(function( i ) {
+ jQuery.offset.setOffset( this, options, i );
+ });
+ }
+
+ var docElem, win,
+ box = { top: 0, left: 0 },
+ elem = this[ 0 ],
+ doc = elem && elem.ownerDocument;
+
+ if ( !doc ) {
+ return;
+ }
+
+ docElem = doc.documentElement;
+
+ // Make sure it's not a disconnected DOM node
+ if ( !jQuery.contains( docElem, elem ) ) {
+ return box;
+ }
+
+ // If we don't have gBCR, just use 0,0 rather than error
+ // BlackBerry 5, iOS 3 (original iPhone)
+ if ( typeof elem.getBoundingClientRect !== core_strundefined ) {
+ box = elem.getBoundingClientRect();
+ }
+ win = getWindow( doc );
+ return {
+ top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
+ left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
+ };
+};
+
+jQuery.offset = {
+
+ setOffset: function( elem, options, i ) {
+ var position = jQuery.css( elem, "position" );
+
+ // set position first, in-case top/left are set even on static elem
+ if ( position === "static" ) {
+ elem.style.position = "relative";
+ }
+
+ var curElem = jQuery( elem ),
+ curOffset = curElem.offset(),
+ curCSSTop = jQuery.css( elem, "top" ),
+ curCSSLeft = jQuery.css( elem, "left" ),
+ calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
+ props = {}, curPosition = {}, curTop, curLeft;
+
+ // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
+ if ( calculatePosition ) {
+ curPosition = curElem.position();
+ curTop = curPosition.top;
+ curLeft = curPosition.left;
+ } else {
+ curTop = parseFloat( curCSSTop ) || 0;
+ curLeft = parseFloat( curCSSLeft ) || 0;
+ }
+
+ if ( jQuery.isFunction( options ) ) {
+ options = options.call( elem, i, curOffset );
+ }
+
+ if ( options.top != null ) {
+ props.top = ( options.top - curOffset.top ) + curTop;
+ }
+ if ( options.left != null ) {
+ props.left = ( options.left - curOffset.left ) + curLeft;
+ }
+
+ if ( "using" in options ) {
+ options.using.call( elem, props );
+ } else {
+ curElem.css( props );
+ }
+ }
+};
+
+
+jQuery.fn.extend({
+
+ position: function() {
+ if ( !this[ 0 ] ) {
+ return;
+ }
+
+ var offsetParent, offset,
+ parentOffset = { top: 0, left: 0 },
+ elem = this[ 0 ];
+
+ // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent
+ if ( jQuery.css( elem, "position" ) === "fixed" ) {
+ // we assume that getBoundingClientRect is available when computed position is fixed
+ offset = elem.getBoundingClientRect();
+ } else {
+ // Get *real* offsetParent
+ offsetParent = this.offsetParent();
+
+ // Get correct offsets
+ offset = this.offset();
+ if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
+ parentOffset = offsetParent.offset();
+ }
+
+ // Add offsetParent borders
+ parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
+ parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
+ }
+
+ // Subtract parent offsets and element margins
+ // note: when an element has margin: auto the offsetLeft and marginLeft
+ // are the same in Safari causing offset.left to incorrectly be 0
+ return {
+ top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
+ left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
+ };
+ },
+
+ offsetParent: function() {
+ return this.map(function() {
+ var offsetParent = this.offsetParent || document.documentElement;
+ while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) {
+ offsetParent = offsetParent.offsetParent;
+ }
+ return offsetParent || document.documentElement;
+ });
+ }
+});
+
+
+// Create scrollLeft and scrollTop methods
+jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
+ var top = /Y/.test( prop );
+
+ jQuery.fn[ method ] = function( val ) {
+ return jQuery.access( this, function( elem, method, val ) {
+ var win = getWindow( elem );
+
+ if ( val === undefined ) {
+ return win ? (prop in win) ? win[ prop ] :
+ win.document.documentElement[ method ] :
+ elem[ method ];
+ }
+
+ if ( win ) {
+ win.scrollTo(
+ !top ? val : jQuery( win ).scrollLeft(),
+ top ? val : jQuery( win ).scrollTop()
+ );
+
+ } else {
+ elem[ method ] = val;
+ }
+ }, method, val, arguments.length, null );
+ };
+});
+
+function getWindow( elem ) {
+ return jQuery.isWindow( elem ) ?
+ elem :
+ elem.nodeType === 9 ?
+ elem.defaultView || elem.parentWindow :
+ false;
+}
+// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
+jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
+ jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
+ // margin is only for outerHeight, outerWidth
+ jQuery.fn[ funcName ] = function( margin, value ) {
+ var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
+ extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
+
+ return jQuery.access( this, function( elem, type, value ) {
+ var doc;
+
+ if ( jQuery.isWindow( elem ) ) {
+ // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
+ // isn't a whole lot we can do. See pull request at this URL for discussion:
+ // https://github.com/jquery/jquery/pull/764
+ return elem.document.documentElement[ "client" + name ];
+ }
+
+ // Get document width or height
+ if ( elem.nodeType === 9 ) {
+ doc = elem.documentElement;
+
+ // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
+ // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
+ return Math.max(
+ elem.body[ "scroll" + name ], doc[ "scroll" + name ],
+ elem.body[ "offset" + name ], doc[ "offset" + name ],
+ doc[ "client" + name ]
+ );
+ }
+
+ return value === undefined ?
+ // Get width or height on the element, requesting but not forcing parseFloat
+ jQuery.css( elem, type, extra ) :
+
+ // Set width or height on the element
+ jQuery.style( elem, type, value, extra );
+ }, type, chainable ? margin : undefined, chainable, null );
+ };
+ });
+});
+// Limit scope pollution from any deprecated API
+// (function() {
+
+// })();
+// Expose jQuery to the global object
+window.jQuery = window.$ = jQuery;
+
+// Expose jQuery as an AMD module, but only for AMD loaders that
+// understand the issues with loading multiple versions of jQuery
+// in a page that all might call define(). The loader will indicate
+// they have special allowances for multiple jQuery versions by
+// specifying define.amd.jQuery = true. Register as a named module,
+// since jQuery can be concatenated with other files that may use define,
+// but not use a proper concatenation script that understands anonymous
+// AMD modules. A named AMD is safest and most robust way to register.
+// Lowercase jquery is used because AMD module names are derived from
+// file names, and jQuery is normally delivered in a lowercase file name.
+// Do this after creating the global so that if an AMD module wants to call
+// noConflict to hide this version of jQuery, it will work.
+if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
+ define( "jquery", [], function () { return jQuery; } );
+}
+
+})( window );
diff --git a/lib/external/showhide.js b/lib/external/showhide.js
index 9dd905b..6282379 100644
--- a/lib/external/showhide.js
+++ b/lib/external/showhide.js
@@ -10,8 +10,8 @@ xui.extend({
/**
* Pops the last selector from XUI
*/
- end: function () {
- return this.set(this.cache || []);
+ end: function () {
+ return this.set(this.cache || []);
},
/**
* Sets the `display` CSS property to `block`.
diff --git a/lib/geocode.js b/lib/geocode.js
new file mode 100644
index 0000000..9d7f4e4
--- /dev/null
+++ b/lib/geocode.js
@@ -0,0 +1,217 @@
+// Geocode
+interactions.geocode = function ( fragment, options ) {
+ options = options || {};
+ if (fragment.constructor == Object)
+ var groups = assignElements(fragment, "reverse-geocode", function(set) {
+ set["elements"] = set["elements"] || {};
+ $.each(set, function(key, value) {
+ if (key != "set")
+ set["elements"][key] = $(value);
+ });
+ });
+ else
+ var groups = findElements(fragment, "reverse-geocode", function(set, comp) {
+ set["elements"] = set["elements"] || {};
+ set["elements"][$(comp).attr("data-ur-reverse-geocode-component")] = comp;
+ });
+
+ $.each(groups, function(id, group) {
+ var set = this['set'];
+
+ var callback = $(set).attr("data-ur-callback") || options.callback;
+ var errorCallback = $(set).attr("data-ur-error-callback") || options.errorCallback;
+ var geocoder;
+ var geocodeObj;
+ var currentObj;
+
+ function selectHelper(elm, value) {
+ for (var i=0,j=elm.length; i
= 0; i--) {
+ var comp = $(comps[i]);
+ if (comp[0] instanceof Node) {
+ if (comp.data("urCompInit"))
+ $(comps).splice(i, 1);
+ else
+ $(this).data("urCompInit", type);
+ }
+ }
+ if (!customFn && key != "set")
+ $(comps).attr("data-ur-" + type + "-component", key);
+ });
+ if (set["set"] && set["set"].length !== 0)
+ $(set["set"]).attr("data-ur-set", type).attr("data-ur-id", setId);
+ else
+ $.each(set, function() {
+ $(this).attr("data-ur-id", setId);
+ });
+
+ if (customFn)
+ customFn(set);
+
+ var sets = {};
+ sets[setId] = $.extend({_id: setId}, set);
+ return sets;
+}
+
+// test for transform3d, technically supported on old Android but very buggy
+var oldAndroid = /Android [12]/.test(navigator.userAgent);
+var transform3d = !oldAndroid;
+if (transform3d) {
+ var css3d = "translate3d(0, 0, 0)";
+ var elem3d = $("").css({ webkitTransform: css3d, MozTransform: css3d, msTransform: css3d, transform: css3d });
+ transform3d =
+ (elem3d.css("WebkitTransform") +
+ elem3d.css("MozTransform") +
+ elem3d.css("msTransform") +
+ elem3d.css("transform") +
+ "").indexOf("(") != -1;
+}
+
+// test for touch screen
+var touchscreen = "ontouchstart" in window;
+var downEvent = (touchscreen ? "touchstart" : "mousedown") + ".ur";
+var moveEvent = (touchscreen ? "touchmove" : "mousemove") + ".ur";
+var upEvent = (touchscreen ? "touchend" : "mouseup") + ".ur";
+
+// handle touch events
+function getEventCoords(event) {
+ var touches = event.originalEvent.touches;
+ event = (touches && touches[0]) || event;
+ return {x: event.clientX, y: event.clientY};
+}
+
+// stop event helper
+function stifle(e) {
+ e.preventDefault();
+ e.stopPropagation();
+}
+
+function bound(num, range) {
+ return Math.max(range[0], Math.min(num, range[1]));
+}
+
+function isenabled(val) {
+ return typeof val == "string" ? val != "disabled" && val != "false" : val;
+}
+
+var interactions = {};
diff --git a/lib/inputclear.js b/lib/inputclear.js
new file mode 100644
index 0000000..266318e
--- /dev/null
+++ b/lib/inputclear.js
@@ -0,0 +1,42 @@
+// Input Clear
+interactions.inputclear = function( fragment ) {
+ if (fragment.constructor == Object)
+ var groups = assignElements(fragment, "input-clear");
+ else
+ var groups = findElements(fragment, "input-clear");
+ $.each(groups, function(id, group) {
+ // Create the X div and hide it (even though this should be in CSS)
+ var ex = $("
").hide();
+ // Inject it
+ $(group['set']).append(ex);
+
+ // Touch Events
+ ex
+ .on(touchscreen ? "touchstart.ur.inputclear" : "click.ur.inputclear", function() {
+ // remove text in the box
+ input[0].value='';
+ input[0].focus();
+ })
+ .on("touchend.ur.inputclear", function() {
+ // make sure the keyboard doesn't disappear
+ input[0].blur();
+ });
+
+ var input = $(group["set"]).find("input");
+ input
+ .on("focus.ur.inputclear", function() {
+ if (input[0].value != '') {
+ ex.show();
+ }
+ })
+ .on("keydown.ur.inputclear", function() {
+ ex.show();
+ })
+ .on("blur.ur.inputclear", function() {
+ // Delay the hide so that the button can be clicked
+ setTimeout(function() { ex.hide();}, 150);
+ });
+
+ $(group["set"]).data("urInit", true);
+ });
+};
diff --git a/lib/setup.js b/lib/setup.js
new file mode 100644
index 0000000..13c74f9
--- /dev/null
+++ b/lib/setup.js
@@ -0,0 +1,14 @@
+window.Uranium = {lib: interactions};
+$.each(interactions, function(name) {
+ Uranium[name] = {};
+});
+
+$.fn.Uranium = function() {
+ var jqObj = this;
+ $.each(interactions, function() {
+ this(jqObj);
+ });
+ return this;
+};
+
+$(document).ready($(document).Uranium);
diff --git a/lib/tabs.js b/lib/tabs.js
index 7ba9e00..c91851d 100644
--- a/lib/tabs.js
+++ b/lib/tabs.js
@@ -1,115 +1,48 @@
-/* Tabs *
- * * * * * *
- * The tabs are like togglers with state. If one is opened, the others are closed
- *
- * Question: Can I assume order is preserved? Ill use IDs for now
- */
-
-Ur.QuickLoaders['tabs'] = (function(){
- function Tabs(data){
- this.elements = data;
- this.setup_callbacks();
- }
-
- Tabs.prototype.setup_callbacks = function() {
- var default_tab = null;
-
- for(var tab_id in this.elements["buttons"]) {
-
- var button = this.elements["buttons"][tab_id];
- var content = this.elements["contents"][tab_id];
-
- if (default_tab === null) {
- default_tab = tab_id;
- }
-
- if(content === undefined) {
- Ur.error("no matching tab content for tab button");
- return;
- }
-
- var state = x$(button).attr("data-ur-state")[0];
- if(state !== undefined && state == "enabled") {
- default_tab = -1;
- }
-
- var closeable = x$(this.elements["set"]).attr("data-ur-closeable")[0];
- closeable = (closeable !== undefined && closeable == "true") ? true : false;
- var self = this;
- x$(button).on(
- "click",
- function(evt) {
- var firstScrollTop = evt.target.offsetTop - document.body.scrollTop;
- var this_tab_id = x$(evt.currentTarget).attr("data-ur-tab-id")[0];
-
- for(var tab_id in self.elements["buttons"]) {
- var button = self.elements["buttons"][tab_id];
- var content = self.elements["contents"][tab_id];
-
- if (tab_id !== this_tab_id) {
- x$(button).attr("data-ur-state","disabled");
- x$(content).attr("data-ur-state","disabled");
- } else {
- var new_state = "enabled";
- if (closeable) {
- var old_state = x$(button).attr("data-ur-state")[0];
- old_state = (old_state === undefined) ? "disabled" : old_state;
- new_state = (old_state == "enabled") ? "disabled" : "enabled";
- }
- x$(button).attr("data-ur-state", new_state);
- x$(content).attr("data-ur-state", new_state);
- }
- }
- var secondScrollTop = evt.target.offsetTop - document.body.scrollTop;
- if ( secondScrollTop <= 0 ) {
- window.scrollBy(0, secondScrollTop - firstScrollTop);
- }
+// Tabs
+interactions.tabs = function( fragment, options ) {
+ options = options || {};
+ if (fragment.constructor == Object)
+ var groups = assignElements(fragment, "tabs", function(set) {
+ $.each(set.tabs, function(key) {
+ $.each(this, function(compName) {
+ $(this).attr({"data-ur-id": key, "data-ur-tabs-component": compName});
+ });
+ });
+ });
+ else
+ var groups = findElements(fragment, "tabs", function(set, comp) {
+ var tabId = $(comp).attr("data-ur-tab-id");
+ set.tabs = set.tabs || {};
+ set.tabs[tabId] = set.tabs[tabId] || {};
+ var compName = $(comp).attr("data-ur-tabs-component");
+ set.tabs[tabId][compName] = set.tabs[tabId][compName] || [];
+ set.tabs[tabId][compName].push(comp);
+ });
+
+ $.each(groups, function(id, group) {
+ group["closeable"] = isenabled($(group["set"]).attr("data-ur-closeable") || options.closeable);
+
+ // Set the state of the tabs
+ $.each(group["tabs"], function() {
+ var tabState = $(this["button"]).attr("data-ur-state") || "disabled";
+ $(this["button"]).add(this["content"]).attr("data-ur-state", tabState);
+ });
+
+ // Set up the button call backs
+ $.each(group["tabs"], function(_, tab) {
+ $(tab["button"]).on("click.ur.tabs", function() {
+ // Is the tab open already?
+ var open = $(this).attr("data-ur-state") == "enabled";
+ $.each(group["tabs"], function() {
+ $(this["button"]).add(this["content"]).attr("data-ur-state", "disabled");
+ });
+ // If closeable (active tab can be toggled) then make sure it happens.
+ if (!open || !group["closeable"]) {
+ $(tab["button"]).add(tab["content"]).attr("data-ur-state", "enabled");
}
- );
- }
- }
-
- var ComponentConstructors = {
- "button" : function(group, component, type) {
- if (group["buttons"] === undefined) {
- group["buttons"] = {}
- }
-
- var tab_id = x$(component).attr("data-ur-tab-id")[0];
- if (tab_id === undefined) {
- Ur.error("tab defined without a tab-id");
- return;
- }
-
- group["buttons"][tab_id] = component;
- },
- "content" : function(group, component, type) {
- if (group["contents"] === undefined) {
- group["contents"] = {}
- }
-
- var tab_id = x$(component).attr("data-ur-tab-id")[0];
- if (tab_id === undefined) {
- Ur.error("tab defined without a tab-id");
- return;
- }
-
- group["contents"][tab_id] = component;
- }
- }
-
- function TabsLoader(){
- }
-
- TabsLoader.prototype.initialize = function(fragment) {
- var tabs = x$(fragment).findElements('tabs', ComponentConstructors);
- Ur.Widgets["tabs"] = {};
-
- for(var name in tabs){
- var tab = tabs[name];
- Ur.Widgets["tabs"][name] = new Tabs(tabs[name]);
- }
- }
+ });
+ });
- return TabsLoader;
-})();
+ $(group["set"]).data("urInit", true);
+ });
+};
diff --git a/lib/toggler.js b/lib/toggler.js
index 6e569db..2db5edb 100644
--- a/lib/toggler.js
+++ b/lib/toggler.js
@@ -1,96 +1,43 @@
-/* Toggler *
-* * * * * *
-* The toggler alternates the state of all the content elements bound to the
-* toggler button.
-*
-* If no initial state is provided, the default value 'disabled'
-* is set upon initialization.
-*/
-
-Ur.QuickLoaders['toggler'] = (function(){
- function ToggleContentComponent (group, content_component) {
- // This is a 'collection' of components
- // -- if I see it again, I'll make this abstract
- if(group["content"] === undefined) {
- group["content"] = [];
- }
- group["content"].push(content_component);
- }
-
- function ToggleLoader(){
- this.component_constructors = {
- "content" : ToggleContentComponent
- };
+// Toggler
+interactions.toggler = function( fragment ) {
+ function getRealHeight(item) {
+ var clone;
+ clone = $(item).clone().css({"height":"auto","position":"absolute", "top":"-3000px", "left":"-3000px"}).appendTo("body");
+ var height = clone.height();
+ clone.remove();
+ return height;
}
-
- ToggleLoader.prototype.find = function(fragment){
- var togglers = x$(fragment).findElements('toggler', this.component_constructors);
- var self=this;
-
- for(var toggler_id in togglers) {
- var toggler = togglers[toggler_id];
-
- if (toggler["button"] === undefined) {
- Ur.error("no button found for toggler with id=" + toggler_id);
- continue;
- }
-
- var toggler_state = x$(toggler["button"]).attr("data-ur-state")[0];
- if(toggler_state === undefined) {
- x$(toggler["button"]).attr("data-ur-state", 'disabled');
- toggler_state = "disabled";
- }
-
- if (toggler["content"] === undefined) {
- Ur.error("no content found for toggler with id=" + toggler_id);
- continue;
+ if (fragment.constructor == Object)
+ var groups = assignElements(fragment, "toggler");
+ else
+ var groups = findElements(fragment, "toggler");
+
+ $.each(groups, function(id, group) {
+ if (!group["button"])
+ $.error("no button found for toggler with id: " + id);
+ if (!group["content"])
+ $.error("no content found for toggler with id: " + id);
+
+ var togglerState = $(group["button"]).attr("data-ur-state") || "disabled";
+ $(group["button"]).add(group["content"]).attr("data-ur-state", togglerState);
+
+ $(group["button"]).on("click.ur.toggler", function(event) {
+ var enabled = $(group["button"]).attr("data-ur-state") == "enabled";
+ var newState = enabled ? "disabled" : "enabled";
+ var collapsible = $(group["content"]).attr("data-ur-collapsible") && $(group["content"]).attr("data-ur-collapsible") == "enabled";
+ $(group["button"]).add(group["content"]).attr("data-ur-state", newState);
+ if (collapsible) {
+ var height = enabled ? "0" : getRealHeight($(group["content"]));
+ $(group["content"]).css("height", height);
}
+ if (!enabled)
+ $(group["drawer"]).attr("data-ur-state", newState);
+ });
- // Make the content state match the button state
- x$().iterate(
- toggler["content"],
- function(content) {
- if (x$(content).attr("data-ur-state")[0] === undefined ) {
- x$(content).attr("data-ur-state", toggler_state)
- }
- }
- );
-
- }
-
- return togglers;
- }
-
- ToggleLoader.prototype.construct_button_callback = function(contents, set) {
- var self = this;
- return function(evt) {
- var button = evt.currentTarget;
- var current_state = x$(button).attr("data-ur-state")[0];
- var new_state = current_state === "enabled" ? "disabled" : "enabled";
-
- x$(button).attr("data-ur-state", new_state);
- x$(set).attr("data-ur-state", new_state);
-
- x$().iterate(
- contents,
- function(content){
- var current_state = x$(content).attr("data-ur-state")[0];
- var new_state = current_state === "enabled" ? "disabled" : "enabled";
- x$(content).attr("data-ur-state", new_state);
- }
- );
- }
- }
-
- ToggleLoader.prototype.initialize = function(fragment) {
- var togglers = this.find(fragment);
- for(var name in togglers){
- var toggler = togglers[name];
- // if (togglers)
- x$(toggler["button"]).click(this.construct_button_callback(toggler["content"], toggler["set"]));
- x$(toggler["set"]).attr("data-ur-state","enabled");
- }
- }
+ $(group["drawer"]).on("webkitTransitionEnd.ur.toggler transitionend.ur.toggler", function() {
+ $(this).attr("data-ur-state", $(group["button"]).attr("data-ur-state"));
+ });
- return ToggleLoader;
- })();
+ $(group["set"]).data("urInit", true);
+ });
+};
diff --git a/lib/zoom.js b/lib/zoom.js
new file mode 100644
index 0000000..606ab0d
--- /dev/null
+++ b/lib/zoom.js
@@ -0,0 +1,396 @@
+// Zoom
+interactions.zoom = function ( fragment, options ) {
+ options = $.extend({touch: true}, options);
+ if (fragment.constructor == Object) {
+ var groups = assignElements(fragment, "zoom", function(set) {
+ set.img = [];
+ $.each(set.imgs, function() {
+ $(this.img).attr({
+ "data-ur-zoom-component": "img",
+ "data-ur-width": this.width,
+ "data-ur-height": this.height,
+ "data-ur-src": this.src});
+ set.img.push($(this.img));
+ });
+ $(set.loading).attr({"data-ur-zoom-component": "loading", "data-ur-state": "disabled"});
+ });
+ }
+ else
+ var groups = findElements(fragment, "zoom");
+
+ // Private shared variables
+
+ var loadedImgs = []; // sometimes the load event doesn't fire when the image src has been previously loaded
+
+ $.each(groups, function(id, group) {
+ Uranium.zoom[id] = new Zoom(this);
+ $(group["set"]).data("urInit", true);
+ });
+
+ function Zoom(set) {
+ var self = this;
+ var zoomer = this;
+ this.container = set["set"];
+ this.img = set["img"];
+ this.state = "disabled";
+
+ // Optionally:
+ this.button = set["button"];
+ this.idler = set["loading"];
+
+ var $container = $(this.container);
+ var $img;
+ var $idler = $(this.idler);
+ var $btn = $(this.button);
+
+ var relX, relY;
+ var offsetX = 0, offsetY = 0;
+ var destOffsetX = 0, destOffsetY = 0;
+ var touchX = 0, touchY = 0;
+ var mouseDown = false; // only used on non-touch browsers
+ var mouseDrag = true;
+
+ var translatePrefix = "translate(", translateSuffix = ")";
+ var scalePrefix = " scale(", scaleSuffix = ")";
+
+ var startCoords, click, down; // used for determining if zoom element is actually clicked
+
+ // momentum sliding
+ var frictionTime, frictionTimer;
+ var dx1 = 0, dy1 = 0;
+ var dx2 = 0, dy2 = 0;
+ var time1 = 0, time2 = 0;
+ var slidex, slidey;
+
+ this.transform3d = transform3d;
+ var custom3d = $container.attr("data-ur-transform3d");
+ if (custom3d)
+ this.transform3d = custom3d != "disabled";
+ else if ("transform3d" in options)
+ this.transform3d = options.transform3d;
+
+ if (self.transform3d) {
+ translatePrefix = "translate3d(";
+ translateSuffix = ",0)";
+ scalePrefix = " scale3d(";
+ scaleSuffix = ",1)";
+ }
+
+ $(self.img).each(function() {
+ loadedImgs.push($(this).attr("src"));
+ $(this).data("urZoomImg", new Img(this));
+ });
+
+ function setActive(img) {
+ if ($img && img != $img[0]) {
+ self.state = "enabled-out";
+ var zoomImg = $img.data("urZoomImg");
+ zoomImg.transform(0, 0, 1);
+ zoomImg.transitionEnd();
+ }
+ $img = $(img);
+ }
+
+ // zoom in/out button, zooms in to the center of the image
+ $(self.button).on(touchscreen ? "touchstart.ur.zoom" : "click.ur.zoom", function() {
+ if (self.img.length > 1)
+ setActive($(self.img).filter($container.find("[data-ur-state='active'] *"))[0]);
+ else
+ setActive(self.img[0]);
+ $img.data("urZoomImg").zoom();
+ });
+
+ function Img(img) {
+ var self = this;
+ var $img = $(img);
+ var canvasWidth, canvasHeight;
+ var width, height;
+ var bigWidth, bigHeight;
+ var boundX, boundY;
+ var ratio;
+ var prescale;
+
+ function initialize() {
+ $container.attr("data-ur-transform3d", zoomer.transform3d ? "enabled" : "disabled");
+
+ canvasWidth = canvasWidth || $img.parent().outerWidth();
+ canvasHeight = canvasHeight || $img.parent().outerHeight();
+ width = width || parseInt($img.attr("width")) || parseInt($img.css("width")) || $img[0].width;
+ height = height || parseInt($img.attr("height")) || parseInt($img.css("height")) || $img[0].height;
+
+ bigWidth = parseInt($img.attr("data-ur-width")) || $img[0].naturalWidth;
+ bigHeight = parseInt($img.attr("data-ur-height")) || $img[0].naturalHeight;
+
+ if (!$img.attr("data-ur-src"))
+ $img.attr("data-ur-src", $img.attr("src"));
+
+ if (($img.attr("data-ur-width") && $img.attr("data-ur-height")) || $img.attr("src") == $img.attr("data-ur-src"))
+ prescale = true;
+
+ ratio = bigWidth/width;
+
+ boundX = (bigWidth - canvasWidth)/2; // horizontal translation to view middle of image
+ boundY = (bigHeight - canvasHeight)/2; // vertical translation to view middle of image
+ }
+
+ function panStart(event) {
+ if (zoomer.state == "enabled-slide") {
+ setState("enabled");
+ var t = (Date.now() - frictionTime) / 300;
+ if (t < 1) {
+ clearTimeout(frictionTimer);
+ var cb = 1 - Math.pow(1 - t, 1.685); // approximate cubic bezier y(x)
+ var currentOffsetX = bound(destOffsetX + cb * slidex, [-boundX, boundX]);
+ var currentOffsetY = bound(destOffsetY + cb * slidey, [-boundY, boundY]);
+ transform(currentOffsetX, currentOffsetY, ratio);
+ }
+ }
+
+ mouseDrag = false;
+ touchX = event.pageX;
+ touchY = event.pageY;
+ mouseDown = true;
+ var touches = event.originalEvent.touches;
+ if (touches) {
+ touchX = touches[0].pageX;
+ touchY = touches[0].pageY;
+ }
+
+ var style = $img[0].style;
+ if (window.WebKitCSSMatrix) {
+ var matrix = new WebKitCSSMatrix(style.webkitTransform);
+ offsetX = matrix.m41;
+ offsetY = matrix.m42;
+ }
+ else {
+ var css = style.MozTransform || style.msTransform || style.transform || "translate(0, 0)";
+ css = css.replace(/.*?\(|\)/, "").split(",");
+
+ offsetX = parseInt(css[0]);
+ offsetY = parseInt(css[1]);
+ }
+
+ stifle(event);
+ }
+
+ function panMove(event) {
+ if (!mouseDown) // NOTE: mouseDown should always be true on touch-enabled devices
+ return;
+
+ stifle(event);
+ var x = event.pageX;
+ var y = event.pageY;
+ var touches = event.originalEvent.touches;
+ if (touches) {
+ x = touches[0].pageX;
+ y = touches[0].pageY;
+ }
+ var dx = x - touchX;
+ var dy = y - touchY;
+ if (Math.abs(dx) > 5 || Math.abs(dy) > 5)
+ mouseDrag = true;
+ destOffsetX = bound(offsetX + dx, [-boundX, boundX]);
+ destOffsetY = bound(offsetY + dy, [-boundY, boundY]);
+ transform(destOffsetX, destOffsetY, ratio);
+ dx1 = dx2;
+ dy1 = dy2;
+ dx2 = dx;
+ dy2 = dy;
+ time1 = time2;
+ time2 = Date.now();
+ }
+
+ function panEnd(event) {
+ if (!mouseDrag)
+ self.zoomOut();
+ else if (Date.now() < time2 + 50)
+ slide();
+ stifle(event);
+ mouseDown = false;
+ mouseDrag = true;
+ }
+
+ function slide() {
+ setState("enabled-slide");
+ var ddx = dx2 - dx1, ddy = dy2 - dy1;
+ var scalar = 100 * Math.sqrt((ddx * ddx + ddy * ddy)/(dx2 * dx2 + dy2 * dy2))/(time2 - time1);
+ slidex = scalar * dx2;
+ slidey = scalar * dy2;
+ var newOffsetX = bound(destOffsetX + slidex, [-boundX, boundX]);
+ var newOffsetY = bound(destOffsetY + slidey, [-boundY, boundY]);
+ transform(newOffsetX, newOffsetY, ratio);
+ frictionTime = Date.now();
+ frictionTimer = setTimeout(function() {
+ setState("enabled");
+ }, 300);
+ }
+
+ this.transitionEnd = function() {
+ if (zoomer.state == "enabled-in") {
+ $img.css({ webkitTransitionDelay: "", MozTransitionDelay: "", OTransitionDelay: "", transitionDelay: "" });
+
+ $img.attr("src", $img.attr("data-ur-src"));
+ if (loadedImgs.indexOf($img.attr("data-ur-src")) == -1) {
+ setTimeout(function() {
+ if (loadedImgs.indexOf($img.attr("data-ur-src")) == -1)
+ $idler.attr("data-ur-state", "enabled");
+ }, 16);
+ }
+ setState("enabled");
+
+ $img
+ .on(downEvent + ".zoom", panStart)
+ .on(moveEvent + ".zoom", panMove)
+ .on(upEvent + ".zoom", panEnd);
+ }
+ else if (zoomer.state == "enabled-out") {
+ setState("disabled");
+
+ $img
+ .off(downEvent + ".zoom", panStart)
+ .off(moveEvent + ".zoom", panMove)
+ .off(upEvent + ".zoom", panEnd);
+ }
+ }
+
+ function setState(state) {
+ zoomer.state = state;
+ $img.attr("data-ur-state", state);
+ if (zoomer.img.length == 1)
+ $container.attr("data-ur-state", state); // backwards compatibility
+ }
+
+ function zoomHelper(x, y) {
+ $btn.attr("data-ur-state", "enabled");
+ setState("enabled-in");
+
+ transform(x || 0, y || 0, ratio);
+ }
+
+ this.transform = transform;
+ function transform(x, y, scale) {
+ var t = "";
+ if (x != null)
+ t = translatePrefix + x + "px, " + y + "px" + translateSuffix;
+ if (scale != null)
+ t += scalePrefix + scale + ", " + scale + scaleSuffix;
+
+ return $img.css({ webkitTransform: t, MozTransform: t, msTransform: t, transform: t });
+ }
+
+ // attempts to zoom in centering in on the area that was touched
+ this.zoomIn = function(event) {
+ if (zoomer.state != "disabled")
+ return;
+
+ if (!width) {
+ initialize();
+ $img.css("width", width + "px");
+ $img.css("height", height + "px");
+ }
+
+ var x = event.pageX, y = event.pageY;
+ if (event.touches) {
+ x = event.touches[0].pageX;
+ y = event.touches[0].pageY;
+ }
+
+ // find touch location relative to image
+ relX = event.offsetX;
+ relY = event.offsetY;
+ if (relX == undefined || relY == undefined) {
+ var offset = $img[0].getBoundingClientRect();
+ relX = x - offset.left;
+ relY = y - offset.top;
+ }
+
+
+ if (!prescale) {
+ zoomer.state = "enabled-in";
+ $img.attr("src", $img.attr("data-ur-src"));
+ setTimeout(function() {
+ if (!prescale)
+ $idler.attr("data-ur-state", "enabled");
+ }, 0);
+ }
+ else {
+ var translateX = bound(bigWidth/2 - ratio * relX, [-boundX, boundX]);
+ var translateY = bound(bigHeight/2 - ratio * relY, [-boundY, boundY]);
+ zoomHelper(translateX, translateY);
+ }
+ };
+
+ this.zoomOut = function() {
+ if (zoomer.state != "enabled")
+ return;
+ $btn.attr("data-ur-state", "disabled");
+ setState("enabled-out");
+ transform(0, 0, 1);
+ };
+
+ if ($container.attr("data-ur-touch") != "disabled" || options.touch) {
+ // make sure zoom works when dragged inside carousel
+ $img.on(downEvent + ".zoom", function(e) {
+ click = down = true;
+ startCoords = getEventCoords(e);
+ });
+ $img.on(moveEvent + ".zoom", function(e) {
+ var coords = getEventCoords(e);
+ if (down && (Math.abs(startCoords.x - coords.x) + Math.abs(startCoords.x - coords.x)) > 0)
+ click = false;
+ });
+ $img.on("click.ur.zoom", function(e) {
+ if (click) {
+ setActive(this);
+ if (this == $img[0])
+ self.zoomIn(e);
+ }
+ });
+ }
+
+ $img.on("load.ur.zoom", function() {
+ if ($img.attr("src") == $img.attr("data-ur-src"))
+ loadedImgs.push($img.attr("src"));
+ $idler.attr("data-ur-state", "disabled");
+ if (!prescale && zoomer.state == "enabled-in") {
+ prescale = true;
+ initialize();
+ var translateX = bound(bigWidth/2 - ratio * relX, [-boundX, boundX]);
+ var translateY = bound(bigHeight/2 - ratio * relY, [-boundY, boundY]);
+
+ var delay = "0.3s";
+ $img.css({ webkitTransitionDelay: delay, MozTransitionDelay: delay, OTransitionDelay: delay, transitionDelay: delay });
+
+ zoomHelper(translateX, translateY);
+ }
+ });
+
+ // zooms in to the center of the image
+ this.zoom = function() {
+ if (zoomer.state == "disabled") {
+ if (!width) {
+ initialize();
+ $img.css("width", width + "px");
+ $img.css("height", height + "px");
+ }
+
+ if (prescale)
+ zoomHelper(0, 0);
+ else {
+ zoomer.state = "enabled-in";
+ $img.attr("src", $img.attr("data-ur-src"));
+ setTimeout(function() {
+ // if prescale ?
+ if (loadedImgs.indexOf($img.attr("data-ur-src")) == -1)
+ $idler.attr("data-ur-state", "enabled");
+ }, 0);
+ }
+ }
+ else
+ self.zoomOut();
+ };
+
+ $img.on("webkitTransitionEnd.ur.zoom transitionend.ur.zoom", this.transitionEnd);
+ }
+ }
+};