sass-buttons 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3df8085fc57102aff013a090ff140e4fdeb0f85
4
- data.tar.gz: b248f760ec38e1702afd3520d12b27cc10f38698
3
+ metadata.gz: ec6f6f2b001719fae2a83636aafe6e9c50a23ca3
4
+ data.tar.gz: dc0bd64d2461a2921f133a5bdfee541f1f630f64
5
5
  SHA512:
6
- metadata.gz: 52df76ab817b3158da019ee89ac8d6dc4baf88fde3047c38b4a81258ce577d4e381368d1a73d908233ca1a41d0add041fe849c1ce68a9dce03ecd5272e3383ee
7
- data.tar.gz: f15fdc29cf7d4dcefbb7c9e71ed65a15227393439ebaf1e964c0e6e932f48149c0ec5a9f60970a14673372e350d0c42a3c0af979e9382099fa05d1012dda8d91
6
+ metadata.gz: aee2ab35db46244bdbcd6d7dd3a06b01523d007c13f247191e764681dc51b6ebb1c9a43048e85f0db1df059180910a5e35fc3279710fb59a6b3390ecb36f198b
7
+ data.tar.gz: 0c41438786e6b4861405078e445427b47885330af108944cf93d3830e012cc9f35c1863629b9c5326146a8f549967229d7f805e9c217da711a3e018244cb6c8a
data/README.md CHANGED
@@ -21,13 +21,13 @@ Install gem from the command line:
21
21
  Installing Sass Buttons:
22
22
 
23
23
  # Edit the project configuration file and add:
24
- require 'sassy-buttons'
24
+ require 'sass-buttons'
25
25
 
26
26
  # From the command line:
27
- compass install sassy-buttons
27
+ compass install sass-buttons
28
28
 
29
- #import sassy buttons partial into your sass/scss file
30
- @import "sassy-buttons"
29
+ #import sass buttons partial into your sass/scss file
30
+ @import "sass-buttons"
31
31
 
32
32
 
33
33
 
@@ -0,0 +1,112 @@
1
+ /*! @license
2
+ * Project: Buttons
3
+ * Description: A highly customizable CSS button library built with Sass and Compass
4
+ * Author: Alex Wolfe
5
+ * License: Apache License v2.0
6
+ */
7
+
8
+ // the semi-colon before function invocation is a safety net against concatenated
9
+ // scripts and/or other plugins which may not be closed properly.
10
+ ;(function ( $, window, document, undefined ) {
11
+ 'use strict';
12
+
13
+ // undefined is used here as the undefined global variable in ECMAScript 3 is
14
+ // mutable (ie. it can be changed by someone else). undefined isn't really being
15
+ // passed in so we can ensure the value of it is truly undefined. In ES5, undefined
16
+ // can no longer be modified.
17
+
18
+ // window and document are passed through as local variable rather than global
19
+ // as this (slightly) quickens the resolution process and can be more efficiently
20
+ // minified (especially when both are regularly referenced in your plugin).
21
+
22
+ // Create the defaults once
23
+ var pluginName = "menuButton";
24
+ var menuClass = ".button-dropdown";
25
+ var defaults = {
26
+ propertyName: "value"
27
+ };
28
+
29
+ // The actual plugin constructor
30
+ function Plugin( element, options ) {
31
+
32
+ //SET OPTIONS
33
+ this.options = $.extend( {}, defaults, options );
34
+ this._defaults = defaults;
35
+ this._name = pluginName;
36
+
37
+ //REGISTER ELEMENT
38
+ this.$element = $(element);
39
+
40
+ //INITIALIZE
41
+ this.init();
42
+ }
43
+
44
+ Plugin.prototype = {
45
+ constructor: Plugin,
46
+
47
+ init: function() {
48
+ // WE DON'T STOP PROPGATION SO CLICKS WILL AUTOMATICALLY
49
+ // TOGGLE AND REMOVE THE DROPDOWN
50
+ this.toggle();
51
+ },
52
+
53
+ toggle: function(el, options) {
54
+ if(this.$element.data('dropdown') === 'show') {
55
+ this.hideMenu();
56
+ }
57
+ else {
58
+ this.showMenu();
59
+ }
60
+ },
61
+
62
+ showMenu: function() {
63
+ this.$element.data('dropdown', 'show');
64
+ this.$element.find('ul').show();
65
+ },
66
+
67
+ hideMenu: function() {
68
+ this.$element.data('dropdown', 'hide');
69
+ this.$element.find('ul').hide();
70
+ }
71
+ };
72
+
73
+ // A really lightweight plugin wrapper around the constructor,
74
+ // preventing against multiple instantiations
75
+ $.fn[pluginName] = function ( options ) {
76
+ return this.each(function () {
77
+
78
+ // TOGGLE BUTTON IF IT EXISTS
79
+ if ($.data(this, "plugin_" + pluginName)) {
80
+ $.data(this, "plugin_" + pluginName).toggle();
81
+ }
82
+ // OTHERWISE CREATE A NEW INSTANCE
83
+ else {
84
+ $.data(this, "plugin_" + pluginName, new Plugin( this, options ));
85
+ }
86
+ });
87
+ };
88
+
89
+ //CLOSE OPEN DROPDOWN MENUS IF CLICKED SOMEWHERE ELSE
90
+ $(document).on('click', function(e) {
91
+ $.each($('[data-buttons=dropdown]'), function(i, value) {
92
+ if ($(e.target.offsetParent)[0] != $(this)[0]) {
93
+ if ($.data(this, "plugin_" + pluginName)) {
94
+ $.data(this, "plugin_" + pluginName).hideMenu();
95
+ $(this).find('ul').hide();
96
+ }
97
+ }
98
+ });
99
+ });
100
+
101
+ //DELEGATE CLICK EVENT FOR DROPDOWN MENUS
102
+ $(document).on('click', '[data-buttons=dropdown]', function(e) {
103
+ var $dropdown = $(e.currentTarget);
104
+ $dropdown.menuButton();
105
+ });
106
+
107
+ //IGNORE CLICK EVENTS FROM DISPLAY BUTTON IN DROPDOWN
108
+ $(document).on('click', '[data-buttons=dropdown] > a', function(e) {
109
+ e.preventDefault();
110
+ });
111
+
112
+ })( jQuery, window, document);
@@ -1,5 +1,5 @@
1
1
  module Sass
2
2
  module Buttons
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass-buttons
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lester Zhao
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-16 00:00:00.000000000 Z
11
+ date: 2016-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -63,6 +63,7 @@ files:
63
63
  - LICENSE.txt
64
64
  - README.md
65
65
  - Rakefile
66
+ - javascripts/buttons.js
66
67
  - lib/sass-buttons.rb
67
68
  - lib/sass-buttons/version.rb
68
69
  - sache.json
@@ -92,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
93
  version: '0'
93
94
  requirements: []
94
95
  rubyforge_project:
95
- rubygems_version: 2.2.1
96
+ rubygems_version: 2.2.2
96
97
  signing_key:
97
98
  specification_version: 4
98
99
  summary: Easily create Awesome CSS buttons