cytoplasm 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +38 -0
- data/app/assets/images/cytoplasm/triangle-medium-circle-1.png +0 -0
- data/app/assets/images/cytoplasm/triangle-medium-circle-2.png +0 -0
- data/app/assets/images/cytoplasm/triangle-medium-circle-3.png +0 -0
- data/app/assets/images/cytoplasm/triangle-medium-circle-4.png +0 -0
- data/app/assets/javascripts/cytoplasm/cytoAjax.js.erb +53 -0
- data/app/assets/javascripts/cytoplasm/cytoColorPicker.js.erb +204 -0
- data/app/assets/javascripts/cytoplasm/cytoRadio.js.erb +210 -0
- data/app/assets/javascripts/cytoplasm/cytoSelect.js.erb +414 -0
- data/app/assets/javascripts/cytoplasm/cytoSlider.js.erb +170 -0
- data/app/assets/javascripts/cytoplasm/cytoTable.js.erb +48 -0
- data/app/assets/javascripts/cytoplasm/cytoUpload.js.erb +200 -0
- data/app/assets/javascripts/cytoplasm/cytoplasm.js.erb +220 -0
- data/app/assets/javascripts/cytoplasm/jquery.ba-throttle-debounce.min.js +9 -0
- data/app/assets/javascripts/cytoplasm/jquery.color.js +663 -0
- data/app/assets/javascripts/cytoplasm/less-1.3.1.min.js +9 -0
- data/app/assets/stylesheets/cytoplasm/cytoplasm.less +113 -0
- data/app/controllers/cytoplasm/fonts_controller.rb +46 -0
- data/app/controllers/cytoplasm/settings_controller.rb +34 -0
- data/app/views/cytoplasm/settings/edit.html.erb +529 -0
- data/app/views/cytoplasm/settings/index.html.erb +18 -0
- data/config/routes.rb +6 -0
- data/lib/cytoplasm.rb +317 -0
- data/lib/cytoplasm/ajax.rb +34 -0
- data/lib/cytoplasm/railtie.rb +12 -0
- data/lib/cytoplasm/version.rb +3 -0
- data/lib/tasks/cytoplasm_tasks.rake +4 -0
- data/test/cytoplasm_test.rb +7 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/about.js +2 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/javascripts/demos.js +2 -0
- data/test/dummy/app/assets/javascripts/docs.js +2 -0
- data/test/dummy/app/assets/javascripts/downloads.js +2 -0
- data/test/dummy/app/assets/javascripts/home.js +2 -0
- data/test/dummy/app/assets/stylesheets/about.css +4 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/assets/stylesheets/demos.css +4 -0
- data/test/dummy/app/assets/stylesheets/docs.css +4 -0
- data/test/dummy/app/assets/stylesheets/downloads.css +4 -0
- data/test/dummy/app/assets/stylesheets/home.css +4 -0
- data/test/dummy/app/controllers/about_controller.rb +4 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/demos_controller.rb +4 -0
- data/test/dummy/app/controllers/docs_controller.rb +5 -0
- data/test/dummy/app/controllers/downloads_controller.rb +4 -0
- data/test/dummy/app/controllers/home_controller.rb +7 -0
- data/test/dummy/app/helpers/about_helper.rb +2 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/demos_helper.rb +2 -0
- data/test/dummy/app/helpers/docs_helper.rb +2 -0
- data/test/dummy/app/helpers/downloads_helper.rb +2 -0
- data/test/dummy/app/helpers/home_helper.rb +2 -0
- data/test/dummy/app/views/about/index.html.erb +2 -0
- data/test/dummy/app/views/demos/index.html.erb +15 -0
- data/test/dummy/app/views/docs/index.html.erb +15 -0
- data/test/dummy/app/views/downloads/index.html.erb +60 -0
- data/test/dummy/app/views/home/index.html.erb +74 -0
- data/test/dummy/app/views/layouts/application.html.erb +30 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cytoplasm.vars.yml +4 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +65 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +178434 -0
- data/test/dummy/log/production.log +4 -0
- data/test/dummy/log/test.log +43 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/cytoplasm/cytoplasm.vars.less +36 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/test/functional/about_controller_test.rb +9 -0
- data/test/dummy/test/functional/demos_controller_test.rb +9 -0
- data/test/dummy/test/functional/docs_controller_test.rb +7 -0
- data/test/dummy/test/functional/downloads_controller_test.rb +9 -0
- data/test/dummy/test/functional/home_controller_test.rb +9 -0
- data/test/dummy/test/unit/helpers/about_helper_test.rb +4 -0
- data/test/dummy/test/unit/helpers/demos_helper_test.rb +4 -0
- data/test/dummy/test/unit/helpers/docs_helper_test.rb +4 -0
- data/test/dummy/test/unit/helpers/downloads_helper_test.rb +4 -0
- data/test/dummy/test/unit/helpers/home_helper_test.rb +4 -0
- data/test/dummy/tmp/cache/assets/C23/A50/sprockets%2F1011830ce123d00a75be4330f2721412 +0 -0
- data/test/dummy/tmp/cache/assets/C2E/4E0/sprockets%2F5b29288e435665a224409e7d76530c95 +0 -0
- data/test/dummy/tmp/cache/assets/C75/590/sprockets%2Fc3abe8a0059292e1e3818278c0434027 +0 -0
- data/test/dummy/tmp/cache/assets/C77/C20/sprockets%2F165a39476f3fa731c0af49432141049c +0 -0
- data/test/dummy/tmp/cache/assets/C87/580/sprockets%2Fd904f7e82971fdde744127c702222195 +0 -0
- data/test/dummy/tmp/cache/assets/C8F/0F0/sprockets%2F369f11075c8c5f939359cb5cb0569281 +0 -0
- data/test/dummy/tmp/cache/assets/CA0/B40/sprockets%2F26961c657dc345435242accb433d260a +0 -0
- data/test/dummy/tmp/cache/assets/CA3/4B0/sprockets%2Fb78b7754bf248ba091802070be5c1630 +0 -0
- data/test/dummy/tmp/cache/assets/CA7/8F0/sprockets%2F901b96894219d63a767e8898f73d4ce7 +0 -0
- data/test/dummy/tmp/cache/assets/CAC/280/sprockets%2F408a235a236b0a3aa1302733211db5ba +0 -0
- data/test/dummy/tmp/cache/assets/CAE/FD0/sprockets%2F3bb22e4d409072c2278c1771893ec19e +0 -0
- data/test/dummy/tmp/cache/assets/CB2/AD0/sprockets%2F0c26131d87e0691ba9904e46ff5820b9 +0 -0
- data/test/dummy/tmp/cache/assets/CB8/330/sprockets%2F8d9120752c9f38f7a5e164395e5d0c04 +0 -0
- data/test/dummy/tmp/cache/assets/CBA/320/sprockets%2Fa34641007e856c6bd67567e2ac8668c4 +0 -0
- data/test/dummy/tmp/cache/assets/CCE/F60/sprockets%2F37d1a6c1a8d398c4404b1b00076912fd +0 -0
- data/test/dummy/tmp/cache/assets/CD7/990/sprockets%2F55411442048c5a69b45be06da29ee62c +0 -0
- data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/CD8/900/sprockets%2Fc68606f026190266d8099ada290bbaa4 +0 -0
- data/test/dummy/tmp/cache/assets/CDF/870/sprockets%2Fb878faf942403e313a5b103e5d80488e +0 -0
- data/test/dummy/tmp/cache/assets/CE1/E60/sprockets%2F08ae5c39217fa93841884cfcb0037c46 +0 -0
- data/test/dummy/tmp/cache/assets/CE2/AE0/sprockets%2F79562f7c45761a5d0dba9361d11ae594 +0 -0
- data/test/dummy/tmp/cache/assets/CE3/080/sprockets%2F7d4d7689d6fa8236f0b4848c03ba1215 +0 -0
- data/test/dummy/tmp/cache/assets/CE4/530/sprockets%2F70521f5a32e550f6da0d76e896c7183e +0 -0
- data/test/dummy/tmp/cache/assets/CE5/D30/sprockets%2F8c9834a63b25a66203918a75ff56e2ac +0 -0
- data/test/dummy/tmp/cache/assets/CEE/7F0/sprockets%2F8b32778387c589166e26a7e5a6aa4cc3 +0 -0
- data/test/dummy/tmp/cache/assets/CF3/120/sprockets%2Fe2b304b015ce82a222d634e7e544b0b3 +0 -0
- data/test/dummy/tmp/cache/assets/CF7/ED0/sprockets%2F8061089f9dc8af8cc6353949d9b9d212 +0 -0
- data/test/dummy/tmp/cache/assets/CF9/7C0/sprockets%2F40fc2f3d2a468a00e463f1d313cb1683 +0 -0
- data/test/dummy/tmp/cache/assets/D03/6B0/sprockets%2Fd3cfc780201b87a3439e35c5236bb71a +0 -0
- data/test/dummy/tmp/cache/assets/D05/D40/sprockets%2F1c9faaf28d05409b88ad3113374d613c +0 -0
- data/test/dummy/tmp/cache/assets/D06/7A0/sprockets%2Fa46b76e739460d2691f4121ffa8a0ca0 +0 -0
- data/test/dummy/tmp/cache/assets/D0D/A10/sprockets%2F5c22f257a7abbc8e5720b17433657f6d +0 -0
- data/test/dummy/tmp/cache/assets/D0E/4A0/sprockets%2F6b27287928ba630c1b25dfa80ee18b48 +0 -0
- data/test/dummy/tmp/cache/assets/D0E/7D0/sprockets%2F89200785fe2710582a6c1b8d04ae7fbe +0 -0
- data/test/dummy/tmp/cache/assets/D12/010/sprockets%2F8067431ced3f34f1c97d34c3b4fb7049 +0 -0
- data/test/dummy/tmp/cache/assets/D12/1E0/sprockets%2Fba248329196c372b79d1f4c4f2a771bf +0 -0
- data/test/dummy/tmp/cache/assets/D14/170/sprockets%2F40a7b83bb067eea7ce2c8394e1529287 +0 -0
- data/test/dummy/tmp/cache/assets/D15/8E0/sprockets%2F4752afcb2967724e7e47b58b200d8ed2 +0 -0
- data/test/dummy/tmp/cache/assets/D15/CE0/sprockets%2Fa1310379a19df3c1796f2f67dcd5915d +0 -0
- data/test/dummy/tmp/cache/assets/D21/A50/sprockets%2Feb094bfe70c49891ce65c0178d88d904 +0 -0
- data/test/dummy/tmp/cache/assets/D2D/E60/sprockets%2F34ec37e4221a9a127bf1de1ee52951b0 +0 -0
- data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/D47/930/sprockets%2F1a738430fd705a9dddde85a18dd29782 +0 -0
- data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/D50/750/sprockets%2F7fbcc321810c8f493f86364fee480ed9 +0 -0
- data/test/dummy/tmp/cache/assets/D52/430/sprockets%2F6ada07f0c9869f9f35b05fa0988dc717 +0 -0
- data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/D60/2A0/sprockets%2Ff1857b8a367fbae328221040cfcb2f1c +0 -0
- data/test/dummy/tmp/cache/assets/D65/180/sprockets%2F346621e7334bd914afc87bc6a9d1bc0a +0 -0
- data/test/dummy/tmp/cache/assets/D65/F10/sprockets%2F0a60d2fd5c544ea66af4d382b5e3d147 +0 -0
- data/test/dummy/tmp/cache/assets/D68/A20/sprockets%2F8b8272d3eaf9323f1c34114cbcbf56f3 +0 -0
- data/test/dummy/tmp/cache/assets/D69/0A0/sprockets%2Fe6c078d521b528e004f5dd673ddb2a6d +0 -0
- data/test/dummy/tmp/cache/assets/D69/0B0/sprockets%2Fb9e3ae8763ce66c2090d9413bdd400fa +0 -0
- data/test/dummy/tmp/cache/assets/D6E/3E0/sprockets%2F1be4cbdc9c19703c546405f087aee92d +0 -0
- data/test/dummy/tmp/cache/assets/D73/5F0/sprockets%2F6aee922214ffea56b31595f1a5ed8c92 +0 -0
- data/test/dummy/tmp/cache/assets/D78/840/sprockets%2F326ec6387a9d1b45ec2cdf7093b79f0e +0 -0
- data/test/dummy/tmp/cache/assets/D83/C70/sprockets%2Ff536f7a68e692747fca1d2fcd5c07f57 +0 -0
- data/test/dummy/tmp/cache/assets/D87/C40/sprockets%2F9dcd7a6999affe28e91e514cee079016 +0 -0
- data/test/dummy/tmp/cache/assets/D88/700/sprockets%2Fe13c6f31271a8ac23e63ef0a118ebe2b +0 -0
- data/test/dummy/tmp/cache/assets/D98/8B0/sprockets%2Fedbef6e0d0a4742346cf479f2c522eb0 +0 -0
- data/test/dummy/tmp/cache/assets/DA4/140/sprockets%2F24502b9d4e4eea6f709e089c0fdff30f +0 -0
- data/test/dummy/tmp/cache/assets/DBE/210/sprockets%2Fbedb89fd02eac0dc7aa93c820c612343 +0 -0
- data/test/dummy/tmp/cache/assets/DBE/950/sprockets%2F46cc27391a6badaac462d9b3aa43ec73 +0 -0
- data/test/dummy/tmp/cache/assets/DC7/E10/sprockets%2Fac6d2602a61a59c16ad89cbf2d2d48de +0 -0
- data/test/dummy/tmp/cache/assets/DC8/E80/sprockets%2F117e87cbd2939c4a9afcbbca2a3684d0 +0 -0
- data/test/dummy/tmp/cache/assets/DCD/AD0/sprockets%2Ffb914fa2e51ab43f0f857f0fddd8713b +0 -0
- data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/DEB/B50/sprockets%2Fdcfb6dd7dae66f42a5a10e80a33d1b24 +0 -0
- data/test/dummy/tmp/cache/assets/DEC/A90/sprockets%2F3f26f0f2e3ea4a0e194b22be6c3b5cce +0 -0
- data/test/dummy/tmp/cache/assets/E00/880/sprockets%2Fecb876bb310c1a3e6fd534ece45c9ed9 +0 -0
- data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/E05/E70/sprockets%2Fead5bfd3417fc5de81d3794c3e443cfe +0 -0
- data/test/dummy/tmp/cache/assets/E1A/970/sprockets%2Ff89b4657cfc95e2d28f6fad44c58edfb +0 -0
- data/test/dummy/tmp/cache/assets/E2E/720/sprockets%2Ff76ac8420ca62debb77ecbfe7d0c6d45 +0 -0
- data/test/dummy/tmp/cache/assets/E38/2A0/sprockets%2Fc6e8ba43cbed7d3981f70bcfeb3a69c9 +0 -0
- data/test/dummy/tmp/cache/assets/E69/B60/sprockets%2Ffdbf7ec615e9a92e4857cdade17f4daa +0 -0
- data/test/dummy/tmp/cache/assets/E71/0E0/sprockets%2Fcbbecea061be6e609adc04133b9badab +0 -0
- data/test/dummy/tmp/cache/assets/E8C/480/sprockets%2Fdacb331ac961cf7b7cbc69abe8fb74dd +0 -0
- data/test/dummy/tmp/cache/assets/E8D/B40/sprockets%2Fb862bf7fb4b4c634aeaa9dfc97babc6b +0 -0
- data/test/test_helper.rb +15 -0
- metadata +420 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2012 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'Cytoplasm'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
Bundler::GemHelper.install_tasks
|
27
|
+
|
28
|
+
require 'rake/testtask'
|
29
|
+
|
30
|
+
Rake::TestTask.new(:test) do |t|
|
31
|
+
t.libs << 'lib'
|
32
|
+
t.libs << 'test'
|
33
|
+
t.pattern = 'test/**/*_test.rb'
|
34
|
+
t.verbose = false
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
task :default => :test
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,53 @@
|
|
1
|
+
// CytoAjax v0.5
|
2
|
+
// MacKinley Smith
|
3
|
+
(function($){
|
4
|
+
$.cytoAjaxResponse = function(message,type,time){
|
5
|
+
if (message==null) message = "Success!";
|
6
|
+
if (type==null) type = "success";
|
7
|
+
if (time==null) time = 0;
|
8
|
+
|
9
|
+
$('.callback_message').hide();
|
10
|
+
$('html,body').animate({scrollTop:0},400);
|
11
|
+
$('#'+type+"_message").html(message).show(400,function(){
|
12
|
+
var $this = $(this);
|
13
|
+
if (time) setTimeout(function(){$this.hide(400);},time);
|
14
|
+
});
|
15
|
+
};
|
16
|
+
$.cytoAjax = function(script,data_to_pass,success,error){
|
17
|
+
// Set default parameters
|
18
|
+
if (typeof script != "string" || script == "") return false;
|
19
|
+
if (data_to_pass==null || typeof data_to_pass != "object") {
|
20
|
+
if (typeof data_to_pass == "function") {
|
21
|
+
if (typeof success == "function") error = success;
|
22
|
+
success = data_to_pass;
|
23
|
+
}
|
24
|
+
data_to_pass = {ajax:script};
|
25
|
+
} else data_to_pass = $.extend(true,{},{ajax:script},data_to_pass);
|
26
|
+
|
27
|
+
// Make request
|
28
|
+
$.ajax({
|
29
|
+
url:script,
|
30
|
+
type:'get',
|
31
|
+
dataType:'html',
|
32
|
+
processData:false,
|
33
|
+
success:function(data,textStatus,jqXHR) {
|
34
|
+
try {
|
35
|
+
data = $.parseJSON(data);
|
36
|
+
} catch (e) {
|
37
|
+
data = $.parseJSON('{"status":"Error","message":"AJAX Return Error: '+e.replace(/"/g,"'")+'<br />'+data.replace(/"/g,"'")+'"}');
|
38
|
+
}
|
39
|
+
if (data.status=="OK") {
|
40
|
+
if (typeof success == "function") success.apply(this,[data]);
|
41
|
+
else if (data.message!=null) $.cytoAjaxResponse(data.message);
|
42
|
+
else $.cytoAjaxResponse(((typeof success == "string")?success:"Success!"));
|
43
|
+
} else if (data.status=="Error") {
|
44
|
+
if (data.message != null) $.cytoAjaxResponse(data.message,"error");
|
45
|
+
if (typeof error == "function") error.apply(this,[data]);
|
46
|
+
}
|
47
|
+
},
|
48
|
+
error:function(jqXHR,textStatus,errorThrown){
|
49
|
+
if (typeof error == "function") error.apply(this,[{status:"Error",message:errorThrown}]);
|
50
|
+
}
|
51
|
+
});
|
52
|
+
};
|
53
|
+
})(jQuery);
|
@@ -0,0 +1,204 @@
|
|
1
|
+
// CytoColorPicker v0.5
|
2
|
+
// By MacKinley Smith
|
3
|
+
(function($){
|
4
|
+
var defaults = {
|
5
|
+
format:'hsla', // hsla, hex, rgba
|
6
|
+
events:{
|
7
|
+
change:function(color){}
|
8
|
+
},
|
9
|
+
widget:{
|
10
|
+
previewer:{
|
11
|
+
css:{
|
12
|
+
display:'inline-block',
|
13
|
+
width:152,
|
14
|
+
height:152,
|
15
|
+
"margin-right":10,
|
16
|
+
"border-radius":10,
|
17
|
+
"box-shadow":"0px 0px 10px rgba(0,0,0,0.5)"
|
18
|
+
},
|
19
|
+
element:null
|
20
|
+
},
|
21
|
+
slider_table:{
|
22
|
+
attrs:{
|
23
|
+
hue:{
|
24
|
+
max:359
|
25
|
+
},
|
26
|
+
saturation:{
|
27
|
+
max:1,
|
28
|
+
step:0.01
|
29
|
+
},
|
30
|
+
lightness:{
|
31
|
+
max:1,
|
32
|
+
step:0.01
|
33
|
+
},
|
34
|
+
alpha:{
|
35
|
+
max:1,
|
36
|
+
step:0.01
|
37
|
+
}
|
38
|
+
},
|
39
|
+
css:{
|
40
|
+
display:'inline-block',
|
41
|
+
'vertical-align':'top',
|
42
|
+
'border-width':1
|
43
|
+
},
|
44
|
+
element:null,
|
45
|
+
sliders:{
|
46
|
+
elements:[],
|
47
|
+
settings:{
|
48
|
+
animate:true,
|
49
|
+
min:0,
|
50
|
+
slide:function(e,ui){
|
51
|
+
$(this).parent().parent().find("span.num").html($(this).slider("value"));
|
52
|
+
methods.update.apply($(this).parents(".cytoColorPicker-wrapper").find('.cytoColorPicker'));
|
53
|
+
},
|
54
|
+
change:function(e,ui){
|
55
|
+
$(this).parent().parent().find("span.num").html($(this).slider("value"));
|
56
|
+
methods.update.apply($(this).parents(".cytoColorPicker-wrapper").find('.cytoColorPicker'));
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}
|
60
|
+
},
|
61
|
+
wrapper:{
|
62
|
+
css:{},
|
63
|
+
element:null
|
64
|
+
}
|
65
|
+
},
|
66
|
+
default_value:"hlsa(0,0%,100%,1)"
|
67
|
+
};
|
68
|
+
var attrs = ['hue','saturation','lightness','alpha'];
|
69
|
+
var methods = {
|
70
|
+
init:function(options){
|
71
|
+
return this.each(function(){
|
72
|
+
var $this = $(this);
|
73
|
+
|
74
|
+
// Instantiate settings
|
75
|
+
var settings = $.extend(true,{},defaults,options);
|
76
|
+
$this.data('cytoColorPicker',settings);
|
77
|
+
|
78
|
+
// Generate widget
|
79
|
+
$this.addClass('cytoColorPicker').css({display:'none'});
|
80
|
+
settings.widget.wrapper.element = $this.wrap("<div class='cytoColorPicker-wrapper' />").parent().css(settings.widget.wrapper.css);
|
81
|
+
settings.widget.previewer.element = $('<div />').addClass('cytoColorPicker-previewer').css(settings.widget.previewer.css).appendTo(settings.widget.wrapper.element).click(function(e){
|
82
|
+
|
83
|
+
});
|
84
|
+
|
85
|
+
// Generate slider table
|
86
|
+
var slider_table = $('<table />').attr({cellPadding:0,cellSpacing:0}).css(settings.widget.slider_table.css).appendTo(settings.widget.wrapper.element);
|
87
|
+
for (var i=0;i<settings.format.length;i++) {
|
88
|
+
var letter = settings.format[i];
|
89
|
+
var tr = $('<tr />').appendTo(slider_table);
|
90
|
+
var lc = $('<td />').addClass('labelcell').html(letter.toUpperCase()+": ").append($('<span />').addClass('num').html(0)).appendTo(tr);
|
91
|
+
var sc = $('<td />').addClass('cytoColorPicker-sliderCell').appendTo(tr);
|
92
|
+
var slider = $('<div data-attr="'+attrs[i]+'" />').appendTo(sc).slider($.extend(true,{},settings.widget.slider_table.sliders.settings,settings.widget.slider_table.attrs[attrs[i]]));
|
93
|
+
settings.widget.slider_table.sliders.elements.push(slider);
|
94
|
+
}
|
95
|
+
slider_table.find('td').css({'padding':"5px 10px"}).filter('.labelcell').width(50);
|
96
|
+
|
97
|
+
$this.data('cytoColorPicker',settings);
|
98
|
+
|
99
|
+
// Get initial value as color
|
100
|
+
var wasSet = ($this.val()!="");
|
101
|
+
if (wasSet) settings.default_value = $this.val();
|
102
|
+
settings.value = $.Color(settings.default_value);
|
103
|
+
|
104
|
+
// Commit settings to data-cytoColorPicker attribute
|
105
|
+
$this.data('cytoColorPicker',settings);
|
106
|
+
methods.resize.apply($this);
|
107
|
+
if (wasSet) methods.value.apply($this,[settings.value]);
|
108
|
+
else methods.update.apply($this);
|
109
|
+
});
|
110
|
+
},
|
111
|
+
update:function(){
|
112
|
+
return this.each(function(){
|
113
|
+
var $this = $(this);
|
114
|
+
var settings = $this.data('cytoColorPicker');
|
115
|
+
if (!$this.hasClass('cytoColorPicker') || settings==null) return console.warn("You must instanciate $.cytoColorPicker before calling this method!");
|
116
|
+
|
117
|
+
var wrapper = $this.parent();
|
118
|
+
var previewer = wrapper.find(".cytoColorPicker-previewer");
|
119
|
+
var sliders = wrapper.find('.ui-slider');
|
120
|
+
var color = {};
|
121
|
+
sliders.each(function(i){color[attrs[i]] = sliders.filter("[data-attr="+attrs[i]+"]").slider("value");});
|
122
|
+
color = $.Color(color);
|
123
|
+
previewer.css({"background-color":color.toHslaString()});
|
124
|
+
|
125
|
+
$this.val(color.toHslaString());
|
126
|
+
settings.events.change.apply($this,[color]);
|
127
|
+
});
|
128
|
+
},
|
129
|
+
value:function(color){
|
130
|
+
return this.each(function(){
|
131
|
+
var $this = $(this);
|
132
|
+
var settings = $this.data('cytoColorPicker');
|
133
|
+
if (!$this.hasClass('cytoColorPicker') || settings==null) return console.warn("You must instanciate $.cytoColorPicker before calling the set method!");
|
134
|
+
|
135
|
+
var wrapper = $this.parent();
|
136
|
+
color = $.Color(color);
|
137
|
+
var sliders = wrapper.find('.ui-slider');
|
138
|
+
sliders.each(function(i){sliders.filter("[data-attr="+attrs[i]+"]").slider("value",color.hsla()[i]);});
|
139
|
+
|
140
|
+
methods.update.apply($this,[color]);
|
141
|
+
});
|
142
|
+
},
|
143
|
+
resize:function(){
|
144
|
+
return this.each(function(){
|
145
|
+
var $this = $(this);
|
146
|
+
var settings = $this.data('cytoColorPicker');
|
147
|
+
if (!$this.hasClass('cytoColorPicker') || settings==null) return console.warn("You must instanciate $.cytoColorPicker before calling the resize method!");
|
148
|
+
settings.widget.wrapper.element.width(0).css({opacity:0});
|
149
|
+
setTimeout(function(){
|
150
|
+
settings.widget.wrapper.element.width('100%').css({opacity:1}).find('.cytoColorPicker-sliderCell').width(settings.widget.wrapper.element.innerWidth()-settings.widget.previewer.element.outerWidth(true)-100);
|
151
|
+
},1);
|
152
|
+
});
|
153
|
+
},
|
154
|
+
destroy:function(){
|
155
|
+
return this.each(function(){
|
156
|
+
var $this = $(this);
|
157
|
+
var settings = $(this).data('cytoColorPicker');
|
158
|
+
if (!$this.hasClass('cytoColorPicker') || settings==null) return console.warn("You must instanciate $.cytoColorPicker before calling the destroy method!");
|
159
|
+
var wrapper = $this.parent();
|
160
|
+
$this.insertBefore(wrapper).removeClass('cytoColorPicker').data('cytoColorPicker',null);
|
161
|
+
wrapper.remove();
|
162
|
+
});
|
163
|
+
},
|
164
|
+
refresh:function(){
|
165
|
+
return this.each(function(){
|
166
|
+
var $this = $(this);
|
167
|
+
var settings = $(this).data('cytoColorPicker');
|
168
|
+
if (!$this.hasClass('cytoColorPicker') || settings==null) return console.warn("You must instanciate $.cytoColorPicker before calling the refresh method!");
|
169
|
+
methods.destroy.apply($this);
|
170
|
+
methods.init.apply($this,[settings]);
|
171
|
+
$this.trigger('change.cytoColorPicker');
|
172
|
+
});
|
173
|
+
},
|
174
|
+
options:function(newOptions){
|
175
|
+
if (newOptions!=null) {
|
176
|
+
return this.each(function(){
|
177
|
+
var $this = $(this);
|
178
|
+
var settings = $this.data('cytoColorPicker');
|
179
|
+
if (!$this.hasClass("cytoColorPicker") || settings==null) return console.warn("You must instanciate $.cytoColorPicker before you call the options method!");
|
180
|
+
$this.data('cytoColorPicker',$.extend(true,{},settings,newOptions));
|
181
|
+
methods.refresh.apply($this);
|
182
|
+
});
|
183
|
+
} else {
|
184
|
+
var returnVal;
|
185
|
+
this.each(function(){
|
186
|
+
var $this = $(this);
|
187
|
+
var settings = $this.data('cytoColorPicker');
|
188
|
+
if (!$this.hasClass("cytoColorPicker") || settings==null) return console.warn("You must instanciate $.cytoColorPicker before you call the options method!");
|
189
|
+
returnVal = settings;
|
190
|
+
});
|
191
|
+
return returnVal;
|
192
|
+
}
|
193
|
+
}
|
194
|
+
};
|
195
|
+
|
196
|
+
$.fn.cytoColorPicker = function(method){
|
197
|
+
if (methods[method]) return methods[method].apply(this,Array.prototype.slice.call(arguments,1));
|
198
|
+
else if (typeof method == 'object' || !method) return methods.init.apply(this,arguments);
|
199
|
+
else $.error('Method ' + method + ' does not exist on $.cytoColorPicker!');
|
200
|
+
};
|
201
|
+
|
202
|
+
$(window).resize(function(){$('.cytoColorPicker').cytoColorPicker("resize");});
|
203
|
+
$.Cytoplasm("ready",function(){$('.cytoColorPicker').cytoColorPicker();});
|
204
|
+
})(jQuery);
|
@@ -0,0 +1,210 @@
|
|
1
|
+
// CytoRadio v1.0
|
2
|
+
// By MacKinley Smith
|
3
|
+
(function($){
|
4
|
+
var defaults = {
|
5
|
+
widget:{
|
6
|
+
buttonList:{
|
7
|
+
buttons:{
|
8
|
+
css:{
|
9
|
+
display:'inline-block',
|
10
|
+
height:30,
|
11
|
+
padding:0,
|
12
|
+
'border-radius':0
|
13
|
+
},
|
14
|
+
elements:[]
|
15
|
+
},
|
16
|
+
borderRadius:5,
|
17
|
+
css:{
|
18
|
+
width:"100%"
|
19
|
+
}
|
20
|
+
},
|
21
|
+
inputList:{
|
22
|
+
css:{
|
23
|
+
display:'none'
|
24
|
+
},
|
25
|
+
inputs:{
|
26
|
+
css:{},
|
27
|
+
elements:[]
|
28
|
+
}
|
29
|
+
},
|
30
|
+
labels:["On","Off"],
|
31
|
+
wrapper:{
|
32
|
+
css:{
|
33
|
+
|
34
|
+
}
|
35
|
+
}
|
36
|
+
},
|
37
|
+
events:{
|
38
|
+
create:function(cy){},
|
39
|
+
change:function(cy,event){},
|
40
|
+
destroy:function(cy){}
|
41
|
+
}
|
42
|
+
};
|
43
|
+
|
44
|
+
var methods = {
|
45
|
+
init:function(options,reinit){
|
46
|
+
if (reinit==null) reinit = false;
|
47
|
+
var namelist = [];
|
48
|
+
return this.each(function(){
|
49
|
+
var $this = $(this);
|
50
|
+
if ($.inArray($this.attr('name'),namelist)>-1) return;
|
51
|
+
if ($this.data('cytoRadio')!=null) return console.warn("You cannot reinstatiate $.cytoRadio before calling the destroy method.\nProtip: Use the refresh method to reinstantiate in one move.");
|
52
|
+
|
53
|
+
// Initialize settings
|
54
|
+
var settings = $.extend(true,{},defaults,options);
|
55
|
+
|
56
|
+
// Generate widget
|
57
|
+
settings.widget.inputList.inputs.elements = $('input[name="'+$this.attr('name')+'"]').addClass('cytoRadio');
|
58
|
+
// Data settings for individual radio buttons
|
59
|
+
if (!reinit) settings.widget.inputList.inputs.elements.each(function(i){
|
60
|
+
if ($(this).data('label')!=null) settings.widget.labels[i] = $(this).data('label');
|
61
|
+
});
|
62
|
+
settings.widget.wrapper.element = $this.wrap("<div class='cytoRadio-wrapper'></div>").parent().css(settings.widget.wrapper.css);
|
63
|
+
settings.widget.inputList.element = $('<div />').addClass('cytoRadio-inputList').appendTo(settings.widget.wrapper.element).css(settings.widget.inputList.css);
|
64
|
+
// Move inputs to inputList
|
65
|
+
settings.widget.inputList.inputs.elements.css(settings.widget.inputList.inputs.css).appendTo(settings.widget.inputList.element);
|
66
|
+
settings.widget.buttonList.element = $('<div />').addClass('cytoRadio-buttonList').css(settings.widget.buttonList.css).appendTo(settings.widget.wrapper.element);
|
67
|
+
settings.widget.inputList.inputs.elements.each(function(i){
|
68
|
+
if ($(this).data('label')!=null) settings.widget.labels[i] = $(this).data('label');
|
69
|
+
$(this).attr('data-cytoradio-input',i);
|
70
|
+
var button = $('<button />')
|
71
|
+
.addClass('cytoButton cytoRadio-button')
|
72
|
+
.attr({'data-cytoradio-input':i,'data-cytoradio-value':$(this).val()}).html(settings.widget.labels[i])
|
73
|
+
.css(settings.widget.buttonList.buttons.css)
|
74
|
+
.appendTo(settings.widget.buttonList.element);
|
75
|
+
});
|
76
|
+
settings.widget.buttonList.buttons.elements = settings.widget.buttonList.element.children('.cytoRadio-button');
|
77
|
+
// Round button edges
|
78
|
+
settings.widget.buttonList.buttons.elements.filter(':first-child').css({'border-top-left-radius':settings.widget.buttonList.borderRadius,'border-bottom-left-radius':settings.widget.buttonList.borderRadius});
|
79
|
+
settings.widget.buttonList.buttons.elements.filter(':not(:last-child)').css({'border-right':'none'});
|
80
|
+
settings.widget.buttonList.buttons.elements.filter(':last-child').css({'border-top-right-radius':settings.widget.buttonList.borderRadius,'border-bottom-right-radius':settings.widget.buttonList.borderRadius});
|
81
|
+
|
82
|
+
// Store settings in data-cytoRadio
|
83
|
+
settings.widget.inputList.inputs.elements.data('cytoRadio',settings);
|
84
|
+
|
85
|
+
// Choose active
|
86
|
+
if (settings.widget.inputList.inputs.elements.find(':checked')) methods.value.apply(settings.widget.inputList.inputs.elements,[settings.widget.inputList.inputs.elements.find(':checked').val()]);
|
87
|
+
|
88
|
+
// Bindings
|
89
|
+
settings.widget.inputList.inputs.elements.change($.debounce(100,true,function(e){
|
90
|
+
methods.value.apply(settings.widget.inputList.inputs.elements,[settings.widget.inputList.inputs.elements.filter(':checked').val()])
|
91
|
+
settings.events.change.apply(settings.widget.inputList.inputs.elements,[settings,e]);
|
92
|
+
})).trigger('change');
|
93
|
+
settings.widget.buttonList.buttons.elements.click(function(e){
|
94
|
+
e.preventDefault();
|
95
|
+
if ($(this).hasClass('active')) return false;
|
96
|
+
methods.value.apply($this,[$(this).data('cytoradio-value')]);
|
97
|
+
settings.widget.inputList.inputs.elements.trigger('change');
|
98
|
+
});
|
99
|
+
|
100
|
+
// Fire resize event
|
101
|
+
methods.resize.apply(settings.widget.inputList.inputs.elements);
|
102
|
+
|
103
|
+
settings.events.create.apply(settings.widget.inputList.inputs.elements,[settings]);
|
104
|
+
|
105
|
+
// Add name to namelist
|
106
|
+
namelist.push($this.attr('name'));
|
107
|
+
});
|
108
|
+
},
|
109
|
+
destroy:function(){
|
110
|
+
var namelist = [];
|
111
|
+
return this.each(function(){
|
112
|
+
var $this = $(this);
|
113
|
+
if ($.inArray($this.attr('name'),namelist)>-1) return;
|
114
|
+
var settings = $this.data('cytoRadio');
|
115
|
+
if (!$this.hasClass('cytoRadio') || settings==null) return console.warn("You must instantiate jQuery.cytoRadio before you call the destroy method!");
|
116
|
+
|
117
|
+
// Move inputs back outside wrapper
|
118
|
+
settings.widget.inputList.inputs.elements.insertAfter(settings.widget.wrapper.element).show();
|
119
|
+
// Remove widget
|
120
|
+
settings.widget.wrapper.element.remove();
|
121
|
+
$this.removeClass('cytoRadio').unbind('.cytoRadio').data('cytoRadio',null);
|
122
|
+
namelist.push($this.attr('name'));
|
123
|
+
settings.events.destroy.apply(settings.widget.inputList.inputs.elements,[settings]);
|
124
|
+
});
|
125
|
+
},
|
126
|
+
refresh:function(){
|
127
|
+
var namelist = [];
|
128
|
+
return this.each(function(){
|
129
|
+
var $this = $(this);
|
130
|
+
if ($.inArray($this.attr('name'),namelist)>-1) return;
|
131
|
+
var settings = $this.data('cytoRadio');
|
132
|
+
if (!$this.hasClass('cytoRadio') || settings==null) return console.warn("You must instantiate jQuery.cytoRadio before you call the refresh method!");
|
133
|
+
|
134
|
+
methods.destroy.apply($this);
|
135
|
+
methods.init.apply($this,[settings,true]);
|
136
|
+
$this.trigger('change.cytoRadio');
|
137
|
+
|
138
|
+
namelist.push($this.attr('name'));
|
139
|
+
});
|
140
|
+
},
|
141
|
+
resize:function(){
|
142
|
+
var namelist = [];
|
143
|
+
return this.each(function(){
|
144
|
+
var $this = $(this);
|
145
|
+
if ($.inArray($this.attr('name'),namelist)>-1) return;
|
146
|
+
var settings = $this.data('cytoRadio');
|
147
|
+
if (!$this.hasClass('cytoRadio') || settings==null) return console.warn("You must instantiate jQuery.cytoRadio before you call the resize method!");
|
148
|
+
|
149
|
+
var w = settings.widget.wrapper.element.width(0).css({opacity:0});
|
150
|
+
var bl = settings.widget.buttonList.buttons.elements.width("auto");
|
151
|
+
setTimeout(function(){
|
152
|
+
w.width('100%');
|
153
|
+
bl.each(function(){
|
154
|
+
$(this).width(Math.ceil(settings.widget.buttonList.element.innerWidth()/bl.length) - 2);
|
155
|
+
});
|
156
|
+
w.css({opacity:1});
|
157
|
+
},1);
|
158
|
+
});
|
159
|
+
},
|
160
|
+
value:function(set){
|
161
|
+
var namelist = [];
|
162
|
+
if (set==null || set==undefined) set = false;
|
163
|
+
var value;
|
164
|
+
this.each(function(){
|
165
|
+
var $this = $(this);
|
166
|
+
if ($.inArray($this.attr('name'),namelist)>-1) return;
|
167
|
+
var settings = $this.data('cytoRadio');
|
168
|
+
if (!$this.hasClass('cytoRadio') || settings==null) return console.warn("You must instantiate jQuery.cytoRadio before you call the value method!");
|
169
|
+
|
170
|
+
if (set===false) value = settings.widget.inputList.inputs.elements.filter(':checked').val();
|
171
|
+
else {
|
172
|
+
settings.widget.inputList.inputs.elements.filter('[value="'+set+'"]').prop("checked",true);
|
173
|
+
settings.widget.buttonList.element.find('.active').removeClass('active').end().find('[data-cytoradio-value="'+set+'"]').addClass('active');
|
174
|
+
}
|
175
|
+
|
176
|
+
namelist.push($this.attr('name'));
|
177
|
+
});
|
178
|
+
return (value!=null) ? value : this;
|
179
|
+
},
|
180
|
+
options:function(newOptions){
|
181
|
+
if (newOptions!=null) {
|
182
|
+
return this.each(function(){
|
183
|
+
var $this = $(this);
|
184
|
+
var settings = $this.data('cytoRadio');
|
185
|
+
if (!$this.hasClass("cytoRadio") || settings==null) return console.warn("You must instanciate $.cytoRadio before you call the options method!");
|
186
|
+
$this.data('cytoRadio',$.extend(true,{},settings,newOptions));
|
187
|
+
methods.refresh.apply($this);
|
188
|
+
});
|
189
|
+
} else {
|
190
|
+
var returnVal;
|
191
|
+
this.each(function(){
|
192
|
+
var $this = $(this);
|
193
|
+
var settings = $this.data('cytoRadio');
|
194
|
+
if (!$this.hasClass("cytoRadio") || settings==null) return console.warn("You must instanciate $.cytoRadio before you call the options method!");
|
195
|
+
returnVal = settings;
|
196
|
+
});
|
197
|
+
return returnVal;
|
198
|
+
}
|
199
|
+
}
|
200
|
+
};
|
201
|
+
|
202
|
+
$.fn.cytoRadio = function(method){
|
203
|
+
if (methods[method]) return methods[method].apply(this,Array.prototype.slice.call(arguments,1));
|
204
|
+
else if (typeof method == 'object' || !method) return methods.init.apply(this,arguments);
|
205
|
+
else $.error('Method ' + method + ' does not exist on $.cytoRadio!');
|
206
|
+
};
|
207
|
+
|
208
|
+
$(window).resize(function(){$('.cytoRadio').cytoRadio("resize");});
|
209
|
+
$.Cytoplasm("ready",function(){$('.cytoRadio').cytoRadio();});
|
210
|
+
})(jQuery);
|