Edit File by line
/home/barbar84/www/wp-admin/js
File: theme.js
[1000] Fix | Delete
$devices.find( 'button.preview-' + newDevice )
[1001] Fix | Delete
.addClass( 'active' )
[1002] Fix | Delete
.attr( 'aria-pressed', true );
[1003] Fix | Delete
},
[1004] Fix | Delete
[1005] Fix | Delete
keyEvent: function( event ) {
[1006] Fix | Delete
// The escape key closes the preview.
[1007] Fix | Delete
if ( event.keyCode === 27 ) {
[1008] Fix | Delete
this.undelegateEvents();
[1009] Fix | Delete
this.close();
[1010] Fix | Delete
}
[1011] Fix | Delete
// The right arrow key, next theme.
[1012] Fix | Delete
if ( event.keyCode === 39 ) {
[1013] Fix | Delete
_.once( this.nextTheme() );
[1014] Fix | Delete
}
[1015] Fix | Delete
[1016] Fix | Delete
// The left arrow key, previous theme.
[1017] Fix | Delete
if ( event.keyCode === 37 ) {
[1018] Fix | Delete
this.previousTheme();
[1019] Fix | Delete
}
[1020] Fix | Delete
},
[1021] Fix | Delete
[1022] Fix | Delete
installTheme: function( event ) {
[1023] Fix | Delete
var _this = this,
[1024] Fix | Delete
$target = $( event.target );
[1025] Fix | Delete
event.preventDefault();
[1026] Fix | Delete
[1027] Fix | Delete
if ( $target.hasClass( 'disabled' ) ) {
[1028] Fix | Delete
return;
[1029] Fix | Delete
}
[1030] Fix | Delete
[1031] Fix | Delete
wp.updates.maybeRequestFilesystemCredentials( event );
[1032] Fix | Delete
[1033] Fix | Delete
$( document ).on( 'wp-theme-install-success', function() {
[1034] Fix | Delete
_this.model.set( { 'installed': true } );
[1035] Fix | Delete
} );
[1036] Fix | Delete
[1037] Fix | Delete
wp.updates.installTheme( {
[1038] Fix | Delete
slug: $target.data( 'slug' )
[1039] Fix | Delete
} );
[1040] Fix | Delete
}
[1041] Fix | Delete
});
[1042] Fix | Delete
[1043] Fix | Delete
// Controls the rendering of div.themes,
[1044] Fix | Delete
// a wrapper that will hold all the theme elements.
[1045] Fix | Delete
themes.view.Themes = wp.Backbone.View.extend({
[1046] Fix | Delete
[1047] Fix | Delete
className: 'themes wp-clearfix',
[1048] Fix | Delete
$overlay: $( 'div.theme-overlay' ),
[1049] Fix | Delete
[1050] Fix | Delete
// Number to keep track of scroll position
[1051] Fix | Delete
// while in theme-overlay mode.
[1052] Fix | Delete
index: 0,
[1053] Fix | Delete
[1054] Fix | Delete
// The theme count element.
[1055] Fix | Delete
count: $( '.wrap .theme-count' ),
[1056] Fix | Delete
[1057] Fix | Delete
// The live themes count.
[1058] Fix | Delete
liveThemeCount: 0,
[1059] Fix | Delete
[1060] Fix | Delete
initialize: function( options ) {
[1061] Fix | Delete
var self = this;
[1062] Fix | Delete
[1063] Fix | Delete
// Set up parent.
[1064] Fix | Delete
this.parent = options.parent;
[1065] Fix | Delete
[1066] Fix | Delete
// Set current view to [grid].
[1067] Fix | Delete
this.setView( 'grid' );
[1068] Fix | Delete
[1069] Fix | Delete
// Move the active theme to the beginning of the collection.
[1070] Fix | Delete
self.currentTheme();
[1071] Fix | Delete
[1072] Fix | Delete
// When the collection is updated by user input...
[1073] Fix | Delete
this.listenTo( self.collection, 'themes:update', function() {
[1074] Fix | Delete
self.parent.page = 0;
[1075] Fix | Delete
self.currentTheme();
[1076] Fix | Delete
self.render( this );
[1077] Fix | Delete
} );
[1078] Fix | Delete
[1079] Fix | Delete
// Update theme count to full result set when available.
[1080] Fix | Delete
this.listenTo( self.collection, 'query:success', function( count ) {
[1081] Fix | Delete
if ( _.isNumber( count ) ) {
[1082] Fix | Delete
self.count.text( count );
[1083] Fix | Delete
self.announceSearchResults( count );
[1084] Fix | Delete
} else {
[1085] Fix | Delete
self.count.text( self.collection.length );
[1086] Fix | Delete
self.announceSearchResults( self.collection.length );
[1087] Fix | Delete
}
[1088] Fix | Delete
});
[1089] Fix | Delete
[1090] Fix | Delete
this.listenTo( self.collection, 'query:empty', function() {
[1091] Fix | Delete
$( 'body' ).addClass( 'no-results' );
[1092] Fix | Delete
});
[1093] Fix | Delete
[1094] Fix | Delete
this.listenTo( this.parent, 'theme:scroll', function() {
[1095] Fix | Delete
self.renderThemes( self.parent.page );
[1096] Fix | Delete
});
[1097] Fix | Delete
[1098] Fix | Delete
this.listenTo( this.parent, 'theme:close', function() {
[1099] Fix | Delete
if ( self.overlay ) {
[1100] Fix | Delete
self.overlay.closeOverlay();
[1101] Fix | Delete
}
[1102] Fix | Delete
} );
[1103] Fix | Delete
[1104] Fix | Delete
// Bind keyboard events.
[1105] Fix | Delete
$( 'body' ).on( 'keyup', function( event ) {
[1106] Fix | Delete
if ( ! self.overlay ) {
[1107] Fix | Delete
return;
[1108] Fix | Delete
}
[1109] Fix | Delete
[1110] Fix | Delete
// Bail if the filesystem credentials dialog is shown.
[1111] Fix | Delete
if ( $( '#request-filesystem-credentials-dialog' ).is( ':visible' ) ) {
[1112] Fix | Delete
return;
[1113] Fix | Delete
}
[1114] Fix | Delete
[1115] Fix | Delete
// Pressing the right arrow key fires a theme:next event.
[1116] Fix | Delete
if ( event.keyCode === 39 ) {
[1117] Fix | Delete
self.overlay.nextTheme();
[1118] Fix | Delete
}
[1119] Fix | Delete
[1120] Fix | Delete
// Pressing the left arrow key fires a theme:previous event.
[1121] Fix | Delete
if ( event.keyCode === 37 ) {
[1122] Fix | Delete
self.overlay.previousTheme();
[1123] Fix | Delete
}
[1124] Fix | Delete
[1125] Fix | Delete
// Pressing the escape key fires a theme:collapse event.
[1126] Fix | Delete
if ( event.keyCode === 27 ) {
[1127] Fix | Delete
self.overlay.collapse( event );
[1128] Fix | Delete
}
[1129] Fix | Delete
});
[1130] Fix | Delete
},
[1131] Fix | Delete
[1132] Fix | Delete
// Manages rendering of theme pages
[1133] Fix | Delete
// and keeping theme count in sync.
[1134] Fix | Delete
render: function() {
[1135] Fix | Delete
// Clear the DOM, please.
[1136] Fix | Delete
this.$el.empty();
[1137] Fix | Delete
[1138] Fix | Delete
// If the user doesn't have switch capabilities or there is only one theme
[1139] Fix | Delete
// in the collection, render the detailed view of the active theme.
[1140] Fix | Delete
if ( themes.data.themes.length === 1 ) {
[1141] Fix | Delete
[1142] Fix | Delete
// Constructs the view.
[1143] Fix | Delete
this.singleTheme = new themes.view.Details({
[1144] Fix | Delete
model: this.collection.models[0]
[1145] Fix | Delete
});
[1146] Fix | Delete
[1147] Fix | Delete
// Render and apply a 'single-theme' class to our container.
[1148] Fix | Delete
this.singleTheme.render();
[1149] Fix | Delete
this.$el.addClass( 'single-theme' );
[1150] Fix | Delete
this.$el.append( this.singleTheme.el );
[1151] Fix | Delete
}
[1152] Fix | Delete
[1153] Fix | Delete
// Generate the themes using page instance
[1154] Fix | Delete
// while checking the collection has items.
[1155] Fix | Delete
if ( this.options.collection.size() > 0 ) {
[1156] Fix | Delete
this.renderThemes( this.parent.page );
[1157] Fix | Delete
}
[1158] Fix | Delete
[1159] Fix | Delete
// Display a live theme count for the collection.
[1160] Fix | Delete
this.liveThemeCount = this.collection.count ? this.collection.count : this.collection.length;
[1161] Fix | Delete
this.count.text( this.liveThemeCount );
[1162] Fix | Delete
[1163] Fix | Delete
/*
[1164] Fix | Delete
* In the theme installer the themes count is already announced
[1165] Fix | Delete
* because `announceSearchResults` is called on `query:success`.
[1166] Fix | Delete
*/
[1167] Fix | Delete
if ( ! themes.isInstall ) {
[1168] Fix | Delete
this.announceSearchResults( this.liveThemeCount );
[1169] Fix | Delete
}
[1170] Fix | Delete
},
[1171] Fix | Delete
[1172] Fix | Delete
// Iterates through each instance of the collection
[1173] Fix | Delete
// and renders each theme module.
[1174] Fix | Delete
renderThemes: function( page ) {
[1175] Fix | Delete
var self = this;
[1176] Fix | Delete
[1177] Fix | Delete
self.instance = self.collection.paginate( page );
[1178] Fix | Delete
[1179] Fix | Delete
// If we have no more themes, bail.
[1180] Fix | Delete
if ( self.instance.size() === 0 ) {
[1181] Fix | Delete
// Fire a no-more-themes event.
[1182] Fix | Delete
this.parent.trigger( 'theme:end' );
[1183] Fix | Delete
return;
[1184] Fix | Delete
}
[1185] Fix | Delete
[1186] Fix | Delete
// Make sure the add-new stays at the end.
[1187] Fix | Delete
if ( ! themes.isInstall && page >= 1 ) {
[1188] Fix | Delete
$( '.add-new-theme' ).remove();
[1189] Fix | Delete
}
[1190] Fix | Delete
[1191] Fix | Delete
// Loop through the themes and setup each theme view.
[1192] Fix | Delete
self.instance.each( function( theme ) {
[1193] Fix | Delete
self.theme = new themes.view.Theme({
[1194] Fix | Delete
model: theme,
[1195] Fix | Delete
parent: self
[1196] Fix | Delete
});
[1197] Fix | Delete
[1198] Fix | Delete
// Render the views...
[1199] Fix | Delete
self.theme.render();
[1200] Fix | Delete
// ...and append them to div.themes.
[1201] Fix | Delete
self.$el.append( self.theme.el );
[1202] Fix | Delete
[1203] Fix | Delete
// Binds to theme:expand to show the modal box
[1204] Fix | Delete
// with the theme details.
[1205] Fix | Delete
self.listenTo( self.theme, 'theme:expand', self.expand, self );
[1206] Fix | Delete
});
[1207] Fix | Delete
[1208] Fix | Delete
// 'Add new theme' element shown at the end of the grid.
[1209] Fix | Delete
if ( ! themes.isInstall && themes.data.settings.canInstall ) {
[1210] Fix | Delete
this.$el.append( '<div class="theme add-new-theme"><a href="' + themes.data.settings.installURI + '"><div class="theme-screenshot"><span></span></div><h2 class="theme-name">' + l10n.addNew + '</h2></a></div>' );
[1211] Fix | Delete
}
[1212] Fix | Delete
[1213] Fix | Delete
this.parent.page++;
[1214] Fix | Delete
},
[1215] Fix | Delete
[1216] Fix | Delete
// Grabs current theme and puts it at the beginning of the collection.
[1217] Fix | Delete
currentTheme: function() {
[1218] Fix | Delete
var self = this,
[1219] Fix | Delete
current;
[1220] Fix | Delete
[1221] Fix | Delete
current = self.collection.findWhere({ active: true });
[1222] Fix | Delete
[1223] Fix | Delete
// Move the active theme to the beginning of the collection.
[1224] Fix | Delete
if ( current ) {
[1225] Fix | Delete
self.collection.remove( current );
[1226] Fix | Delete
self.collection.add( current, { at:0 } );
[1227] Fix | Delete
}
[1228] Fix | Delete
},
[1229] Fix | Delete
[1230] Fix | Delete
// Sets current view.
[1231] Fix | Delete
setView: function( view ) {
[1232] Fix | Delete
return view;
[1233] Fix | Delete
},
[1234] Fix | Delete
[1235] Fix | Delete
// Renders the overlay with the ThemeDetails view.
[1236] Fix | Delete
// Uses the current model data.
[1237] Fix | Delete
expand: function( id ) {
[1238] Fix | Delete
var self = this, $card, $modal;
[1239] Fix | Delete
[1240] Fix | Delete
// Set the current theme model.
[1241] Fix | Delete
this.model = self.collection.get( id );
[1242] Fix | Delete
[1243] Fix | Delete
// Trigger a route update for the current model.
[1244] Fix | Delete
themes.router.navigate( themes.router.baseUrl( themes.router.themePath + this.model.id ) );
[1245] Fix | Delete
[1246] Fix | Delete
// Sets this.view to 'detail'.
[1247] Fix | Delete
this.setView( 'detail' );
[1248] Fix | Delete
$( 'body' ).addClass( 'modal-open' );
[1249] Fix | Delete
[1250] Fix | Delete
// Set up the theme details view.
[1251] Fix | Delete
this.overlay = new themes.view.Details({
[1252] Fix | Delete
model: self.model
[1253] Fix | Delete
});
[1254] Fix | Delete
[1255] Fix | Delete
this.overlay.render();
[1256] Fix | Delete
[1257] Fix | Delete
if ( this.model.get( 'hasUpdate' ) ) {
[1258] Fix | Delete
$card = $( '[data-slug="' + this.model.id + '"]' );
[1259] Fix | Delete
$modal = $( this.overlay.el );
[1260] Fix | Delete
[1261] Fix | Delete
if ( $card.find( '.updating-message' ).length ) {
[1262] Fix | Delete
$modal.find( '.notice-warning h3' ).remove();
[1263] Fix | Delete
$modal.find( '.notice-warning' )
[1264] Fix | Delete
.removeClass( 'notice-large' )
[1265] Fix | Delete
.addClass( 'updating-message' )
[1266] Fix | Delete
.find( 'p' ).text( wp.updates.l10n.updating );
[1267] Fix | Delete
} else if ( $card.find( '.notice-error' ).length ) {
[1268] Fix | Delete
$modal.find( '.notice-warning' ).remove();
[1269] Fix | Delete
}
[1270] Fix | Delete
}
[1271] Fix | Delete
[1272] Fix | Delete
this.$overlay.html( this.overlay.el );
[1273] Fix | Delete
[1274] Fix | Delete
// Bind to theme:next and theme:previous triggered by the arrow keys.
[1275] Fix | Delete
// Keep track of the current model so we can infer an index position.
[1276] Fix | Delete
this.listenTo( this.overlay, 'theme:next', function() {
[1277] Fix | Delete
// Renders the next theme on the overlay.
[1278] Fix | Delete
self.next( [ self.model.cid ] );
[1279] Fix | Delete
[1280] Fix | Delete
})
[1281] Fix | Delete
.listenTo( this.overlay, 'theme:previous', function() {
[1282] Fix | Delete
// Renders the previous theme on the overlay.
[1283] Fix | Delete
self.previous( [ self.model.cid ] );
[1284] Fix | Delete
});
[1285] Fix | Delete
},
[1286] Fix | Delete
[1287] Fix | Delete
/*
[1288] Fix | Delete
* This method renders the next theme on the overlay modal
[1289] Fix | Delete
* based on the current position in the collection.
[1290] Fix | Delete
*
[1291] Fix | Delete
* @params [model cid]
[1292] Fix | Delete
*/
[1293] Fix | Delete
next: function( args ) {
[1294] Fix | Delete
var self = this,
[1295] Fix | Delete
model, nextModel;
[1296] Fix | Delete
[1297] Fix | Delete
// Get the current theme.
[1298] Fix | Delete
model = self.collection.get( args[0] );
[1299] Fix | Delete
// Find the next model within the collection.
[1300] Fix | Delete
nextModel = self.collection.at( self.collection.indexOf( model ) + 1 );
[1301] Fix | Delete
[1302] Fix | Delete
// Sanity check which also serves as a boundary test.
[1303] Fix | Delete
if ( nextModel !== undefined ) {
[1304] Fix | Delete
[1305] Fix | Delete
// We have a new theme...
[1306] Fix | Delete
// Close the overlay.
[1307] Fix | Delete
this.overlay.closeOverlay();
[1308] Fix | Delete
[1309] Fix | Delete
// Trigger a route update for the current model.
[1310] Fix | Delete
self.theme.trigger( 'theme:expand', nextModel.cid );
[1311] Fix | Delete
[1312] Fix | Delete
}
[1313] Fix | Delete
},
[1314] Fix | Delete
[1315] Fix | Delete
/*
[1316] Fix | Delete
* This method renders the previous theme on the overlay modal
[1317] Fix | Delete
* based on the current position in the collection.
[1318] Fix | Delete
*
[1319] Fix | Delete
* @params [model cid]
[1320] Fix | Delete
*/
[1321] Fix | Delete
previous: function( args ) {
[1322] Fix | Delete
var self = this,
[1323] Fix | Delete
model, previousModel;
[1324] Fix | Delete
[1325] Fix | Delete
// Get the current theme.
[1326] Fix | Delete
model = self.collection.get( args[0] );
[1327] Fix | Delete
// Find the previous model within the collection.
[1328] Fix | Delete
previousModel = self.collection.at( self.collection.indexOf( model ) - 1 );
[1329] Fix | Delete
[1330] Fix | Delete
if ( previousModel !== undefined ) {
[1331] Fix | Delete
[1332] Fix | Delete
// We have a new theme...
[1333] Fix | Delete
// Close the overlay.
[1334] Fix | Delete
this.overlay.closeOverlay();
[1335] Fix | Delete
[1336] Fix | Delete
// Trigger a route update for the current model.
[1337] Fix | Delete
self.theme.trigger( 'theme:expand', previousModel.cid );
[1338] Fix | Delete
[1339] Fix | Delete
}
[1340] Fix | Delete
},
[1341] Fix | Delete
[1342] Fix | Delete
// Dispatch audible search results feedback message.
[1343] Fix | Delete
announceSearchResults: function( count ) {
[1344] Fix | Delete
if ( 0 === count ) {
[1345] Fix | Delete
wp.a11y.speak( l10n.noThemesFound );
[1346] Fix | Delete
} else {
[1347] Fix | Delete
wp.a11y.speak( l10n.themesFound.replace( '%d', count ) );
[1348] Fix | Delete
}
[1349] Fix | Delete
}
[1350] Fix | Delete
});
[1351] Fix | Delete
[1352] Fix | Delete
// Search input view controller.
[1353] Fix | Delete
themes.view.Search = wp.Backbone.View.extend({
[1354] Fix | Delete
[1355] Fix | Delete
tagName: 'input',
[1356] Fix | Delete
className: 'wp-filter-search',
[1357] Fix | Delete
id: 'wp-filter-search-input',
[1358] Fix | Delete
searching: false,
[1359] Fix | Delete
[1360] Fix | Delete
attributes: {
[1361] Fix | Delete
placeholder: l10n.searchPlaceholder,
[1362] Fix | Delete
type: 'search',
[1363] Fix | Delete
'aria-describedby': 'live-search-desc'
[1364] Fix | Delete
},
[1365] Fix | Delete
[1366] Fix | Delete
events: {
[1367] Fix | Delete
'input': 'search',
[1368] Fix | Delete
'keyup': 'search',
[1369] Fix | Delete
'blur': 'pushState'
[1370] Fix | Delete
},
[1371] Fix | Delete
[1372] Fix | Delete
initialize: function( options ) {
[1373] Fix | Delete
[1374] Fix | Delete
this.parent = options.parent;
[1375] Fix | Delete
[1376] Fix | Delete
this.listenTo( this.parent, 'theme:close', function() {
[1377] Fix | Delete
this.searching = false;
[1378] Fix | Delete
} );
[1379] Fix | Delete
[1380] Fix | Delete
},
[1381] Fix | Delete
[1382] Fix | Delete
search: function( event ) {
[1383] Fix | Delete
// Clear on escape.
[1384] Fix | Delete
if ( event.type === 'keyup' && event.which === 27 ) {
[1385] Fix | Delete
event.target.value = '';
[1386] Fix | Delete
}
[1387] Fix | Delete
[1388] Fix | Delete
// Since doSearch is debounced, it will only run when user input comes to a rest.
[1389] Fix | Delete
this.doSearch( event );
[1390] Fix | Delete
},
[1391] Fix | Delete
[1392] Fix | Delete
// Runs a search on the theme collection.
[1393] Fix | Delete
doSearch: function( event ) {
[1394] Fix | Delete
var options = {};
[1395] Fix | Delete
[1396] Fix | Delete
this.collection.doSearch( event.target.value.replace( /\+/g, ' ' ) );
[1397] Fix | Delete
[1398] Fix | Delete
// if search is initiated and key is not return.
[1399] Fix | Delete
if ( this.searching && event.which !== 13 ) {
[1400] Fix | Delete
options.replace = true;
[1401] Fix | Delete
} else {
[1402] Fix | Delete
this.searching = true;
[1403] Fix | Delete
}
[1404] Fix | Delete
[1405] Fix | Delete
// Update the URL hash.
[1406] Fix | Delete
if ( event.target.value ) {
[1407] Fix | Delete
themes.router.navigate( themes.router.baseUrl( themes.router.searchPath + event.target.value ), options );
[1408] Fix | Delete
} else {
[1409] Fix | Delete
themes.router.navigate( themes.router.baseUrl( '' ) );
[1410] Fix | Delete
}
[1411] Fix | Delete
},
[1412] Fix | Delete
[1413] Fix | Delete
pushState: function( event ) {
[1414] Fix | Delete
var url = themes.router.baseUrl( '' );
[1415] Fix | Delete
[1416] Fix | Delete
if ( event.target.value ) {
[1417] Fix | Delete
url = themes.router.baseUrl( themes.router.searchPath + encodeURIComponent( event.target.value ) );
[1418] Fix | Delete
}
[1419] Fix | Delete
[1420] Fix | Delete
this.searching = false;
[1421] Fix | Delete
themes.router.navigate( url );
[1422] Fix | Delete
[1423] Fix | Delete
}
[1424] Fix | Delete
});
[1425] Fix | Delete
[1426] Fix | Delete
/**
[1427] Fix | Delete
* Navigate router.
[1428] Fix | Delete
*
[1429] Fix | Delete
* @since 4.9.0
[1430] Fix | Delete
*
[1431] Fix | Delete
* @param {string} url - URL to navigate to.
[1432] Fix | Delete
* @param {Object} state - State.
[1433] Fix | Delete
* @return {void}
[1434] Fix | Delete
*/
[1435] Fix | Delete
function navigateRouter( url, state ) {
[1436] Fix | Delete
var router = this;
[1437] Fix | Delete
if ( Backbone.history._hasPushState ) {
[1438] Fix | Delete
Backbone.Router.prototype.navigate.call( router, url, state );
[1439] Fix | Delete
}
[1440] Fix | Delete
}
[1441] Fix | Delete
[1442] Fix | Delete
// Sets up the routes events for relevant url queries.
[1443] Fix | Delete
// Listens to [theme] and [search] params.
[1444] Fix | Delete
themes.Router = Backbone.Router.extend({
[1445] Fix | Delete
[1446] Fix | Delete
routes: {
[1447] Fix | Delete
'themes.php?theme=:slug': 'theme',
[1448] Fix | Delete
'themes.php?search=:query': 'search',
[1449] Fix | Delete
'themes.php?s=:query': 'search',
[1450] Fix | Delete
'themes.php': 'themes',
[1451] Fix | Delete
'': 'themes'
[1452] Fix | Delete
},
[1453] Fix | Delete
[1454] Fix | Delete
baseUrl: function( url ) {
[1455] Fix | Delete
return 'themes.php' + url;
[1456] Fix | Delete
},
[1457] Fix | Delete
[1458] Fix | Delete
themePath: '?theme=',
[1459] Fix | Delete
searchPath: '?search=',
[1460] Fix | Delete
[1461] Fix | Delete
search: function( query ) {
[1462] Fix | Delete
$( '.wp-filter-search' ).val( query.replace( /\+/g, ' ' ) );
[1463] Fix | Delete
},
[1464] Fix | Delete
[1465] Fix | Delete
themes: function() {
[1466] Fix | Delete
$( '.wp-filter-search' ).val( '' );
[1467] Fix | Delete
},
[1468] Fix | Delete
[1469] Fix | Delete
navigate: navigateRouter
[1470] Fix | Delete
[1471] Fix | Delete
});
[1472] Fix | Delete
[1473] Fix | Delete
// Execute and setup the application.
[1474] Fix | Delete
themes.Run = {
[1475] Fix | Delete
init: function() {
[1476] Fix | Delete
// Initializes the blog's theme library view.
[1477] Fix | Delete
// Create a new collection with data.
[1478] Fix | Delete
this.themes = new themes.Collection( themes.data.themes );
[1479] Fix | Delete
[1480] Fix | Delete
// Set up the view.
[1481] Fix | Delete
this.view = new themes.view.Appearance({
[1482] Fix | Delete
collection: this.themes
[1483] Fix | Delete
});
[1484] Fix | Delete
[1485] Fix | Delete
this.render();
[1486] Fix | Delete
[1487] Fix | Delete
// Start debouncing user searches after Backbone.history.start().
[1488] Fix | Delete
this.view.SearchView.doSearch = _.debounce( this.view.SearchView.doSearch, 500 );
[1489] Fix | Delete
},
[1490] Fix | Delete
[1491] Fix | Delete
render: function() {
[1492] Fix | Delete
[1493] Fix | Delete
// Render results.
[1494] Fix | Delete
this.view.render();
[1495] Fix | Delete
this.routes();
[1496] Fix | Delete
[1497] Fix | Delete
if ( Backbone.History.started ) {
[1498] Fix | Delete
Backbone.history.stop();
[1499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function