2012-03-07 11:30:20 -05:00
|
|
|
/*
|
|
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
|
|
this work for additional information regarding copyright ownership.
|
|
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
(the "License"); you may not use this file except in compliance with
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2012-02-23 14:23:10 -05:00
|
|
|
sammy.bind
|
|
|
|
(
|
2012-03-07 11:30:20 -05:00
|
|
|
'cores_load_data',
|
|
|
|
function( event, params )
|
|
|
|
{
|
|
|
|
if( app.cores_data )
|
2012-02-23 14:23:10 -05:00
|
|
|
{
|
2012-03-07 11:30:20 -05:00
|
|
|
params.callback( app.cores_data );
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
$.ajax
|
|
|
|
(
|
|
|
|
{
|
|
|
|
url : app.config.solr_path + app.config.core_admin_path + '?wt=json',
|
|
|
|
dataType : 'json',
|
|
|
|
beforeSend : function( xhr, settings )
|
|
|
|
{
|
|
|
|
},
|
|
|
|
success : function( response, text_status, xhr )
|
|
|
|
{
|
|
|
|
app.cores_data = response.status;
|
|
|
|
params.callback( app.cores_data );
|
|
|
|
},
|
|
|
|
error : function( xhr, text_status, error_thrown)
|
|
|
|
{
|
|
|
|
},
|
|
|
|
complete : function( xhr, text_status )
|
2012-02-23 14:23:10 -05:00
|
|
|
{
|
|
|
|
}
|
2012-03-07 11:30:20 -05:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
2012-02-23 14:23:10 -05:00
|
|
|
);
|
|
|
|
|
|
|
|
sammy.bind
|
|
|
|
(
|
2012-03-07 11:30:20 -05:00
|
|
|
'cores_build_navigation',
|
|
|
|
function( event, params )
|
|
|
|
{
|
|
|
|
var navigation_content = ['<ul>'];
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
for( var core in params.cores )
|
|
|
|
{
|
2012-03-21 05:36:59 -04:00
|
|
|
var core_name = core;
|
|
|
|
if( !core_name )
|
|
|
|
{
|
|
|
|
core_name = '<em>(empty)</em>';
|
|
|
|
}
|
|
|
|
navigation_content.push( '<li><a href="' + params.basepath + core + '">' + core_name + '</a></li>' );
|
2012-03-07 11:30:20 -05:00
|
|
|
}
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
params.navigation_element
|
|
|
|
.html( navigation_content.join( "\n" ) );
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
$( 'a[href="' + params.basepath + params.current_core + '"]', params.navigation_element ).parent()
|
|
|
|
.addClass( 'current' );
|
|
|
|
}
|
2012-02-23 14:23:10 -05:00
|
|
|
);
|
|
|
|
|
|
|
|
sammy.bind
|
|
|
|
(
|
2012-03-07 11:30:20 -05:00
|
|
|
'cores_load_template',
|
|
|
|
function( event, params )
|
|
|
|
{
|
|
|
|
if( app.cores_template )
|
2012-02-23 14:23:10 -05:00
|
|
|
{
|
2012-03-07 11:30:20 -05:00
|
|
|
params.callback();
|
|
|
|
return true;
|
|
|
|
}
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
$.get
|
|
|
|
(
|
|
|
|
'tpl/cores.html',
|
|
|
|
function( template )
|
|
|
|
{
|
|
|
|
params.content_element
|
|
|
|
.html( template );
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
app.cores_template = template;
|
|
|
|
params.callback();
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
2012-02-23 14:23:10 -05:00
|
|
|
);
|
|
|
|
|
2012-03-21 05:36:59 -04:00
|
|
|
// #/~cores
|
2012-02-23 14:23:10 -05:00
|
|
|
sammy.get
|
|
|
|
(
|
2012-03-21 05:36:59 -04:00
|
|
|
/^#\/~(cores)$/,
|
2012-03-07 11:30:20 -05:00
|
|
|
function( context )
|
|
|
|
{
|
|
|
|
delete app.cores_template;
|
|
|
|
|
|
|
|
sammy.trigger
|
|
|
|
(
|
|
|
|
'cores_load_data',
|
|
|
|
{
|
|
|
|
callback : function( cores )
|
|
|
|
{
|
|
|
|
var first_core = null;
|
|
|
|
for( var key in cores )
|
|
|
|
{
|
|
|
|
if( !first_core )
|
2012-02-23 14:23:10 -05:00
|
|
|
{
|
2012-03-07 11:30:20 -05:00
|
|
|
first_core = key;
|
2012-02-23 14:23:10 -05:00
|
|
|
}
|
2012-03-07 11:30:20 -05:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
context.redirect( context.path + '/' + first_core );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
2012-02-23 14:23:10 -05:00
|
|
|
);
|
|
|
|
|
2012-03-21 05:36:59 -04:00
|
|
|
// #/~cores
|
2012-02-23 14:23:10 -05:00
|
|
|
sammy.get
|
|
|
|
(
|
2012-03-21 05:36:59 -04:00
|
|
|
/^#\/~(cores)\//,
|
2012-03-07 11:30:20 -05:00
|
|
|
function( context )
|
|
|
|
{
|
|
|
|
var content_element = $( '#content' );
|
|
|
|
|
2012-03-21 05:36:59 -04:00
|
|
|
var path_parts = this.path.match( /^(.+\/~cores\/)(.*)$/ );
|
2012-03-07 11:30:20 -05:00
|
|
|
var current_core = path_parts[2];
|
|
|
|
|
|
|
|
sammy.trigger
|
|
|
|
(
|
|
|
|
'cores_load_data',
|
|
|
|
{
|
|
|
|
callback : function( cores )
|
|
|
|
{
|
|
|
|
sammy.trigger
|
|
|
|
(
|
|
|
|
'cores_load_template',
|
2012-02-23 14:23:10 -05:00
|
|
|
{
|
2012-03-07 11:30:20 -05:00
|
|
|
content_element : content_element,
|
|
|
|
callback : function()
|
|
|
|
{
|
|
|
|
var cores_element = $( '#cores', content_element );
|
|
|
|
var navigation_element = $( '#navigation', cores_element );
|
|
|
|
var data_element = $( '#data', cores_element );
|
|
|
|
var core_data_element = $( '#core-data', data_element );
|
|
|
|
var index_data_element = $( '#index-data', data_element );
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
sammy.trigger
|
|
|
|
(
|
|
|
|
'cores_build_navigation',
|
|
|
|
{
|
|
|
|
cores : cores,
|
|
|
|
basepath : path_parts[1],
|
|
|
|
current_core : current_core,
|
2012-04-27 03:18:53 -04:00
|
|
|
navigation_element : navigation_element
|
2012-03-07 11:30:20 -05:00
|
|
|
}
|
|
|
|
);
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
var core_data = cores[current_core];
|
|
|
|
var core_basepath = $( '#' + current_core, app.menu_element ).attr( 'data-basepath' );
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
// core-data
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
$( '.startTime dd', core_data_element )
|
|
|
|
.html( core_data.startTime );
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
$( '.instanceDir dd', core_data_element )
|
|
|
|
.html( core_data.instanceDir );
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
$( '.dataDir dd', core_data_element )
|
|
|
|
.html( core_data.dataDir );
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
// index-data
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
$( '.lastModified dd', index_data_element )
|
|
|
|
.html( core_data.index.lastModified );
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
$( '.version dd', index_data_element )
|
|
|
|
.html( core_data.index.version );
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
$( '.numDocs dd', index_data_element )
|
|
|
|
.html( core_data.index.numDocs );
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
$( '.maxDoc dd', index_data_element )
|
|
|
|
.html( core_data.index.maxDoc );
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
$( '.optimized dd', index_data_element )
|
|
|
|
.addClass( core_data.index.optimized ? 'ico-1' : 'ico-0' );
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-04-27 03:18:53 -04:00
|
|
|
$( '#actions #optimize', cores_element )
|
2012-03-07 11:30:20 -05:00
|
|
|
.show();
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
$( '.optimized dd span', index_data_element )
|
|
|
|
.html( core_data.index.optimized ? 'yes' : 'no' );
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
$( '.current dd', index_data_element )
|
|
|
|
.addClass( core_data.index.current ? 'ico-1' : 'ico-0' );
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
$( '.current dd span', index_data_element )
|
|
|
|
.html( core_data.index.current ? 'yes' : 'no' );
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
$( '.hasDeletions dd', index_data_element )
|
|
|
|
.addClass( core_data.index.hasDeletions ? 'ico-1' : 'ico-0' );
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
$( '.hasDeletions dd span', index_data_element )
|
|
|
|
.html( core_data.index.hasDeletions ? 'yes' : 'no' );
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
$( '.directory dd', index_data_element )
|
|
|
|
.html
|
|
|
|
(
|
|
|
|
core_data.index.directory
|
|
|
|
.replace( /:/g, ':​' )
|
|
|
|
.replace( /@/g, '@​' )
|
|
|
|
);
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
var core_names = [];
|
|
|
|
var core_selects = $( '#actions select', cores_element );
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
for( var key in cores )
|
|
|
|
{
|
|
|
|
core_names.push( '<option value="' + key + '">' + key + '</option>' )
|
|
|
|
}
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
core_selects
|
|
|
|
.html( core_names.join( "\n") );
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
$( 'option[value="' + current_core + '"]', core_selects.filter( '.other' ) )
|
2012-04-27 03:18:53 -04:00
|
|
|
.remove();
|
|
|
|
|
|
|
|
$( 'input[data-core="current"]', cores_element )
|
2012-03-07 11:30:20 -05:00
|
|
|
.val( current_core );
|
|
|
|
|
|
|
|
// layout
|
|
|
|
|
2012-04-27 03:18:53 -04:00
|
|
|
var ui_block = $( '#ui-block' );
|
2012-03-07 11:30:20 -05:00
|
|
|
var actions_element = $( '.actions', cores_element );
|
2012-04-27 03:18:53 -04:00
|
|
|
var div_action = $( 'div.action', actions_element );
|
|
|
|
|
|
|
|
ui_block
|
|
|
|
.css( 'opacity', 0.7 )
|
|
|
|
.width( cores_element.width() + 10 )
|
|
|
|
.height( cores_element.height() );
|
2012-03-07 11:30:20 -05:00
|
|
|
|
2012-04-27 03:23:06 -04:00
|
|
|
if( $( '#cloud.global' ).is( ':visible' ) )
|
|
|
|
{
|
|
|
|
$( '.cloud', div_action )
|
|
|
|
.show();
|
|
|
|
}
|
|
|
|
|
2012-04-27 03:18:53 -04:00
|
|
|
$( 'button.action', actions_element )
|
|
|
|
.die( 'click' )
|
2012-03-07 11:30:20 -05:00
|
|
|
.live
|
|
|
|
(
|
2012-04-27 03:18:53 -04:00
|
|
|
'click',
|
2012-03-07 11:30:20 -05:00
|
|
|
function( event )
|
|
|
|
{
|
2012-04-27 03:18:53 -04:00
|
|
|
var self = $( this );
|
|
|
|
|
|
|
|
self
|
|
|
|
.toggleClass( 'open' );
|
|
|
|
|
|
|
|
$( '.action.' + self.attr( 'id' ), actions_element )
|
|
|
|
.trigger( 'open' );
|
|
|
|
|
|
|
|
return false;
|
2012-03-07 11:30:20 -05:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2012-04-27 03:18:53 -04:00
|
|
|
div_action
|
|
|
|
.die( 'close' )
|
2012-03-07 11:30:20 -05:00
|
|
|
.live
|
|
|
|
(
|
2012-04-27 03:18:53 -04:00
|
|
|
'close',
|
2012-03-07 11:30:20 -05:00
|
|
|
function( event )
|
|
|
|
{
|
2012-04-27 03:18:53 -04:00
|
|
|
div_action.hide();
|
|
|
|
ui_block.hide();
|
2012-03-07 11:30:20 -05:00
|
|
|
}
|
2012-04-27 03:18:53 -04:00
|
|
|
)
|
|
|
|
.die( 'open' )
|
2012-03-07 11:30:20 -05:00
|
|
|
.live
|
|
|
|
(
|
2012-04-27 03:18:53 -04:00
|
|
|
'open',
|
2012-03-07 11:30:20 -05:00
|
|
|
function( event )
|
|
|
|
{
|
2012-04-27 03:18:53 -04:00
|
|
|
var self = $( this );
|
|
|
|
var rel = $( '#' + self.data( 'rel' ) );
|
|
|
|
|
|
|
|
self
|
|
|
|
.trigger( 'close' )
|
|
|
|
.show()
|
|
|
|
.css( 'left', rel.position().left );
|
|
|
|
|
|
|
|
ui_block
|
|
|
|
.show();
|
2012-03-07 11:30:20 -05:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2012-04-27 03:18:53 -04:00
|
|
|
$( 'form button.reset', actions_element )
|
2012-03-07 11:30:20 -05:00
|
|
|
.die( 'click' )
|
|
|
|
.live
|
|
|
|
(
|
|
|
|
'click',
|
|
|
|
function( event )
|
|
|
|
{
|
2012-04-27 03:18:53 -04:00
|
|
|
$( this ).closest( 'div.action' )
|
|
|
|
.trigger( 'close' );
|
|
|
|
}
|
|
|
|
);
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-04-27 03:18:53 -04:00
|
|
|
var form_callback = {
|
|
|
|
|
|
|
|
rename : function( form, response )
|
|
|
|
{
|
|
|
|
var url = path_parts[1] + $( 'input[name="other"]', form ).val();
|
|
|
|
context.redirect( url );
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
$( 'form', div_action )
|
|
|
|
.ajaxForm
|
|
|
|
(
|
|
|
|
{
|
|
|
|
url : app.config.solr_path + app.config.core_admin_path + '?wt=json',
|
|
|
|
dataType : 'json',
|
|
|
|
beforeSubmit : function( array, form, options )
|
|
|
|
{
|
|
|
|
$( 'button[type="submit"] span', form )
|
|
|
|
.addClass( 'loader' );
|
|
|
|
},
|
|
|
|
success : function( response, status_text, xhr, form )
|
|
|
|
{
|
|
|
|
var action = $( 'input[name="action"]', form ).val().toLowerCase();
|
|
|
|
|
|
|
|
delete app.cores_data;
|
|
|
|
|
|
|
|
if( form_callback[action] )
|
|
|
|
{
|
|
|
|
form_callback[action]( form, response );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sammy.refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
$( 'button.reset', form )
|
|
|
|
.trigger( 'click' );
|
|
|
|
},
|
|
|
|
error : function( xhr, text_status, error_thrown )
|
|
|
|
{
|
|
|
|
},
|
|
|
|
complete : function()
|
|
|
|
{
|
|
|
|
$( 'button span.loader', actions_element )
|
|
|
|
.removeClass( 'loader' );
|
|
|
|
}
|
2012-03-07 11:30:20 -05:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2012-04-27 03:18:53 -04:00
|
|
|
var reload_button = $( '#actions #reload', cores_element );
|
2012-03-07 11:30:20 -05:00
|
|
|
reload_button
|
|
|
|
.die( 'click' )
|
|
|
|
.live
|
|
|
|
(
|
|
|
|
'click',
|
|
|
|
function( event )
|
|
|
|
{
|
|
|
|
$.ajax
|
|
|
|
(
|
|
|
|
{
|
|
|
|
url : app.config.solr_path + app.config.core_admin_path + '?wt=json&action=RELOAD&core=' + current_core,
|
|
|
|
dataType : 'json',
|
|
|
|
context : $( this ),
|
|
|
|
beforeSend : function( xhr, settings )
|
|
|
|
{
|
2012-04-27 03:18:53 -04:00
|
|
|
$( 'span', this )
|
2012-03-07 11:30:20 -05:00
|
|
|
.addClass( 'loader' );
|
|
|
|
},
|
|
|
|
success : function( response, text_status, xhr )
|
|
|
|
{
|
|
|
|
this
|
|
|
|
.addClass( 'success' );
|
|
|
|
|
2012-04-27 03:18:53 -04:00
|
|
|
delete app.cores_data;
|
|
|
|
sammy.refresh();
|
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
window.setTimeout
|
|
|
|
(
|
|
|
|
function()
|
|
|
|
{
|
2012-02-23 14:23:10 -05:00
|
|
|
reload_button
|
2012-03-07 11:30:20 -05:00
|
|
|
.removeClass( 'success' );
|
|
|
|
},
|
2012-04-27 03:18:53 -04:00
|
|
|
1000
|
2012-03-07 11:30:20 -05:00
|
|
|
);
|
|
|
|
},
|
|
|
|
error : function( xhr, text_status, error_thrown )
|
|
|
|
{
|
|
|
|
},
|
|
|
|
complete : function( xhr, text_status )
|
|
|
|
{
|
2012-04-27 03:18:53 -04:00
|
|
|
$( 'span', this )
|
2012-03-07 11:30:20 -05:00
|
|
|
.removeClass( 'loader' );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-04-27 03:18:53 -04:00
|
|
|
$( '#actions #unload', cores_element )
|
2012-03-07 11:30:20 -05:00
|
|
|
.die( 'click' )
|
|
|
|
.live
|
|
|
|
(
|
|
|
|
'click',
|
|
|
|
function( event )
|
|
|
|
{
|
2012-04-27 03:18:53 -04:00
|
|
|
var ret = confirm( 'Do you really want to unload Core "' + current_core + '"?' );
|
|
|
|
if( !ret )
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
$.ajax
|
|
|
|
(
|
|
|
|
{
|
|
|
|
url : app.config.solr_path + app.config.core_admin_path + '?wt=json&action=UNLOAD&core=' + current_core,
|
|
|
|
dataType : 'json',
|
|
|
|
context : $( this ),
|
|
|
|
beforeSend : function( xhr, settings )
|
|
|
|
{
|
2012-04-27 03:18:53 -04:00
|
|
|
$( 'span', this )
|
2012-03-07 11:30:20 -05:00
|
|
|
.addClass( 'loader' );
|
|
|
|
},
|
|
|
|
success : function( response, text_status, xhr )
|
|
|
|
{
|
|
|
|
delete app.cores_data;
|
|
|
|
context.redirect( path_parts[1].substr( 0, path_parts[1].length - 1 ) );
|
|
|
|
},
|
|
|
|
error : function( xhr, text_status, error_thrown )
|
|
|
|
{
|
|
|
|
},
|
|
|
|
complete : function( xhr, text_status )
|
|
|
|
{
|
2012-04-27 03:18:53 -04:00
|
|
|
$( 'span', this )
|
2012-03-07 11:30:20 -05:00
|
|
|
.removeClass( 'loader' );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2012-04-27 03:18:53 -04:00
|
|
|
var optimize_button = $( '#actions #optimize', cores_element );
|
2012-03-07 11:30:20 -05:00
|
|
|
optimize_button
|
|
|
|
.die( 'click' )
|
|
|
|
.live
|
|
|
|
(
|
|
|
|
'click',
|
|
|
|
function( event )
|
|
|
|
{
|
|
|
|
$.ajax
|
|
|
|
(
|
|
|
|
{
|
|
|
|
url : core_basepath + '/update?optimize=true&waitFlush=true&wt=json',
|
|
|
|
dataType : 'json',
|
|
|
|
context : $( this ),
|
|
|
|
beforeSend : function( xhr, settings )
|
|
|
|
{
|
2012-04-27 03:18:53 -04:00
|
|
|
$( 'span', this )
|
2012-03-07 11:30:20 -05:00
|
|
|
.addClass( 'loader' );
|
|
|
|
},
|
|
|
|
success : function( response, text_status, xhr )
|
|
|
|
{
|
|
|
|
this
|
|
|
|
.addClass( 'success' );
|
|
|
|
|
|
|
|
window.setTimeout
|
|
|
|
(
|
|
|
|
function()
|
|
|
|
{
|
2012-02-23 14:23:10 -05:00
|
|
|
optimize_button
|
2012-03-07 11:30:20 -05:00
|
|
|
.removeClass( 'success' );
|
|
|
|
},
|
2012-04-27 03:18:53 -04:00
|
|
|
1000
|
2012-03-07 11:30:20 -05:00
|
|
|
);
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
$( '.optimized dd.ico-0', index_data_element )
|
|
|
|
.removeClass( 'ico-0' )
|
|
|
|
.addClass( 'ico-1' );
|
|
|
|
},
|
|
|
|
error : function( xhr, text_status, error_thrown)
|
|
|
|
{
|
|
|
|
console.warn( 'd0h, optimize broken!' );
|
|
|
|
},
|
|
|
|
complete : function( xhr, text_status )
|
|
|
|
{
|
2012-04-27 03:18:53 -04:00
|
|
|
$( 'span', this )
|
2012-03-07 11:30:20 -05:00
|
|
|
.removeClass( 'loader' );
|
|
|
|
}
|
2012-02-23 14:23:10 -05:00
|
|
|
}
|
2012-03-07 11:30:20 -05:00
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
$( '.timeago', data_element )
|
|
|
|
.timeago();
|
|
|
|
|
|
|
|
$( 'ul', data_element )
|
|
|
|
.each
|
|
|
|
(
|
|
|
|
function( i, element )
|
|
|
|
{
|
|
|
|
$( 'li:odd', element )
|
|
|
|
.addClass( 'odd' );
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
2012-02-23 14:23:10 -05:00
|
|
|
}
|
2012-03-07 11:30:20 -05:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
2012-02-23 14:23:10 -05:00
|
|
|
);
|