1(function( $ ) { 2 'use strict'; 3 4 /** 5 * All of the code for your public-facing JavaScript source 6 * should reside in this file. 7 * 8 * Note: It has been assumed you will write jQuery code here, so the 9 * $ function reference has been prepared for usage within the scope 10 * of this function. 11 * 12 * This enables you to define handlers, for when the DOM is ready: 13 * 14 * $(function() { 15 * 16 * }); 17 * 18 * When the window is loaded: 19 * 20 * $( window ).load(function() { 21 * 22 * }); 23 * 24 * ...and/or other possibilities. 25 * 26 * Ideally, it is not considered best practise to attach more than a 27 * single DOM-ready or window-load handler for a particular page. 28 * Although scripts in the WordPress core, Plugins and Themes may be 29 * practising this, we should strive to set a better example in our own work. 30 */ 31 32 // Check if the document is ready. 33 $( function() { 34 35 // For each "read more" element, i.e., review... 36 $( ".rmwp-button-wrap" ).each( function(){ 37 38 // Display the Read More button. 39 $( this ).show(); 40 }); 41 }); 42 43})( jQuery ); 44 45// Define the onclick action event for the Read More button. 46function rmwpToggleElements( textToggle, buttonWrap, buttonToggle, buttonToggleText, moreLabel, lessLabel, ellipsis ){ 47 48 // Toggle the text wrapper's "open" class. 49 textToggle.toggleClass( 'open' ); 50 51 // Toggle the button's "open" class. 52 buttonToggle.toggleClass( 'open' ); 53 54 // If the button text says 'Read More'... 55 if( buttonToggleText == moreLabel ){ 56 57 // Change the button text to 'Read Less'. 58 jQuery( buttonToggle ).text( lessLabel ) 59 60 // Move button to the end of the toggled text. 61 //buttonWrap.insertAfter( textToggle.next( '.rmwp-toggle-end' ) ); 62 textToggle.next( '.rmwp-toggle-end' ).append( buttonWrap ); 63 64 } else{ 65 66 // Otherwise, change the button text to 'Read More'. 67 jQuery( buttonToggle ).text( moreLabel ) 68 69 // Move button to the toggled text break point. 70 buttonWrap.insertAfter( ellipsis ); 71 } 72 73 // Toggle the button visibility. 74 buttonToggle.toggle(); 75} 76 77// Define the onclick action event for the Read More button. 78function rmwpButtonAction( rmwpID, moreLabel, lessLabel ){ 79 80 // Define targets. 81 var textToggle = jQuery( '#rmwp-toggle-' + rmwpID ); 82 var ellipsis = jQuery( '#ellipsis-' + rmwpID ); 83 var buttonWrap = jQuery( '#rmwp-button-wrap-' + rmwpID ); 84 var buttonToggle = buttonWrap.children( "button" ); 85 var buttonToggleText = buttonToggle.text(); 86 87 // Toggle the text visibility. 88 jQuery( textToggle ).toggle(); 89 90 // Toggle the ellipsis visibility. 91 ellipsis.toggle(); 92 93 // Toggle the button visibility. 94 buttonToggle.toggle(); 95 96 // Toggle the other elements. 97 rmwpToggleElements( 98 textToggle, 99 buttonWrap, 100 buttonToggle, 101 buttonToggleText, 102 moreLabel, 103 lessLabel, 104 ellipsis 105 ) 106}
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.