assets
BIN
app/assets/images/front/a-venir.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
app/assets/images/front/cadre-gris.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
app/assets/images/front/en-cours.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
app/assets/images/front/en-savoir-plus-gris.png
Normal file
After Width: | Height: | Size: 991 B |
BIN
app/assets/images/front/en-savoir-plus-marron.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
app/assets/images/front/en-tete-gris.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
app/assets/images/front/fleche-droite.png
Normal file
After Width: | Height: | Size: 423 B |
BIN
app/assets/images/front/fleche-gauche.png
Normal file
After Width: | Height: | Size: 384 B |
BIN
app/assets/images/front/fond-marron.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/assets/images/front/fond-vert.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
app/assets/images/front/logo.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
app/assets/images/rails.png
Normal file
After Width: | Height: | Size: 6.5 KiB |
@ -1,3 +1,16 @@
|
|||||||
|
//= require jquery
|
||||||
|
//= require jquery-ui.min
|
||||||
|
//= require jquery_ujs
|
||||||
|
//=require jquery.reject.min
|
||||||
|
//=require tiny_mce/jquery.tinymce
|
||||||
|
//= require jquery.fileupload-ui
|
||||||
|
//=require jquery.activity-indicator-1.0.0.min
|
||||||
|
//=require jquery.fileupload
|
||||||
|
//= require_tree .
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function auto_load_divs() {
|
function auto_load_divs() {
|
||||||
$('div[data-load]').live("resize",function () {
|
$('div[data-load]').live("resize",function () {
|
||||||
|
|
||||||
@ -117,8 +130,8 @@ function auto_tiny_mce(div)
|
|||||||
div.css("height", "400px");
|
div.css("height", "400px");
|
||||||
div.tinymce({
|
div.tinymce({
|
||||||
// Location of TinyMCE script
|
// Location of TinyMCE script
|
||||||
script_url : '/assets/javascripts/core/tiny_mce/tiny_mce.js',
|
script_url : '/assets/tiny_mce/tiny_mce.js',
|
||||||
content_css : "/assets/stylesheets/admin/admin.css",
|
content_css : "/assets/admin/admin.css",
|
||||||
// General options
|
// General options
|
||||||
theme : "advanced",
|
theme : "advanced",
|
||||||
skin: "cirkuit",
|
skin: "cirkuit",
|
||||||
@ -151,6 +164,15 @@ function set_prescriptions_big_container_size(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function set_busy(){
|
||||||
|
$('body').append('<div id="busy"></div>');
|
||||||
|
$('#busy').activity({segments: 8, steps: 5, opacity: 0.5, width: 10, space: 0, length: 10, color: '#212222', speed: 1.5});
|
||||||
|
}
|
||||||
|
function unset_busy(){
|
||||||
|
$('#busy').remove();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|
0
app/assets/javascripts/admin/editor.js
Normal file
@ -25,6 +25,7 @@ function manager_show(url){
|
|||||||
image_files_load();
|
image_files_load();
|
||||||
data_files_load();
|
data_files_load();
|
||||||
initialize_uploads();
|
initialize_uploads();
|
||||||
|
unset_busy();
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -82,6 +83,7 @@ function manager_send_response(send_value){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function select_image_from_manager(input_id){
|
function select_image_from_manager(input_id){
|
||||||
|
set_busy();
|
||||||
manager_prompt("/admin/image_files/?manager=true",function(m_return){
|
manager_prompt("/admin/image_files/?manager=true",function(m_return){
|
||||||
|
|
||||||
$('#input_'+input_id).val(m_return.image_file_id);
|
$('#input_'+input_id).val(m_return.image_file_id);
|
@ -34,7 +34,7 @@ function initialize_uploads()
|
|||||||
return $('<tr><td>' + files[index].name + '<\/td>' +
|
return $('<tr><td>' + files[index].name + '<\/td>' +
|
||||||
'<td class="file_upload_progress"><div><\/div><\/td>' +
|
'<td class="file_upload_progress"><div><\/div><\/td>' +
|
||||||
'<td class="file_upload_cancel">' +
|
'<td class="file_upload_cancel">' +
|
||||||
'<img alt="Pen_alt_stroke_16x16" src="/iconic/gray_light/denied_16x16.png" />' +
|
'<img alt="Pen_alt_stroke_16x16" src="/assets/iconic/gray_light/denied_16x16.png" />' +
|
||||||
|
|
||||||
'<\/td><\/tr>');
|
'<\/td><\/tr>');
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ function initialize_uploads()
|
|||||||
return $('<tr><td>' + files[index].name + '<\/td>' +
|
return $('<tr><td>' + files[index].name + '<\/td>' +
|
||||||
'<td class="file_upload_progress"><div><\/div><\/td>' +
|
'<td class="file_upload_progress"><div><\/div><\/td>' +
|
||||||
'<td class="file_upload_cancel">' +
|
'<td class="file_upload_cancel">' +
|
||||||
'<img alt="Pen_alt_stroke_16x16" src="/iconic/gray_light/denied_16x16.png" />' +
|
'<img alt="Pen_alt_stroke_16x16" src="/assets/iconic/gray_light/denied_16x16.png" />' +
|
||||||
|
|
||||||
'<\/td><\/tr>');
|
'<\/td><\/tr>');
|
||||||
}
|
}
|
@ -27,8 +27,7 @@ function after_load_document(){
|
|||||||
tolerance : "pointer",
|
tolerance : "pointer",
|
||||||
drop: function( event, ui ) {
|
drop: function( event, ui ) {
|
||||||
ui.draggable.fadeOut();
|
ui.draggable.fadeOut();
|
||||||
load_img = "<center><img src='/quartz_admin/icons/load.gif' /></center>";
|
set_busy();
|
||||||
$('#sortable_menu_item').html(load_img);
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url:"/admin/menu_items/"+ui.draggable.attr("data-menu_item_id")+".js",
|
url:"/admin/menu_items/"+ui.draggable.attr("data-menu_item_id")+".js",
|
||||||
type: "PUT",
|
type: "PUT",
|
||||||
@ -52,9 +51,8 @@ function after_load_document(){
|
|||||||
tolerance : "pointer",
|
tolerance : "pointer",
|
||||||
drop: function( event, ui ) {
|
drop: function( event, ui ) {
|
||||||
ui.draggable.fadeOut();
|
ui.draggable.fadeOut();
|
||||||
|
set_busy();
|
||||||
|
|
||||||
load_img = "<center><img src='/quartz_admin/icons/load.gif' /></center>";
|
|
||||||
$('#sortable_menu_item').html(load_img);
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url:"/admin/menu_items/"+ui.draggable.attr("data-menu_item_id")+".js",
|
url:"/admin/menu_items/"+ui.draggable.attr("data-menu_item_id")+".js",
|
||||||
type: "PUT",
|
type: "PUT",
|
9
app/assets/javascripts/application.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
// This is a manifest file that'll be compiled into including all the files listed below.
|
||||||
|
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
||||||
|
// be included in the compiled file accessible from http://example.com/assets/application.js
|
||||||
|
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
||||||
|
// the compiled file.
|
||||||
|
//
|
||||||
|
//= require jquery
|
||||||
|
//= require jquery_ujs
|
||||||
|
//= require_tree .
|
@ -3,6 +3,9 @@
|
|||||||
*= require formtastic
|
*= require formtastic
|
||||||
|
|
||||||
*= require_tree .
|
*= require_tree .
|
||||||
|
//= require_tree ./../qi
|
||||||
|
=require jquery.fileupload-ui
|
||||||
|
=require ui-lightness/jquery-ui-1.8.11.custom
|
||||||
*= require_self
|
*= require_self
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -10,6 +13,17 @@
|
|||||||
@import "../mixins/css3";
|
@import "../mixins/css3";
|
||||||
|
|
||||||
|
|
||||||
|
#busy{
|
||||||
|
|
||||||
|
position:absolute;
|
||||||
|
z-index:9000;
|
||||||
|
top:0px;
|
||||||
|
bottom:0px;
|
||||||
|
right:0px;
|
||||||
|
left:0px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
body {
|
body {
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
7
app/assets/stylesheets/application.css
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
/*
|
||||||
|
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
||||||
|
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
||||||
|
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
||||||
|
*= require_self
|
||||||
|
*= require_tree .
|
||||||
|
*/
|
@ -1,158 +0,0 @@
|
|||||||
/**
|
|
||||||
* Unobtrusive scripting adapter for jQuery
|
|
||||||
*
|
|
||||||
* Requires jQuery 1.4.3 or later.
|
|
||||||
* https://github.com/rails/jquery-ujs
|
|
||||||
*/
|
|
||||||
|
|
||||||
(function($) {
|
|
||||||
// Make sure that every Ajax request sends the CSRF token
|
|
||||||
function CSRFProtection(xhr) {
|
|
||||||
var token = $('meta[name="csrf-token"]').attr('content');
|
|
||||||
if (token) xhr.setRequestHeader('X-CSRF-Token', token);
|
|
||||||
}
|
|
||||||
if ('ajaxPrefilter' in $) $.ajaxPrefilter(function(options, originalOptions, xhr){ CSRFProtection(xhr) });
|
|
||||||
else $(document).ajaxSend(function(e, xhr){ CSRFProtection(xhr) });
|
|
||||||
|
|
||||||
// Triggers an event on an element and returns the event result
|
|
||||||
function fire(obj, name, data) {
|
|
||||||
var event = $.Event(name);
|
|
||||||
obj.trigger(event, data);
|
|
||||||
return event.result !== false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Submits "remote" forms and links with ajax
|
|
||||||
function handleRemote(element) {
|
|
||||||
var method, url, data,
|
|
||||||
dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType);
|
|
||||||
|
|
||||||
if (fire(element, 'ajax:before')) {
|
|
||||||
if (element.is('form')) {
|
|
||||||
method = element.attr('method');
|
|
||||||
url = element.attr('action');
|
|
||||||
data = element.serializeArray();
|
|
||||||
// memoized value from clicked submit button
|
|
||||||
var button = element.data('ujs:submit-button');
|
|
||||||
if (button) {
|
|
||||||
data.push(button);
|
|
||||||
element.data('ujs:submit-button', null);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
method = element.data('method');
|
|
||||||
url = element.attr('href');
|
|
||||||
data = null;
|
|
||||||
}
|
|
||||||
$.ajax({
|
|
||||||
url: url, type: method || 'GET', data: data, dataType: dataType,
|
|
||||||
// stopping the "ajax:beforeSend" event will cancel the ajax request
|
|
||||||
beforeSend: function(xhr, settings) {
|
|
||||||
if (settings.dataType === undefined) {
|
|
||||||
xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);
|
|
||||||
}
|
|
||||||
return fire(element, 'ajax:beforeSend', [xhr, settings]);
|
|
||||||
},
|
|
||||||
success: function(data, status, xhr) {
|
|
||||||
element.trigger('ajax:success', [data, status, xhr]);
|
|
||||||
},
|
|
||||||
complete: function(xhr, status) {
|
|
||||||
element.trigger('ajax:complete', [xhr, status]);
|
|
||||||
},
|
|
||||||
error: function(xhr, status, error) {
|
|
||||||
element.trigger('ajax:error', [xhr, status, error]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handles "data-method" on links such as:
|
|
||||||
// <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>
|
|
||||||
function handleMethod(link) {
|
|
||||||
var href = link.attr('href'),
|
|
||||||
method = link.data('method'),
|
|
||||||
csrf_token = $('meta[name=csrf-token]').attr('content'),
|
|
||||||
csrf_param = $('meta[name=csrf-param]').attr('content'),
|
|
||||||
form = $('<form method="post" action="' + href + '"></form>'),
|
|
||||||
metadata_input = '<input name="_method" value="' + method + '" type="hidden" />';
|
|
||||||
|
|
||||||
if (csrf_param !== undefined && csrf_token !== undefined) {
|
|
||||||
metadata_input += '<input name="' + csrf_param + '" value="' + csrf_token + '" type="hidden" />';
|
|
||||||
}
|
|
||||||
|
|
||||||
form.hide().append(metadata_input).appendTo('body');
|
|
||||||
form.submit();
|
|
||||||
}
|
|
||||||
|
|
||||||
function disableFormElements(form) {
|
|
||||||
form.find('input[data-disable-with]').each(function() {
|
|
||||||
var input = $(this);
|
|
||||||
input.data('ujs:enable-with', input.val())
|
|
||||||
.val(input.data('disable-with'))
|
|
||||||
.attr('disabled', 'disabled');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function enableFormElements(form) {
|
|
||||||
form.find('input[data-disable-with]').each(function() {
|
|
||||||
var input = $(this);
|
|
||||||
input.val(input.data('ujs:enable-with')).removeAttr('disabled');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function allowAction(element) {
|
|
||||||
var message = element.data('confirm');
|
|
||||||
return !message || (fire(element, 'confirm') && confirm(message));
|
|
||||||
}
|
|
||||||
|
|
||||||
function requiredValuesMissing(form) {
|
|
||||||
var missing = false;
|
|
||||||
form.find('input[name][required]').each(function() {
|
|
||||||
if (!$(this).val()) missing = true;
|
|
||||||
});
|
|
||||||
return missing;
|
|
||||||
}
|
|
||||||
|
|
||||||
$('a[data-confirm], a[data-method], a[data-remote]').live('click.rails', function(e) {
|
|
||||||
var link = $(this);
|
|
||||||
if (!allowAction(link)) return false;
|
|
||||||
|
|
||||||
if (link.data('remote') != undefined) {
|
|
||||||
handleRemote(link);
|
|
||||||
return false;
|
|
||||||
} else if (link.data('method')) {
|
|
||||||
handleMethod(link);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('form').live('submit.rails', function(e) {
|
|
||||||
var form = $(this), remote = form.data('remote') != undefined;
|
|
||||||
if (!allowAction(form)) return false;
|
|
||||||
|
|
||||||
// skip other logic when required values are missing
|
|
||||||
if (requiredValuesMissing(form)) return !remote;
|
|
||||||
|
|
||||||
if (remote) {
|
|
||||||
handleRemote(form);
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
// slight timeout so that the submit button gets properly serialized
|
|
||||||
setTimeout(function(){ disableFormElements(form) }, 13);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('form input[type=submit], form button[type=submit], form button:not([type])').live('click.rails', function() {
|
|
||||||
var button = $(this);
|
|
||||||
if (!allowAction(button)) return false;
|
|
||||||
// register the pressed submit button
|
|
||||||
var name = button.attr('name'), data = name ? {name:name, value:button.val()} : null;
|
|
||||||
button.closest('form').data('ujs:submit-button', data);
|
|
||||||
});
|
|
||||||
|
|
||||||
$('form').live('ajax:beforeSend.rails', function(event) {
|
|
||||||
if (this == event.target) disableFormElements($(this));
|
|
||||||
});
|
|
||||||
|
|
||||||
$('form').live('ajax:complete.rails', function(event) {
|
|
||||||
if (this == event.target) enableFormElements($(this));
|
|
||||||
});
|
|
||||||
})( jQuery );
|
|
BIN
vendor/assets/images/content_type/type_BlockContent.png
vendored
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
vendor/assets/images/content_type/type_BreakContent.png
vendored
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
vendor/assets/images/content_type/type_DownloadContent.png
vendored
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
vendor/assets/images/content_type/type_DynamicContent.png
vendored
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
vendor/assets/images/content_type/type_GalleryContent.png
vendored
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
vendor/assets/images/content_type/type_HtmlContent.png
vendored
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
vendor/assets/images/content_type/type_ImageContent.png
vendored
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
vendor/assets/images/content_type/type_ImgLinkContent.png
vendored
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
vendor/assets/images/content_type/type_LinkContent.png
vendored
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
vendor/assets/images/content_type/type_MapContent.png
vendored
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
vendor/assets/images/content_type/type_TableContent.png
vendored
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
vendor/assets/images/content_type/type_TextContent.png
vendored
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
vendor/assets/images/content_type/type_TitleContent.png
vendored
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
vendor/assets/images/dashboard/Protected.png
vendored
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
vendor/assets/images/dashboard/Reader.png
vendored
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
vendor/assets/images/dashboard/blog_compose.png
vendored
Normal file
After Width: | Height: | Size: 8.8 KiB |
BIN
vendor/assets/images/dashboard/folder_black_bookmarks.png
vendored
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
vendor/assets/images/dashboard/folder_black_documents.png
vendored
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
vendor/assets/images/dashboard/folders.png
vendored
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
vendor/assets/images/dashboard/home.png
vendored
Normal file
After Width: | Height: | Size: 6.9 KiB |
BIN
vendor/assets/images/dashboard/homes.png
vendored
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
vendor/assets/images/dashboard/icones_admins.png
vendored
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
vendor/assets/images/dashboard/icones_data_files.png
vendored
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
vendor/assets/images/dashboard/icones_folders.png
vendored
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
vendor/assets/images/dashboard/icones_homes.png
vendored
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
vendor/assets/images/dashboard/icones_image_files.png
vendored
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
vendor/assets/images/dashboard/icones_menu_items.png
vendored
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
vendor/assets/images/dashboard/icones_prescriptions.png
vendored
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
vendor/assets/images/dashboard/icones_promotions.png
vendored
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
vendor/assets/images/dashboard/image_files.png
vendored
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
vendor/assets/images/dashboard/susers.png
vendored
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
vendor/assets/images/dashboard/users.png
vendored
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
vendor/assets/images/iconic/gray_light/rotate_12x14.png
vendored
Normal file
After Width: | Height: | Size: 342 B |
BIN
vendor/assets/images/iconic/gray_light/rotate_right_12x14.png
vendored
Normal file
After Width: | Height: | Size: 347 B |
Before Width: | Height: | Size: 260 B After Width: | Height: | Size: 260 B |
Before Width: | Height: | Size: 251 B After Width: | Height: | Size: 251 B |
Before Width: | Height: | Size: 178 B After Width: | Height: | Size: 178 B |
Before Width: | Height: | Size: 104 B After Width: | Height: | Size: 104 B |
Before Width: | Height: | Size: 125 B After Width: | Height: | Size: 125 B |
Before Width: | Height: | Size: 105 B After Width: | Height: | Size: 105 B |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 90 B After Width: | Height: | Size: 90 B |
Before Width: | Height: | Size: 129 B After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
10
vendor/assets/javascripts/jquery.activity-indicator-1.0.0.min.js
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
/*
|
||||||
|
* NETEYE Activity Indicator jQuery Plugin
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010 NETEYE GmbH
|
||||||
|
* Licensed under the MIT license
|
||||||
|
*
|
||||||
|
* Author: Felix Gnass [fgnass at neteye dot de]
|
||||||
|
* Version: 1.0.0
|
||||||
|
*/
|
||||||
|
(function($){$.fn.activity=function(opts){this.each(function(){var $this=$(this);var el=$this.data("activity");if(el){clearInterval(el.data("interval"));el.remove();$this.removeData("activity");}if(opts!==false){opts=$.extend({color:$this.css("color")},$.fn.activity.defaults,opts);el=render($this,opts).css("position","absolute").prependTo(opts.outside?"body":$this);var h=$this.outerHeight()-el.height();var w=$this.outerWidth()-el.width();var margin={top:opts.valign=="top"?opts.padding:opts.valign=="bottom"?h-opts.padding:Math.floor(h/2),left:opts.align=="left"?opts.padding:opts.align=="right"?w-opts.padding:Math.floor(w/2)};var offset=$this.offset();if(opts.outside){el.css({top:offset.top+"px",left:offset.left+"px"});}else{margin.top-=el.offset().top-offset.top;margin.left-=el.offset().left-offset.left;}el.css({marginTop:margin.top+"px",marginLeft:margin.left+"px"});animate(el,opts.segments,Math.round(10/opts.speed)/10);$this.data("activity",el);}});return this;};$.fn.activity.defaults={segments:12,space:3,length:7,width:4,speed:1.2,align:"center",valign:"center",padding:4};$.fn.activity.getOpacity=function(opts,i){var steps=opts.steps||opts.segments-1;var end=opts.opacity!==undefined?opts.opacity:1/steps;return 1-Math.min(i,steps)*(1-end)/steps;};var render=function(){return $("<div>").addClass("busy");};var animate=function(){};function svg(tag,attr){var el=document.createElementNS("http://www.w3.org/2000/svg",tag||"svg");if(attr){$.each(attr,function(k,v){el.setAttributeNS(null,k,v);});}return $(el);}if(document.createElementNS&&document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect){render=function(target,d){var innerRadius=d.width*2+d.space;var r=(innerRadius+d.length+Math.ceil(d.width/2)+1);var el=svg().width(r*2).height(r*2);var g=svg("g",{"stroke-width":d.width,"stroke-linecap":"round",stroke:d.color}).appendTo(svg("g",{transform:"translate("+r+","+r+")"}).appendTo(el));for(var i=0;i<d.segments;i++){g.append(svg("line",{x1:0,y1:innerRadius,x2:0,y2:innerRadius+d.length,transform:"rotate("+(360/d.segments*i)+", 0, 0)",opacity:$.fn.activity.getOpacity(d,i)}));}return $("<div>").append(el).width(2*r).height(2*r);};if(document.createElement("div").style.WebkitAnimationName!==undefined){var animations={};animate=function(el,steps,duration){if(!animations[steps]){var name="spin"+steps;var rule="@-webkit-keyframes "+name+" {";for(var i=0;i<steps;i++){var p1=Math.round(100000/steps*i)/1000;var p2=Math.round(100000/steps*(i+1)-1)/1000;var value="% { -webkit-transform:rotate("+Math.round(360/steps*i)+"deg); }\n";rule+=p1+value+p2+value;}rule+="100% { -webkit-transform:rotate(100deg); }\n}";document.styleSheets[0].insertRule(rule);animations[steps]=name;}el.css("-webkit-animation",animations[steps]+" "+duration+"s linear infinite");};}else{animate=function(el,steps,duration){var rotation=0;var g=el.find("g g").get(0);el.data("interval",setInterval(function(){g.setAttributeNS(null,"transform","rotate("+(++rotation%steps*(360/steps))+")");},duration*1000/steps));};}}else{var s=$("<shape>").css("behavior","url(#default#VML)").appendTo("body");if(s.get(0).adj){var sheet=document.createStyleSheet();$.each(["group","shape","stroke"],function(){sheet.addRule(this,"behavior:url(#default#VML);");});render=function(target,d){var innerRadius=d.width*2+d.space;var r=(innerRadius+d.length+Math.ceil(d.width/2)+1);var s=r*2;var o=-Math.ceil(s/2);var el=$("<group>",{coordsize:s+" "+s,coordorigin:o+" "+o}).css({top:o,left:o,width:s,height:s});for(var i=0;i<d.segments;i++){el.append($("<shape>",{path:"m "+innerRadius+",0 l "+(innerRadius+d.length)+",0"}).css({width:s,height:s,rotation:(360/d.segments*i)+"deg"}).append($("<stroke>",{color:d.color,weight:d.width+"px",endcap:"round",opacity:$.fn.activity.getOpacity(d,i)})));}return $("<group>",{coordsize:s+" "+s}).css({width:s,height:s,overflow:"hidden"}).append(el);};animate=function(el,steps,duration){var rotation=0;var g=el.get(0);el.data("interval",setInterval(function(){g.style.rotation=++rotation%steps*(360/steps);},duration*1000/steps));};}$(s).remove();}})(jQuery);
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |