- $noticeDataText = $('#'+SN.C.S.NoticeDataText);
- var original = $noticeDataText.val();
- shortenAjax = $.ajax({
- url: $('address .url')[0].href+'/plugins/ClientSideShorten/shorten',
- data: { text: $noticeDataText.val() },
- dataType: 'text',
- success: function(data) {
- if(original == $noticeDataText.val()) {
- $noticeDataText.val(data).keyup();
+ var $noticeDataText = $('#'+SN.C.S.NoticeDataText);
+ var noticeText = $noticeDataText.val();
+
+ if(noticeText.length > maxNoticeLength || longestWordInString(noticeText) > maxUrlLength) {
+ var original = $noticeDataText.val();
+ shortenAjax = $.ajax({
+ url: $('address .url')[0].href+'/plugins/ClientSideShorten/shorten',
+ data: { text: $noticeDataText.val() },
+ dataType: 'text',
+ success: function(data) {
+ if(original == $noticeDataText.val()) {
+ $noticeDataText.val(data).keyup();
+ }