1jQuery(document).ready(function(){ 2 3 // Joomla Root and Base URL 4 window.root_url = !!jroot_url_fc ? jroot_url_fc : ''; 5 window.base_url = !!jbase_url_fc ? jbase_url_fc : ''; 6 7 var under_vote = false; 8 9 if (jQuery('.fcvote').length) 10 { 11 jQuery('.fcvote a.fc_dovote').on('click', function(e) 12 { 13 if (under_vote) return; 14 under_vote = true; 15 16 var voting_group = jQuery(this).closest('.voting-group'); 17 voting_group.css('opacity', '0.5'); 18 19 var vote_list = jQuery(this).closest('.fcvote_list'); 20 var data_arr = jQuery(this).attr('data-rel').split("_"); 21 22 // ID for item being voted 23 var itemID = data_arr[0]; 24 25 // Voting characteristic, (defaults to the 'main' voting characteristic if not set) 26 var xid = typeof(data_arr[1])!='undefined' && data_arr[1] ? data_arr[1] : 'main'; 27 28 var xid_msg = jQuery(this).closest('.fcvote').find('.fcvote_message'); 29 var main_msg = voting_group.find('.voting-row_main').find('.fcvote_message'); 30 31 var xid_cnt = jQuery(this).closest('.fcvote').find('.fcvote-count'); 32 var main_cnt = voting_group.find('.voting-row_main').find('.fcvote-count'); 33 34 var xid_rating = jQuery(this).closest('.fcvote_list').find('.current-rating'); 35 var main_rating = voting_group.find('.voting-row_main').find('.fcvote_list').find('.current-rating'); 36 37 var _htmlrating_main = main_cnt.length ? main_cnt.html() : ''; 38 var _htmlrating = xid_cnt.html(); 39 40 xid_cnt.empty().hide();//.addClass('ajax-loader'); 41 xid_msg.empty().show().addClass('ajax-loader'); 42 43 var rating = jQuery(this).text(); 44 45 var voteurl = base_url 46 + 'index.php?option=com_flexicontent&task=reviews.ajaxvote&user_rating=' + rating + '&cid=' + itemID + '&xid=' + xid; 47 48 jQuery.ajax({ 49 url: voteurl, 50 dataType: "json", 51 data: { 52 lang: (typeof fc_sef_lang != 'undefined' ? fc_sef_lang : '') 53 }, 54 success: function( data ) 55 { 56 if (typeof(data.percentage)!="undefined" && data.percentage) 57 { 58 xid_rating.css('width', data.percentage + "%"); 59 } 60 if (typeof(data.percentage_main)!="undefined" && data.percentage_main) 61 { 62 main_rating.css('width', data.percentage_main + "%"); 63 } 64 65 if (typeof(data.htmlrating)!="undefined" && data.htmlrating) 66 { 67 _htmlrating = data.htmlrating; 68 } 69 if (typeof(data.htmlrating_main)!="undefined" && data.htmlrating_main) 70 { 71 _htmlrating_main = data.htmlrating_main; 72 } 73 74 if (typeof(data.html) && data.html) 75 { 76 xid_cnt.html(data.html).show(); 77 78 setTimeout(function() 79 { 80 xid_cnt.animate({opacity: "0.5"}, 900); 81 }, 2000); 82 83 setTimeout(function() 84 { 85 xid_cnt.css('opacity', 'unset'); 86 if(_htmlrating.trim()) 87 { 88 xid_cnt.css('opacity', 1).html(_htmlrating); 89 } 90 //else xid_cnt.html('').hide(); 91 }, 3000); 92 } 93 else 94 { 95 xid_cnt.html(_htmlrating).removeClass('ajax-loader'); 96 } 97 98 if (main_cnt.length) { 99 if (typeof(data.html_main) && data.html_main) { 100 main_cnt.html(data.html_main).removeClass('ajax-loader'); 101 setTimeout(function() { main_cnt.animate({opacity: "0.5"}, 900); }, 2000); 102 setTimeout(function() { 103 main_cnt.css('opacity', 'unset'); 104 if(_htmlrating_main.trim()) 105 main_cnt.css('opacity', 1).html(_htmlrating_main); 106 else 107 main_cnt.html('').hide(); 108 }, 3000); 109 } else { 110 main_cnt.html(_htmlrating_main).removeClass('ajax-loader'); 111 } 112 } 113 114 xid_msg.removeClass('ajax-loader'); 115 116 if (typeof(data.message)!="undefined" && data.message) { 117 xid_msg.css('display', '').html(data.message); 118 } 119 if (typeof(data.message_main)!="undefined" && data.message_main) { 120 main_msg.css('display', '').html(data.message_main); 121 } 122 123 under_vote = false; 124 voting_group.css('opacity', ''); 125 }, 126 error: function (xhr, ajaxOptions, thrownError) { 127 alert('Error status: ' + xhr.status + ' , Error text: ' + thrownError); 128 under_vote = false; 129 voting_group.css('opacity', ''); 130 } 131 }); 132 133 }); 134 } 135}); 136 137 function fcvote_open_review_form(tagid, content_id, review_type) 138 { 139 var box = jQuery('#'+tagid); 140 var box_loading = jQuery('#'+tagid+'_loading'); 141 142 if (box.is(":visible")) 143 { 144 box_loading.empty().removeClass('ajax-loader').css('display', 'none'); 145 box.slideUp(400, function(){ box.empty(); }); 146 return; 147 } 148 149 if (1) 150 { 151 var url = base_url 152 + 'index.php?option=com_flexicontent&task=reviews.edit&view=reviews&id=0&tmpl=component&tagid=' + tagid 153 + '&content_id=' + content_id + '&review_type=' + review_type 154 + '&lang=' + (typeof fc_sef_lang != 'undefined' ? fc_sef_lang : ''); 155 156 fc_showDialog(url, 'fc_modal_popup_container', 0, 800, 800, 0, {title: 'Review this item'}); 157 } 158 else 159 { 160 var url = root_url 161 + 'index.php?option=com_flexicontent&format=raw&task=getreviewform&tagid=' + tagid 162 + '&content_id=' + content_id + '&review_type=' + review_type; 163 164 box_loading.empty().addClass('ajax-loader').css('display', 'inline-block'); 165 166 jQuery.ajax({ 167 url: url, 168 dataType: "json", 169 data: { 170 lang: (typeof fc_sef_lang != 'undefined' ? fc_sef_lang : '') 171 }, 172 success: function( data ) 173 { 174 box_loading.empty().removeClass('ajax-loader').css('display', 'none'); 175 if (typeof(data.html) && data.html) 176 { 177 box.html(data.html).slideDown(); 178 } 179 }, 180 error: function (xhr, ajaxOptions, thrownError) { 181 box_loading.empty().removeClass('ajax-loader').css('display', 'none'); 182 alert('Error status: ' + xhr.status + ' , Error text: ' + thrownError); 183 } 184 }); 185 } 186 } 187 188 189 function fcvote_submit_review_form(tagid, form) 190 { 191 var box = jQuery('#'+tagid); 192 var box_loading = jQuery('#'+tagid+'_loading'); 193 194 if (( typeof(form.checkValidity) == "function" ) ) 195 { 196 if (!form.checkValidity()) 197 { 198 box_loading.empty().removeClass('ajax-loader').css('display', ''); 199 fcvote_submit_review_form_show_validation(jQuery(form), box_loading); 200 return; 201 } 202 } 203 204 if (1) 205 { 206 var url = base_url 207 + 'index.php?option=com_flexicontent&task=reviews.edit&view=reviews&id=0&tmpl=component&tagid=' 208 + tagid + '&content_id=' + content_id + '&review_type=' + review_type 209 + '&lang=' + (typeof fc_sef_lang != 'undefined' ? fc_sef_lang : ''); 210 211 fc_showDialog(url, 'fc_modal_popup_container', 0, 800, 800, 0, {title: 'Review this item'}); 212 } 213 else 214 { 215 var url = root_url 216 + 'index.php?option=com_flexicontent&format=raw&task=storereviewform'; 217 218 box_loading.empty().addClass('ajax-loader').css('display', 'inline-block'); 219 220 jQuery.ajax({ 221 url: url, 222 dataType: "json", 223 data: jQuery(form).serialize(), 224 success: function( data ) 225 { 226 box_loading.empty().removeClass('ajax-loader').css('display', 'none'); 227 if (typeof(data.html) && data.html) 228 { 229 if (typeof(data.error) && data.error) 230 { 231 box_loading.html(data.html).css('display', 'block'); 232 } 233 else 234 { 235 box.html(data.html).show(); 236 } 237 } 238 }, 239 error: function (xhr, ajaxOptions, thrownError) { 240 box_loading.empty().removeClass('ajax-loader').css('display', 'none'); 241 alert('Error status: ' + xhr.status + ' , Error text: ' + thrownError); 242 } 243 }); 244 } 245 } 246 247 248 function fcvote_submit_review_form_show_validation(form, errorBox) 249 { 250 var errorList = jQuery('<div></div>'); 251 errorBox.empty().append(errorList); 252 253 //Find all invalid fields within the form. 254 form.find(':invalid').each(function(index, node) 255 { 256 //Find the field's corresponding label 257 var label = jQuery('label[for=' + node.id + ']'); 258 259 //Opera incorrectly does not fill the validationMessage property. 260 var message = node.validationMessage || 'Invalid value.';
261 errorList.append('<div class="fc-mssg fc-warning fc-nobgimage"><button type="button" class="close" data-dismiss="alert">×</button><b>' + label.html() + '</b>: ' + message + '</div>'); 262 263 var $node = jQuery(node); 264 if (!$node.hasClass('needs-validation')) 265 { 266 $node.addClass('needs-validation').on('blur', function() { jQuery(this).removeClass('invalid') }); 267 } 268 $node.addClass('invalid'); 269 }); 270 };
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.