mirror of
https://github.com/e107inc/e107.git
synced 2025-08-19 04:41:53 +02:00
Merge branch 'master' of github.com:e107inc/e107
This commit is contained in:
@@ -5,57 +5,57 @@ $(document).ready(function()
|
||||
var hash = event.target.href.toString().split('#')[1], form = $(event.target).parents('form')[0];
|
||||
window.location.hash = '/' + hash;
|
||||
if(form) {
|
||||
$(form).attr('action', $(form).attr('action').split('#')[0] + '#/' + hash);
|
||||
$(form).attr('action', $(form).attr('action').split('#')[0] + '#/' + hash);
|
||||
}
|
||||
});
|
||||
|
||||
// tabs hash
|
||||
if(/^#\/\w+/.test(window.location.hash)) {
|
||||
var hash = window.location.hash.substr(2);
|
||||
if(hash.match('^tab')) $('.nav-tabs a[href=#' + hash + ']').tab('show');
|
||||
if(hash.match('^tab')){ $('.nav-tabs a[href=#' + hash + ']').tab('show'); }
|
||||
}
|
||||
|
||||
$('.e-typeahead').each(function() {
|
||||
|
||||
$('.e-typeahead').each( function(){
|
||||
|
||||
var id = $(this).attr("id");
|
||||
var name = '#' + id.replace('-usersearch', '');
|
||||
var newval = $(this).attr("data-value");
|
||||
$(this).typeahead({
|
||||
source: $(this).attr("data-source"),
|
||||
updater: function(text, type){
|
||||
if(type == 'value')
|
||||
{
|
||||
$(name).val(text);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
$(this).typeahead({
|
||||
source: $(this).attr("data-source"),
|
||||
updater: function(text, type){
|
||||
if(type === 'value')
|
||||
{
|
||||
$(name).val(text);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/* Switch to Tab containing invalid form field. */
|
||||
$('input[type=submit],button[type=submit]').on('click', function() {
|
||||
|
||||
var id = $(this).closest('form').attr('id');
|
||||
var found = false;
|
||||
|
||||
$('#'+id).find(':invalid').each(function(index, node) {
|
||||
|
||||
$('#'+id).find('input:invalid,select:invalid,textarea:invalid').each(function(index, node) {
|
||||
|
||||
var tab = $('#'+node.id).closest('.tab-pane').attr('id');
|
||||
|
||||
if(tab && (found == false))
|
||||
|
||||
if(tab && (found === false))
|
||||
{
|
||||
$('a[href="#'+tab+'"]').tab('show');
|
||||
found = true;
|
||||
//alert(node.id+' : '+tab);
|
||||
// alert(node.id+' : '+tab + ' '.index);
|
||||
}
|
||||
// var label = $('label[for=' + node.id + ']');
|
||||
})
|
||||
// var label = $('label[for=' + node.id + ']');
|
||||
});
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// run tips on title attribute.
|
||||
$(".e-tip").each(function() {
|
||||
@@ -124,7 +124,8 @@ $(document).ready(function()
|
||||
$('button[data-loading-text],a[data-loading-text]').on('click', function()
|
||||
{
|
||||
var caption = $(this).attr('data-loading-text');
|
||||
$(this).removeClass('btn-success');
|
||||
$(this).removeClass('btn-success');
|
||||
$(this).removeClass('btn-primary');
|
||||
$(this).html(caption);
|
||||
if($(this).attr('data-disable') == 'true')
|
||||
{
|
||||
@@ -139,6 +140,7 @@ $(document).ready(function()
|
||||
var caption = $(this).attr('data-loading-text');
|
||||
$(this).val(caption);
|
||||
$(this).removeClass('btn-success');
|
||||
$(this).removeClass('btn-primary');
|
||||
//$(this).attr('disabled', 'disabled').val(caption);
|
||||
return true;
|
||||
}
|
||||
@@ -203,14 +205,22 @@ $(document).ready(function()
|
||||
|
||||
|
||||
|
||||
var progresspump = null;
|
||||
|
||||
$('.e-progress-cancel').on('click', function(e)
|
||||
{
|
||||
clearInterval(progresspump);
|
||||
var target = $(this).attr('data-progress-target');
|
||||
$("#"+target).closest('.progress').removeClass("active");
|
||||
progresspump = null;
|
||||
alert('stopped');
|
||||
});
|
||||
|
||||
|
||||
$('.e-progress').on('click', function(e)
|
||||
{
|
||||
// alert('Process Started');
|
||||
|
||||
var target = 'progress';
|
||||
|
||||
var target = $(this).attr('data-progress-target');
|
||||
var script = $(this).attr('data-progress');
|
||||
var show = $(this).attr('data-progress-show');
|
||||
var hide = $(this).attr('data-progress-hide');
|
||||
@@ -224,33 +234,33 @@ $(document).ready(function()
|
||||
|
||||
$("#"+target).css('width','1%'); // so we know it's running.
|
||||
|
||||
var progresspump = setInterval(function(){
|
||||
|
||||
progresspump = setInterval(function(){
|
||||
|
||||
$.get(script, { mode: mode }).done( function(data){
|
||||
|
||||
// alert(data);
|
||||
$("#"+target).css('width',data+'%'); // update the progress bar width */
|
||||
$("#"+target).html(data+'%'); // display the numeric value */
|
||||
// alert(data);
|
||||
$("#"+target).css('width', data+'%'); // update the progress bar width */
|
||||
$("#"+target).html(data+'%'); // display the numeric value */
|
||||
|
||||
if(data > 99.999) {
|
||||
|
||||
clearInterval(progresspump);
|
||||
|
||||
$("#progressouter").removeClass("active");
|
||||
|
||||
clearInterval(progresspump);
|
||||
$("#"+target).closest('.progress').removeClass("active");
|
||||
|
||||
$("#"+target).html("Done");
|
||||
|
||||
if(hide !== 'undefined')
|
||||
{
|
||||
$('#'+hide).hide();
|
||||
$('#'+hide).hide();
|
||||
}
|
||||
|
||||
if(show !== 'undefined')
|
||||
{
|
||||
$('#'+show).show('slow');
|
||||
$('#'+show).show('slow');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -308,7 +318,8 @@ $(document).ready(function()
|
||||
|
||||
if(multi === undefined)
|
||||
{
|
||||
$(this).selectpicker();
|
||||
// $(this).selectpicker(); // causes HTML5 validation alert to be hidden.
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -695,7 +706,7 @@ $(document).ready(function()
|
||||
|
||||
// Text-area AutoGrow
|
||||
// $("textarea.e-autoheight").elastic();
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
|
||||
/* global $ */
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
@@ -37,8 +37,8 @@ $(document).ready(function()
|
||||
|
||||
$(".e-comment-submit").live("click", function(){
|
||||
|
||||
var url = $(this).attr("data-target");
|
||||
var sort = $(this).attr("data-sort");
|
||||
var url = $(this).attr("data-target");
|
||||
var sort = $(this).attr("data-sort");
|
||||
var pid = parseInt($(this).attr("data-pid"));
|
||||
var formid = (pid != '0') ? "#e-comment-form-reply" : "#e-comment-form";
|
||||
var data = $('form'+formid).serialize() ;
|
||||
@@ -231,7 +231,7 @@ $(document).ready(function()
|
||||
url: url + '?ajax_used=1&mode=delete',
|
||||
data: { itemid: sp[3] },
|
||||
success: function(data) {
|
||||
var a = $.parseJSON(data);
|
||||
var a = $.parseJSON(data);
|
||||
|
||||
if(!a.error)
|
||||
{
|
||||
@@ -248,23 +248,23 @@ $(document).ready(function()
|
||||
|
||||
$(".e-comment-approve").live("click", function(){
|
||||
|
||||
var url = $(this).attr("data-target");
|
||||
var sp = $(this).attr('id').split("-");
|
||||
var id = "#comment-status-" + sp[3];
|
||||
var url = $(this).attr("data-target");
|
||||
var sp = $(this).attr('id').split("-");
|
||||
var id = "#comment-status-" + sp[3];
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: url + '?ajax_used=1&mode=approve',
|
||||
data: { itemid: sp[3] },
|
||||
success: function(data) {
|
||||
|
||||
|
||||
|
||||
var a = $.parseJSON(data);
|
||||
|
||||
|
||||
var a = $.parseJSON(data);
|
||||
|
||||
|
||||
if(!a.error)
|
||||
{
|
||||
//TODO modify status of html on page.
|
||||
//TODO modify status of html on page
|
||||
$(id).text(a.html)
|
||||
.fadeIn('slow')
|
||||
.addClass('e-comment-edit-success'); //TODO another class?
|
||||
@@ -289,28 +289,28 @@ $(document).ready(function()
|
||||
|
||||
$(".e-rate-thumb").live("click", function(){
|
||||
|
||||
var src = $(this).attr("href");
|
||||
var thumb = $(this);
|
||||
var tmp = src.split('#');
|
||||
var id = tmp[1];
|
||||
var src = tmp[0];
|
||||
|
||||
var src = $(this).attr("href");
|
||||
var thumb = $(this);
|
||||
var tmp = src.split('#');
|
||||
var id = tmp[1];
|
||||
var src = tmp[0];
|
||||
|
||||
|
||||
$.ajax({
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: src,
|
||||
data: { ajax_used: 1, mode: 'thumb' },
|
||||
dataType: "html",
|
||||
success: function(html) {
|
||||
|
||||
if(html == '')
|
||||
if(html === '')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var tmp = html.split('|');
|
||||
up= tmp[0];
|
||||
down = tmp[1];
|
||||
up= tmp[0];
|
||||
down = tmp[1];
|
||||
|
||||
$('#'+id +'-up').text(up);
|
||||
$('#'+id +'-down').text(down);
|
||||
@@ -323,4 +323,30 @@ $(document).ready(function()
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Switch to Tab containing invalid form field. */
|
||||
$('input[type=submit],button[type=submit]').on('click', function() {
|
||||
|
||||
var id = $(this).closest('form').attr('id'), found = false;
|
||||
|
||||
$('#'+ id).find(':invalid').each(function (index, node) {
|
||||
|
||||
var tab = $('#'+node.id).closest('.tab-pane').attr('id');
|
||||
// console.log(node.id);
|
||||
|
||||
if(tab && (found === false))
|
||||
{
|
||||
$('a[href="#'+tab+'"]').tab('show');
|
||||
found = true;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
Reference in New Issue
Block a user