Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions js/auto_save.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
jQuery(document).ready(function () {
jQuery(document).ready(function ($) {

// Send elements with class sf_autosave to the server for autosave
jQuery('.sf_autosave').keyup(function () {
$('.sf_autosave').keyup(function () {

var autosave_data = {};
autosave_data['ticket_id'] = SFAutoSave.ticket_id;

jQuery('.sf_autosave').each(function () {
element_key = jQuery(this).attr('name');
element_value = jQuery(this).val();
$('.sf_autosave').each(function () {
element_key = $(this).attr('name');
element_value = $(this).val();
autosave_data[element_key] = element_value
});

Expand Down
22 changes: 11 additions & 11 deletions js/email_accounts.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
jQuery(document).ready(function () {
jQuery('.delete_email_account').click(function (e) {
jQuery(document).ready(function ($) {
$('.delete_email_account').click(function (e) {
e.preventDefault();

if (!confirm(SFEmailAccounts.sure_delete_account)) {
return;
}

var account_key = jQuery(this).data('account-id');
var account_key = $(this).data('account-id');
var form_action = "edit.php?post_type=" + SFEmailAccounts.post_type + "&page=" + SFEmailAccounts.slug;

var form = '';
Expand All @@ -16,28 +16,28 @@ jQuery(document).ready(function () {
form += '<input type="hidden" name="account_id" value=' + account_key + ' />';
form += '</form>';

jQuery('body').append(form);
jQuery('#remove_email_account').submit();
$('body').append(form);
$('#remove_email_account').submit();
});


jQuery('#add_new_email_account #imap_ssl').change(function () {
$('#add_new_email_account #imap_ssl').change(function () {
if (this.checked) {
// Change to default IMAP SSL port on enabling SSL
jQuery('#add_new_email_account #imap_port').val('993');
$('#add_new_email_account #imap_port').val('993');
} else {
// Change to default IMAP non-SSL port on disabling SSL
jQuery('#add_new_email_account #imap_port').val('143');
$('#add_new_email_account #imap_port').val('143');
}
});

jQuery('#add_new_email_account #smtp_ssl').change(function () {
$('#add_new_email_account #smtp_ssl').change(function () {
if (this.checked) {
// Change to default SMTP SSL port on enabling SSL
jQuery('#add_new_email_account #smtp_port').val('465');
$('#add_new_email_account #smtp_port').val('465');
} else {
// Change to default SMTP non-SSL port on disabling SSL
jQuery('#add_new_email_account #smtp_port').val('25');
$('#add_new_email_account #smtp_port').val('25');
}
});
});
24 changes: 12 additions & 12 deletions js/email_conversation.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
jQuery(document).ready(function () {
jQuery(document).ready(function ($) {
// Send conversation to E-Mail ID's

var email_conversion = function (event) {
event.preventDefault();
var email_ids = jQuery('#email_conversation_to').val();
var email_ids = $('#email_conversation_to').val();

jQuery.ajax(ajaxurl, {
$.ajax(ajaxurl, {
type : 'post',
data : {
action : 'sf_forward_conversation',
Expand All @@ -14,26 +14,26 @@ jQuery(document).ready(function () {
_email_conversation_nonce: SFEmailConversation._email_conversation_nonce,
},
beforeSend: function () {
jQuery('#email_conversation_to').prop('disabled', true);
jQuery('#email_conversation_submit').prop('disabled', true);
jQuery('#email_conversation_status').text(SFEmailConversation.sending_emails);
$('#email_conversation_to').prop('disabled', true);
$('#email_conversation_submit').prop('disabled', true);
$('#email_conversation_status').text(SFEmailConversation.sending_emails);
},
success : function (content) {
jQuery('#email_conversation_status').html(content);
$('#email_conversation_status').html(content);
},
error : function () {
jQuery('#email_conversation_status').text(SFEmailConversation.failed_sending);
$('#email_conversation_status').text(SFEmailConversation.failed_sending);
},
complete : function () {
jQuery('#email_conversation_to').prop('disabled', false);
jQuery('#email_conversation_submit').prop('disabled', false);
$('#email_conversation_to').prop('disabled', false);
$('#email_conversation_submit').prop('disabled', false);
},
});

}

jQuery('#email_conversation_submit').click(email_conversion);
jQuery('#email_conversation_to').keyup(function () {
$('#email_conversation_submit').click(email_conversion);
$('#email_conversation_to').keyup(function () {
if (event.keyCode == 10) {
email_conversion();
}
Expand Down
18 changes: 9 additions & 9 deletions js/permissions.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
jQuery(document).ready(function () {
jQuery('.permission_filters').change(function () {
var user_id = jQuery('#change_user option:selected').data('user-id');
var status = jQuery('#change_status option:selected').data('status');
jQuery(document).ready(function ($) {
$('.permission_filters').change(function () {
var user_id = $('#change_user option:selected').data('user-id');
var status = $('#change_status option:selected').data('status');

jQuery.ajax(ajaxurl, {
$.ajax(ajaxurl, {
type : 'post',
data : {
action : 'get_user_permissions',
Expand All @@ -12,13 +12,13 @@ jQuery(document).ready(function () {
_get_user_permissions_nonce: SFPermissions._get_user_permissions_nonce,
},
success: function (content) {
jQuery('#user_permissions_table').html(content);
$('#user_permissions_table').html(content);
},
});
});

jQuery(document).on('change', '.sf_user_permissions_table .toggle_privilege', function () {
var checkbox = jQuery(this);
$(document).on('change', '.sf_user_permissions_table .toggle_privilege', function () {
var checkbox = $(this);
var checkbox_label = checkbox.siblings('.privilege_status');
var permission_identifier = checkbox.data('permission-identifier');

Expand All @@ -30,7 +30,7 @@ jQuery(document).ready(function () {
checkbox_label.html(SFPermissions.changing_status);
checkbox.prop('disabled', true);

jQuery.ajax(ajaxurl, {
$.ajax(ajaxurl, {
type : 'post',
data : {
action : 'set_user_permission',
Expand Down
16 changes: 8 additions & 8 deletions js/predefined-replies.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
jQuery(document).ready(function () {
jQuery(document).ready(function ($) {

jQuery('#predefs').change(function () {
$('#predefs').change(function () {
if (this.old_child == undefined) {
this.old_child = 1;
}

// New selection of combo box
new_content = jQuery('#predefs').find('option:selected').data('content');
new_content = $('#predefs').find('option:selected').data('content');

// Previous selection of combo box
old_content = jQuery('.predef:nth-child(' + this.old_child + ')').data('content');
old_content = $('.predef:nth-child(' + this.old_child + ')').data('content');

// Current value of reply text box
current_content = jQuery('#reply').val();
current_content = $('#reply').val();

if (0 == new_content.length) {
return;
Expand All @@ -21,12 +21,12 @@ jQuery(document).ready(function () {
// Show confirmation message if reply box content is manually changed by user
if (current_content != old_content) {
if (false == window.confirm(SFPredefinedReplies.message)) {
jQuery('.predef:nth-child(' + this.old_child + ')').prop('selected', true);
$('.predef:nth-child(' + this.old_child + ')').prop('selected', true);
return;
}
}

jQuery('#reply').val(new_content);
this.old_child = jQuery('#predefs').find('option:selected').index() + 1;
$('#reply').val(new_content);
this.old_child = $('#predefs').find('option:selected').index() + 1;
});
});
8 changes: 4 additions & 4 deletions js/preferences.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
jQuery(document).ready(function () {
jQuery(document).ready(function ($) {

// Update E-Mail notification settings on checkbox toggle
jQuery(document).on('change', '.sf_email_accounts_table .toggle_privilege', function () {
var checkbox = jQuery(this);
$(document).on('change', '.sf_email_accounts_table .toggle_privilege', function () {
var checkbox = $(this);
var checkbox_label = checkbox.siblings('.privilege_status');
var email_notfication_identifier = checkbox.data('email-notfication-identifier');

Expand All @@ -13,7 +13,7 @@ jQuery(document).ready(function () {
checkbox_label.html(SFPreferences.changing_state);
checkbox.prop('disabled', true);

jQuery.ajax(ajaxurl, {
$.ajax(ajaxurl, {
type : 'post',
data : {
action : 'set_email_notfication',
Expand Down
2 changes: 1 addition & 1 deletion js/supportflow.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions js/ticket_attachments.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jQuery(document).ready(function ($) {
// Handle results from media manager.
frame.on('close', function () {
var attachments = frame.state().get('selection').toJSON();
jQuery.each(attachments, function () {
$.each(attachments, function () {
var attachment_download_link = '<a class="reply-attachment-link" target="_blank" href="' + _.escape(this.url) + '">' + _.escape(this.filename) + '</a>';
var attachment_remove_link = '<a class="reply-attachment-remove delete" href="#" data-attachment-id=' + _.escape(this.id) + ' >' + SFTicketAttachments.remove_attachment + '</a>';
jQuery('#replies-attachments-list').append('<li id="media-items" class="reply-attachment">' + attachment_download_link + '&nbsp;' + attachment_remove_link + '</li>');
jQuery('#reply-attachments').val(jQuery('#reply-attachments').val() + _.escape(this.id) + ',');
$('#replies-attachments-list').append('<li id="media-items" class="reply-attachment">' + attachment_download_link + '&nbsp;' + attachment_remove_link + '</li>');
$('#reply-attachments').val($('#reply-attachments').val() + _.escape(this.id) + ',');
});
});

Expand Down
42 changes: 21 additions & 21 deletions js/tickets.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
jQuery(document).ready(function () {
jQuery('#supportflow-details .meta-item-ok-button').click(function (event) {
var dropdown = jQuery(this).siblings('.meta-item-dropdown').children('option:selected');
var meta_item = jQuery(this).closest('.meta-item');
jQuery(document).ready(function ($) {
$('#supportflow-details .meta-item-ok-button').click(function (event) {
var dropdown = $(this).siblings('.meta-item-dropdown').children('option:selected');
var meta_item = $(this).closest('.meta-item');
var form_input = meta_item.children('.meta-item-name');
var label = meta_item.children('.meta-item-label');

Expand All @@ -11,54 +11,54 @@ jQuery(document).ready(function () {
event.preventDefault();
});

jQuery('#supportflow-details .meta-item-toggle-button').click(function (event) {
jQuery(this).closest('.meta-item').children('.meta-item-toggle-content').toggle(250);
$('#supportflow-details .meta-item-toggle-button').click(function (event) {
$(this).closest('.meta-item').children('.meta-item-toggle-content').toggle(250);
event.preventDefault();
});

// Require title and atleast customer before saving a ticket
jQuery('.save-button').click(function (event) {
if ('' == jQuery('#subject').val()) {
jQuery('#subject').focus();
$('.save-button').click(function (event) {
if ('' == $('#subject').val()) {
$('#subject').focus();
alert(SFTickets.no_title_msg);
event.preventDefault();
return;
}
if ('' == jQuery('#customers').val()) {
jQuery('#customers').focus();
if ('' == $('#customers').val()) {
$('#customers').focus();
alert(SFTickets.no_customer_msg);
event.preventDefault();
return;
}
});

// Submit post if user pressed Ctrl+Enter in reply content box
jQuery('#reply').keypress(function (event) {
if (event.ctrlKey && event.keyCode == 10 && $(this).val() != '') {
$('#reply').keypress(function (event) {
if (event.ctrlKey && ( event.keyCode == 10 || event.keyCode == 13 ) && $(this).val() != '') {
$('#post').submit();
}
});

// Toggle submit button text (Send Message/Add private note)
jQuery('#mark-private').change(function () {
$('#mark-private').change(function () {
if ('post.php' == SFTickets.pagenow) {
if (jQuery('#mark-private').prop('checked')) {
jQuery('#insert-reply').val(SFTickets.add_private_note);
if ($('#mark-private').prop('checked')) {
$('#insert-reply').val(SFTickets.add_private_note);
} else {
jQuery('#insert-reply').val(SFTickets.send_msg);
$('#insert-reply').val(SFTickets.send_msg);
}
}
});

// Close ticket wehen close ticket button is submitted
jQuery('#close-ticket-submit').click(function (event) {
jQuery("#post .meta-item input[name='post_status']").val('sf_closed');
$('#close-ticket-submit').click(function (event) {
$("#post .meta-item input[name='post_status']").val('sf_closed');
});

// Show quoted text
jQuery('.sf_toggle_quoted_text').click(function (event) {
$('.sf_toggle_quoted_text').click(function (event) {
event.preventDefault();
jQuery(this).parent().html(jQuery(this).data('quoted_text'))
$(this).parent().html($(this).data('quoted_text'))
});

});
22 changes: 11 additions & 11 deletions js/toggle-links.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
jQuery(document).ready(function () {
// Close all the different stat tables and toggle the status of clicked stat table
jQuery('.toggle-link').click(function (event) {
var current = jQuery(this).siblings('.toggle-content').css('display');
jQuery('.toggle-content').hide(500);
jQuery('.toggle-link').prop('title', SFToggleLinks.expand);
$('.toggle-link').click(function (event) {
var current = $(this).siblings('.toggle-content').css('display');
$('.toggle-content').hide(500);
$('.toggle-link').prop('title', SFToggleLinks.expand);
if ('none' == current) {
jQuery(this).siblings('.toggle-content').show(500);
jQuery(this).prop('title', SFToggleLinks.collapse);
$(this).siblings('.toggle-content').show(500);
$(this).prop('title', SFToggleLinks.collapse);
}
event.preventDefault();
});

// Set different type of statistics link title at page load
jQuery(jQuery('.toggle-content')).each(function () {
if ('none' == jQuery(this).css('display')) {
jQuery(this).siblings('.toggle-link').prop('title', SFToggleLinks.expand);
$($('.toggle-content')).each(function () {
if ('none' == $(this).css('display')) {
$(this).siblings('.toggle-link').prop('title', SFToggleLinks.expand);
} else {
jQuery(this).siblings('.toggle-link').prop('title', SFToggleLinks.collapse);
$(this).siblings('.toggle-link').prop('title', SFToggleLinks.collapse);
}

jQuery('.toggle-content').first().show(500);
$('.toggle-content').first().show(500);
});
});