diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..1f6f811 --- /dev/null +++ b/bower.json @@ -0,0 +1,27 @@ +{ + "name": "uxrocket.popup", + "version": "0.2.0", + "homepage": "https://github.com/uxrocket/uxrocket.popup", + "authors": [ + "Bilal Çınarlı " + ], + "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" + ] +} diff --git a/docs/install.md b/docs/install.md new file mode 100644 index 0000000..e69de29 diff --git a/lib/uxrocket.popup.js b/lib/uxrocket.popup.js new file mode 100644 index 0000000..182a75e --- /dev/null +++ b/lib/uxrocket.popup.js @@ -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); \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..d95a6b7 --- /dev/null +++ b/package.json @@ -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 (http://bcinarli.com/)", + "license": "MIT", + "bugs": { + "url": "https://github.com/uxrocket/uxrocket.popup/issues" + }, + "homepage": "https://github.com/uxrocket/uxrocket.popup" +} diff --git a/tests/tests.md b/tests/tests.md new file mode 100644 index 0000000..e69de29