|
17 | 17 | @push('sidebar-scripts') |
18 | 18 | <?php function strp($urlStrp){return str_replace(array('http://', 'https://'), '', $urlStrp);} ?> |
19 | 19 | <!-- start button editor --> |
20 | | - <script> |
21 | | - $(document).ready(function() { |
22 | | - $('#code').click(function() { |
23 | | - var css_text = 'padding-top : ' + button_css.padding_top + ';' + '\npadding-bottom :' + button_css.padding_bottom + ';' + '\npadding-left :' + button_css.padding_left + ';'; |
24 | | - css_text = css_text + '\npadding-right :' + button_css.padding_right + ';' + '\ncolor :' + button_css.color + ';' + '\nbackground-image :' + button_css.background_image + ';'; |
25 | | - css_text = css_text + '\nborder-radius :' + button_css.border_radius + ';' + '\nfont-size :' + button_css.font_size + ';' + '\nfont-family :' + button_css.font_family + ';'; |
26 | | - css_text = css_text + '\nborder-color :' + button_css.border_color + ';' + '\nborder-style :' + button_css.border_style + ';' + '\nborder-width :' + button_css.border_width + ';'; |
| 20 | + <script> |
| 21 | + $(document).ready(function() { |
| 22 | + $('#code').click(function() { |
| 23 | + var css_text = 'color: ' + button_css.color + ';' + '\nbackground-image: ' + button_css.background_image + ';'; |
27 | 24 | $('#sCode').html(css_text); |
28 | 25 | Rainbow.color(div, function() { |
29 | | - document.getElementById('output').appendChild(div); |
30 | | - }); |
31 | | - |
| 26 | + document.getElementById('output').appendChild(div); |
| 27 | + }); |
| 28 | + |
32 | 29 | $('.modal-profile').fadeIn("slow"); |
33 | 30 | $('.modal-lightsout').fadeTo("slow", .9); |
34 | | - }); |
35 | | - |
36 | | - $('a.modal-close-profile, .modal-lightsout').click(function() { |
| 31 | + }); |
| 32 | + |
| 33 | + $('a.modal-close-profile, .modal-lightsout').click(function() { |
37 | 34 | $('.modal-profile').fadeOut("slow"); |
38 | 35 | $('.modal-lightsout').fadeOut("slow"); |
39 | | - }); |
40 | | - |
41 | | - var $button = $("#sample"); |
42 | | - $("#ex1").gradientPicker({ |
| 36 | + }); |
| 37 | + |
| 38 | + var $button = $("#sample"); |
| 39 | + $("#ex1").gradientPicker({ |
43 | 40 | change: function(points, styles) { |
44 | | - for (i = 1; i < styles.length; ++i) { |
45 | | - $button.css("background-image", styles[i]); |
46 | | - button_css.background_image = styles[i]; |
47 | | - } |
| 41 | + for (i = 1; i < styles.length; ++i) { |
| 42 | + $button.css("background-image", styles[i]); |
| 43 | + button_css.background_image = styles[i]; |
| 44 | + } |
48 | 45 | }, |
49 | 46 | fillDirection: "45deg", |
50 | 47 | controlPoints: ["white 0%", "#888888 100%"] |
51 | | - }); |
52 | | - |
53 | | - $('#color').ColorPicker({ |
54 | | - color: '#000000', |
55 | | - onShow: function(colpkr) { |
56 | | - $(colpkr).fadeIn(500); |
57 | | - return false; |
58 | | - }, |
59 | | - onHide: function(colpkr) { |
60 | | - $(colpkr).fadeOut(500); |
61 | | - return false; |
62 | | - }, |
63 | | - onChange: function(hsb, hex, rgb) { |
64 | | - $('#color').css('background-color', '#' + hex); |
65 | | - document.getElementById("sample").style.color = '#' + hex; |
66 | | - button_css.color = '#' + hex; |
67 | | - } |
68 | | - }); |
69 | | - |
70 | | - $('#border-color').ColorPicker({ |
| 48 | + }); |
| 49 | + |
| 50 | + $('#color').ColorPicker({ |
71 | 51 | color: '#000000', |
72 | 52 | onShow: function(colpkr) { |
73 | | - $(colpkr).fadeIn(500); |
74 | | - return false; |
| 53 | + $(colpkr).fadeIn(500); |
| 54 | + return false; |
75 | 55 | }, |
76 | 56 | onHide: function(colpkr) { |
77 | | - $(colpkr).fadeOut(500); |
78 | | - return false; |
| 57 | + $(colpkr).fadeOut(500); |
| 58 | + return false; |
79 | 59 | }, |
80 | 60 | onChange: function(hsb, hex, rgb) { |
81 | | - $('#border-color').css('background-color', '#' + hex); |
82 | | - document.getElementById("sample").style.borderColor = '#' + hex; |
83 | | - button_css.border_color = '#' + hex; |
| 61 | + $('#color').css('background-color', '#' + hex); |
| 62 | + document.getElementById("sample").style.color = '#' + hex; |
| 63 | + button_css.color = '#' + hex; |
84 | 64 | } |
85 | | - }); |
86 | | - |
87 | | - document.getElementById("pdtb").onchange = $.proxy(function() { |
88 | | - var val = document.getElementById('pdtb').value; |
89 | | - $('#sample').css("padding-top", val + 'px'); |
90 | | - $('#sample').css("padding-bottom", val + 'px'); |
91 | | - button_css.padding_top = val + 'px'; |
92 | | - button_css.padding_bottom = val + 'px'; |
93 | | - }, document); |
94 | | - document.getElementById("pdlr").onchange = $.proxy(function() { |
95 | | - var val = document.getElementById('pdlr').value; |
96 | | - $('#sample').css("padding-left", val + 'px'); |
97 | | - $('#sample').css("padding-right", val + 'px'); |
98 | | - button_css.padding_left = val + 'px'; |
99 | | - button_css.padding_right = val + 'px'; |
100 | | - }, document); |
101 | | - document.getElementById("ftb").onchange = $.proxy(function() { |
102 | | - var val = document.getElementById('ftb').value; |
103 | | - $('#sample').css("font-size", val + 'px'); |
104 | | - button_css.font_size = val + 'px'; |
105 | | - }, document); |
106 | | - document.getElementById("br").onchange = $.proxy(function() { |
107 | | - var val = document.getElementById('br').value; |
108 | | - $('#sample').css("border-radius", val + 'px'); |
109 | | - button_css.border_radius = val + 'px'; |
110 | | - }, document); |
111 | | - document.getElementById("tsub").onclick = $.proxy(function() { |
112 | | - var val = document.getElementById('text').value; |
113 | | - $('#sample').text(val); |
114 | | - }, document); |
115 | | - document.getElementById("ffsub").onclick = $.proxy(function() { |
116 | | - var font1 = document.getElementById("font-face"); // or in jQuery use: select = this; |
117 | | - var FontFace = font1.options[font1.selectedIndex].text; |
118 | | - document.getElementById('sample').style.fontFamily = FontFace; |
119 | | - button_css.font_family = FontFace; |
120 | | - }, document); |
121 | | - document.getElementById("bssub").onclick = $.proxy(function() { |
122 | | - var bor = document.getElementById("border-style"); // or in jQuery use: select = this; |
123 | | - var borstyle = bor.options[bor.selectedIndex].text; |
124 | | - document.getElementById('sample').style.borderStyle = borstyle; |
125 | | - $('#sample').text(val); |
126 | | - button_css.border_style = borstyle; |
127 | | - }, document); |
128 | | - document.getElementById("bw").onchange = $.proxy(function() { |
129 | | - var val = document.getElementById('bw').value; |
130 | | - $('#sample').css("border-width", val + 'px'); |
131 | | - button_css.border_width = val + 'px'; |
132 | | - }, document); |
| 65 | + }); |
133 | 66 | }); |
134 | | - |
135 | | - // Many of these values cannot be changed by the UI editor, so they are set to zero here. These values might get used in the future. |
136 | | - var button_css = { |
137 | | - padding_top: 'inherit', |
138 | | - padding_bottom: 'inherit', |
139 | | - color: 'inherit', |
140 | | - background_image: 'inherit', |
141 | | - padding_left: 'inherit', |
142 | | - padding_right: 'inherit', |
143 | | - border_radius: '8px', |
144 | | - font_family: 'inherit', |
145 | | - font_size: 'inherit', |
146 | | - border_color: 'inherit', |
147 | | - border_style: 'inherit', |
148 | | - border_width: 'inherit' |
149 | | - }; |
150 | | - </script> |
| 67 | + // Only include the necessary properties |
| 68 | + var button_css = { |
| 69 | + color: 'inherit', |
| 70 | + background_image: 'inherit' |
| 71 | + }; |
| 72 | + </script> |
151 | 73 |
|
152 | 74 | <link rel="stylesheet" type="text/css" href="{{asset('assets/button-editor/styles/button-gen.css')}}"> |
153 | 75 | <link rel="stylesheet" href="{{asset('assets/button-editor/styles/jquery.gradientPicker.css')}}" type="text/css" /> |
|
0 commit comments