PageSourceSearch

https://www.shopjyf.com/js/review.js

js shopjyf.com collected 2026-09-24 14:18:21 UTC 3,558 bytes, 100 lines download raw bytes

1//Review Javascript Functions
2jQueryCheck();
3
4const reviewFunctions = {}; 
5reviewFunctions.perPage = 4;
6
7reviewFunctions.writeReviewModal = function(elem){  
8    var theStyle = $(elem).data('styleid');
9    var toCommit = $(elem).data('commit');
10    
11    var theDom = $(elem).parents('.modal-content').find('#reviewForm');
12    var theForm = {};
13    
14    console.log(theDom);
15    
16    if(theDom !== undefined && theDom.length){
17        theForm = siteValidation.processForm(theDom);
18
19        for (const key in theForm) {
20           if(typeof theForm[key] === 'boolean' && !theForm[key]){
21               //Something failed validation
22               console.log('Failure: ' + key);
23               return false;
24           }
25        }
26        
27        theForm = JSON.stringify(theForm);
28    }
29    
30    $.post('/index.cfm?action=writeReviewModal',{style_id:theStyle,commit:toCommit,theForm:theForm},function(data){	
31		showModal(data['HEADER'],data['BODY'],data['FOOTER'],(data['ISBIG'] === 'true' || data['ISBIG']));
32	},'JSON');	
33}
34reviewFunctions.setStar = function(rating){
35    $('#reviewForm #rating').val(rating);
36    $('#reviewForm .ratingStarHolder .reviewStar').each(function(){
37        if($(this).data('rating') <= rating){
38            $(this).addClass('active');
39        } else {
40            $(this).removeClass('active');
41        }
42    });
43}
44reviewFunctions.setStarM = function(rating){
45    $('#writeReviewForm #rating').val(rating);
46    $('#writeReviewForm .ratingStarHolder .reviewStar').each(function(){
47        if($(this).data('rating') <= rating){
48            $(this).addClass('active');
49        } else {
50            $(this).removeClass('active');
51        }
52    });
53}
54
55reviewFunctions.submitreview = function(elem){  
56    var theStyle =  $(elem).data('styleid');
57    var toCommit = 1;
58    var reviewText = $('#review').val();
59    var rating = $('#rating').val();
60    
61    if(reviewText.length < 5){
62        alert('Enter Review');
63        return false;
64    }
65    
66    $.post('/index.cfm?action=writeReviewModalNew',{style_id:theStyle,commit:toCommit,reviewText:reviewText,rating:rating},function(data){	
67		showModal(data['HEADER'],data['BODY'],data['FOOTER'],(data['ISBIG'] === 'true' || data['ISBIG']));
68	},'JSON');	
69}
70reviewFunctions.filterReviewsByRating = function(rating){
71    $('.reviewItemHolder .userReview').each(function(){
72        if($(this).data('rating') == rating){
73            $(this).removeClass('d-none');
74        } else {
75            $(this).addClass('d-none');
76        }
77    });
78}
79reviewFunctions.changeSort = function(elem){  
80    var theStyle = $(elem).parents('.reviewContainer').data('styleid');
81    var theWebStyle = $(elem).parents('.reviewContainer').data('webstyle');
82    var theSort = $(elem).parent().data('sortkey');
83    var theNegation = $(elem).parent().data('reverse');
84    
85    if(theNegation) {
86        theSort += '-alt'
87    }
88    $.post('/index.cfm?action=reviewDisplay',{style_id:theStyle,web_style:theWebStyle,order_by:theSort},function(data){	
89        $('.reviewStats').html(data['STARDISPLAY']);
90        $('.reviewEntries').html(data['REVIEWDISPLAY']);
91	},'JSON');
92}
93reviewFunctions.detailModal = function(elem){ 
94    var theID = $(elem).parents('.userReview').data('id');
95    
96    $.post('/index.cfm?action=quickViewReview',{product_review_id:theID,is_admin:0},function(data){	
97		showModal(data['HEADER'],data['BODY'],data['FOOTER'],(data['ISBIG'] === 'true' || data['ISBIG']));
98	},'JSON');	
99    return false;
100}

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.