Skip to content

Commit

Permalink
Release v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vodkabears committed Jul 28, 2014
1 parent ff9cc11 commit 2633be3
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 29 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "remodal",
"version": "0.1.7",
"version": "0.2.0",
"homepage": "http://vodkabears.github.io/remodal/",
"authors": [
"Ilya Makarov <[email protected]>"
Expand Down
11 changes: 8 additions & 3 deletions dist/jquery.remodal.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
/*! Remodal - v0.1.7 - 2014-07-14
* https://github.com/VodkaBears/remodal
* Copyright (c) 2014 VodkaBears; */
/*
* Remodal - v0.2.0
* Flat, responsive, lightweight, easy customizable modal window plugin with declarative state notation and hash tracking.
* http://vodkabears.github.io/remodal/
*
* Made by Ilya Makarov
* Under MIT License
*/

/* ==========================================================================
Remodal necessary styles
Expand Down
81 changes: 61 additions & 20 deletions dist/jquery.remodal.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
/*! Remodal - v0.1.7 - 2014-07-14
* https://github.com/VodkaBears/remodal
* Copyright (c) 2014 VodkaBears; */
/*
* Remodal - v0.2.0
* Flat, responsive, lightweight, easy customizable modal window plugin with declarative state notation and hash tracking.
* http://vodkabears.github.io/remodal/
*
* Made by Ilya Makarov
* Under MIT License
*/
;(function ($) {
"use strict";

Expand Down Expand Up @@ -30,17 +35,17 @@
* @return {Number}
*/
var getTransitionDuration = function ($elem) {
var duration = $elem.css('transition-duration') ||
$elem.css('-webkit-transition-duration') ||
$elem.css('-moz-transition-duration') ||
$elem.css('-o-transition-duration') ||
$elem.css('-ms-transition-duration') ||
var duration = $elem.css("transition-duration") ||
$elem.css("-webkit-transition-duration") ||
$elem.css("-moz-transition-duration") ||
$elem.css("-o-transition-duration") ||
$elem.css("-ms-transition-duration") ||
0;
var delay = $elem.css('transition-delay') ||
$elem.css('-webkit-transition-delay') ||
$elem.css('-moz-transition-delay') ||
$elem.css('-o-transition-delay') ||
$elem.css('-ms-transition-delay') ||
var delay = $elem.css("transition-delay") ||
$elem.css("-webkit-transition-delay") ||
$elem.css("-moz-transition-delay") ||
$elem.css("-o-transition-delay") ||
$elem.css("-ms-transition-delay") ||
0;

return (parseFloat(duration) + parseFloat(delay)) * 1000;
Expand Down Expand Up @@ -81,16 +86,50 @@
* Lock screen
*/
var lockScreen = function () {
$("html, body").addClass(pluginName + "_lock");
$(document.body).css("padding-right", "+=" + getScrollbarWidth());
$("html, body").addClass(pluginName + "_lock");
};

/**
* Unlock screen
*/
var unlockScreen = function () {
$("html, body").removeClass(pluginName + "_lock");
$(document.body).css("padding-right", "-=" + getScrollbarWidth());
$("html, body").removeClass(pluginName + "_lock");
};

/**
* Parse string with options
* @param str
* @returns {Object}
*/
var parseOptions = function (str) {
var obj = {}, clearedStr, arr;

// remove spaces before and after delimiters
clearedStr = str.replace(/\s*:\s*/g, ":").replace(/\s*,\s*/g, ",");

// parse string
arr = clearedStr.split(",");
var i, len, val;
for (i = 0, len = arr.length; i < len; i++) {
arr[i] = arr[i].split(":");
val = arr[i][1];

// convert string value if it is like a boolean
if (typeof val === "string" || val instanceof String) {
val = val === "true" || (val === "false" ? false : val);
}

// convert string value if it is like a number
if (typeof val === "string" || val instanceof String) {
val = !isNaN(val) ? +val : val;
}

obj[arr[i][0]] = val;
}

return obj;
};

/**
Expand Down Expand Up @@ -159,7 +198,7 @@
}
});

$(document).bind('keyup.' + pluginName, function (e) {
$(document).bind("keyup." + pluginName, function (e) {
if (e.keyCode === 27) {
self.close();
}
Expand Down Expand Up @@ -244,9 +283,9 @@
};

if ($) {
$["fn"][pluginName] = function (opts) {
$.fn[pluginName] = function (opts) {
var instance;
this["each"](function (i, e) {
this.each(function (i, e) {
var $e = $(e);
if ($e.data(pluginName) == null) {
instance = new Remodal($e, opts);
Expand Down Expand Up @@ -289,6 +328,8 @@

if (!options) {
options = {};
} else if (typeof options === "string" || options instanceof String) {
options = parseOptions(options);
}

$container[pluginName](options);
Expand Down Expand Up @@ -317,7 +358,7 @@

// Catch syntax error if your hash is bad
try {
$elem = $("[data-" + pluginName + "-id=" + id.replace(new RegExp('/', 'g'), "\\/") + "]");
$elem = $("[data-" + pluginName + "-id=" + id.replace(new RegExp("/", "g"), "\\/") + "]");
} catch (e) {}

if ($elem && $elem.length) {
Expand All @@ -331,4 +372,4 @@
}
};
$(window).bind("hashchange." + pluginName, hashHandler);
})(window["jQuery"] || window["Zepto"]);
})(window.jQuery || window.Zepto);
13 changes: 9 additions & 4 deletions dist/jquery.remodal.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion remodal.jquery.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"ui",
"zepto"
],
"version": "0.1.7",
"version": "0.2.0",
"author": {
"name": "Ilya Makarov",
"email": "[email protected]",
Expand Down

0 comments on commit 2633be3

Please sign in to comment.