Changeset 2548
- Timestamp:
- 02/22/2016 10:24:37 PM (8 years ago)
- Location:
- sites/trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/js/rosetta-roles.js
r2544 r2548 87 87 id: 0, 88 88 name: '', 89 checked: false 89 checked: false, 90 matchScore: 0 90 91 }, 91 92 … … 100 101 // Search terms 101 102 terms: '', 103 104 _sortBy: 'checked', 102 105 103 106 initialize: function( models, options ) { … … 151 154 results = this.filter( function( project ) { 152 155 var haystack = _.union( [ project.get( 'name' ), project.get( 'slug' ) ] ); 153 return match.test( haystack ); 154 }); 155 156 if ( match.test( haystack ) ) { 157 _.each( haystack, function( word ) { 158 var score = word.score( term ); 159 project.set( 'matchScore', Math.max( score, project.get( 'matchScore' ) ) ); 160 }); 161 return true; 162 } 163 return false; 164 }); 165 166 this._sortBy = 'matchScore'; 156 167 this.reset( results ); 168 this._sortBy = 'checked'; 157 169 }, 158 170 159 171 comparator: function( project ) { 160 return - project.get( 'checked');172 return - project.get( this._sortBy ); 161 173 } 162 174 }); -
sites/trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/rosetta-roles.php
r2547 r2548 188 188 */ 189 189 public function enqueue_scripts() { 190 wp_enqueue_script( 'rosetta-roles', plugins_url( '/js/rosetta-roles.js', __FILE__ ), array( 'jquery', 'wp-backbone' ), '6', true ); 190 wp_enqueue_script( 'string_score', plugins_url( '/js/string_score.min.js', __FILE__ ), array(), '0.1.22', true ); 191 wp_enqueue_script( 'rosetta-roles', plugins_url( '/js/rosetta-roles.js', __FILE__ ), array( 'jquery', 'wp-backbone', 'string_score' ), '6', true ); 191 192 } 192 193
Note: See TracChangeset
for help on using the changeset viewer.