-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"name": "uxrocket.popup", | ||
"version": "0.2.0", | ||
"homepage": "https://github.com/uxrocket/uxrocket.popup", | ||
"authors": [ | ||
"Bilal Çınarlı <[email protected]>" | ||
], | ||
"description": "jQuery based popup", | ||
"main": "lib/uxrocket.popup.js", | ||
"dependencies": { | ||
"jquery": ">=1.11.1" | ||
}, | ||
"keywords": [ | ||
"jQuery", | ||
"javascript", | ||
"popup", | ||
"uxrocket" | ||
], | ||
"license": "MIT", | ||
"ignore": [ | ||
"**/.*", | ||
"node_modules", | ||
"bower_components", | ||
"test", | ||
"tests" | ||
] | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/** | ||
* UX Rocket | ||
* jQuery based popup | ||
* @author Bilal Cinarli | ||
*/ | ||
|
||
;(function($){ | ||
var ux, // local shorthand | ||
index = 1, | ||
|
||
defaults = { | ||
resizable : 'no', | ||
scrollbars : 'yes', | ||
width : 1100, | ||
height : 700, | ||
top : 0, | ||
left : 0 | ||
}; | ||
|
||
// constructor method | ||
var Popup = function(el, options){ | ||
var $el = $(el), | ||
opts = $.extend({}, defaults, options, $el.data()), | ||
|
||
// cached variables | ||
url = $el.attr('href'), | ||
windowName = 'uxrocketApp_' + index, | ||
params; | ||
|
||
sizeToDims(opts); | ||
|
||
if(typeof opts.window !== 'undefined' && opts.window !== '') | ||
{ | ||
windowName = opts.window; | ||
|
||
delete opts.window; | ||
} | ||
|
||
params = $.param(opts).split('&').join(', '); | ||
|
||
$el.on('click', function(e){ | ||
e.preventDefault(); | ||
|
||
window.open(url, windowName, params); | ||
}); | ||
|
||
index++; | ||
}; | ||
|
||
var sizeToDims = function(opts){ | ||
var str, slice; | ||
|
||
if(typeof opts.size === 'string' && opts.size !== ''){ | ||
str = opts.size; | ||
slice = str.split(","); | ||
opts.width = $.trim(slice[0]); | ||
opts.height = $.trim(slice[1]); | ||
delete opts.size; | ||
} | ||
|
||
return opts; | ||
}; | ||
|
||
// jquery bindings | ||
ux = $.fn.popup = $.uxpopup = function(options){ | ||
return this.each(function(){ | ||
var $el = $(this), | ||
popup; | ||
|
||
if($el.hasClass('uxitd-popup-ready')){ | ||
return; | ||
} | ||
|
||
$el.addClass('uxitd-popup-ready'); | ||
|
||
popup = new Popup(this, options); | ||
}); | ||
}; | ||
|
||
// Version | ||
ux.version = "0.2.0"; | ||
|
||
// settings | ||
ux.settings = defaults; | ||
|
||
})(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "uxrocket.popup", | ||
"version": "0.2.0", | ||
"description": "jQuery based popup", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/uxrocket/uxrocket.popup.git" | ||
}, | ||
"dependencies": { | ||
"jquery": "latest" | ||
}, | ||
"keywords": [ | ||
"jQuery", | ||
"javascript", | ||
"input", | ||
"textarea", | ||
"uxrocket" | ||
], | ||
"author": "Bilal Cinarli <[email protected]> (http://bcinarli.com/)", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/uxrocket/uxrocket.popup/issues" | ||
}, | ||
"homepage": "https://github.com/uxrocket/uxrocket.popup" | ||
} |
Empty file.