X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=js%2FCommon.js;h=d0108f6ac11359ad5567fbfe589255ed89c045d5;hb=a29a45d40bad75f52f1a13ecc63cc16c220171cb;hp=437ecffd8bab383f074a3da952cfe98ec5994910;hpb=8e3272a16e9f62e27d5910041bf47447e060469e;p=civicrm-core.git diff --git a/js/Common.js b/js/Common.js index 437ecffd8b..d0108f6ac1 100644 --- a/js/Common.js +++ b/js/Common.js @@ -447,58 +447,6 @@ function showHideRow(index) { return false; } -/** - * Function to check activity status in relavent to activity date - * - * @param element message JSON object. - */ -function activityStatus(message) { - var d = new Date(), time = [], i; - var currentDateTime = d.getTime() - var activityTime = cj("input#activity_date_time_time").val().replace(":", ""); - - //chunk the time in bunch of 2 (hours,minutes,ampm) - for (i = 0; i < activityTime.length; i += 2) { - time.push(activityTime.slice(i, i + 2)); - } - var activityDate = new Date(cj("input#activity_date_time_hidden").val()); - - d.setFullYear(activityDate.getFullYear()); - d.setMonth(activityDate.getMonth()); - d.setDate(activityDate.getDate()); - var hours = time['0']; - var ampm = time['2']; - - if (ampm == "PM" && hours != 0 && hours != 12) { - // force arithmetic instead of string concatenation - hours = hours * 1 + 12; - } - else { - if (ampm == "AM" && hours == 12) { - hours = 0; - } - } - d.setHours(hours); - d.setMinutes(time['1']); - - var activity_date_time = d.getTime(); - - var activityStatusId = cj('#status_id').val(); - - if (activityStatusId == 2 && currentDateTime < activity_date_time) { - if (!confirm(message.completed)) { - return false; - } - } - else { - if (activity_date_time && activityStatusId == 1 && currentDateTime >= activity_date_time) { - if (!confirm(message.scheduled)) { - return false; - } - } - } -} - CRM.strings = CRM.strings || {}; CRM.validate = CRM.validate || { params: {}, @@ -596,9 +544,9 @@ CRM.validate = CRM.validate || { }); $.fn.crmtooltip = function () { - $('a.crm-summary-link:not(.crm-processed)') - .addClass('crm-processed') - .on('mouseover', function (e) { + $(document) + .on('mouseover', 'a.crm-summary-link:not(.crm-processed)', function (e) { + $(this).addClass('crm-processed'); $(this).addClass('crm-tooltip-active'); var topDistance = e.pageY - $(window).scrollTop(); if (topDistance < 300 | topDistance < $(this).children('.crm-tooltip-wrapper').height()) { @@ -611,10 +559,11 @@ CRM.validate = CRM.validate || { .load(this.href); } }) - .on('mouseout', function () { + .on('mouseout', 'a.crm-summary-link', function () { + $(this).removeClass('crm-processed'); $(this).removeClass('crm-tooltip-active crm-tooltip-down'); }) - .on('click', false); + .on('click', 'a.crm-summary-link', false); }; var h; @@ -883,8 +832,9 @@ CRM.validate = CRM.validate || { /** * Clientside currency formatting * @param value - * @param format + * @param format - currency representation of the number 1234.56 * @return string + * @see CRM_Core_Resources::addCoreResources */ var currencyTemplate; CRM.formatMoney = function(value, format) { @@ -903,7 +853,6 @@ CRM.validate = CRM.validate || { sign = (value < 0) ? '-' : ''; //extracting the absolute value of the integer part of the number and converting to string i = parseInt(value = Math.abs(value).toFixed(2)) + ''; - j = ((j = i.length) > 3) ? j % 3 : 0; result = sign + (j ? i.substr(0, j) + separator : '') + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + separator) + (2 ? decimal + Math.abs(value - i).toFixed(2).slice(2) : ''); return format.replace(/1.*234.*56/, result);