forked from leftypol/leftypol
Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
facd183304 | |||
40bbda5027 |
1 changed files with 5 additions and 5 deletions
|
@ -23,20 +23,20 @@ function addBoard(){
|
|||
add_favorites();
|
||||
} //This adds the text inside the textbox to favorites, localStorage.favorites and the page
|
||||
|
||||
var favorites = JSON.parse(localStorage.favorites);
|
||||
var favorites = localStorage.favorites ? JSON.parse(localStorage.favorites) : [];
|
||||
Options.add_tab('fav-tab','star',_("Favorites"));
|
||||
|
||||
//Pregenerating list of boards
|
||||
//Pregenerating list of boards
|
||||
var favList = $('<div id="sortable" style="cursor: pointer; display: inline-block">');
|
||||
for(var i=0; i<favorites.length; i++){
|
||||
favList.append( $('<div>'+favorites[i]+'</div>') );
|
||||
}
|
||||
}
|
||||
|
||||
//Creating list of minus symbols to remove unwanted boards
|
||||
var minusList = $('<div id="minusList" style="color: #0000FF; display: inline-block">');
|
||||
for(var i=0; i<favorites.length; i++){
|
||||
minusList.append( $('<div data-board="'+i+'" style="cursor: pointer; margin-right: 5px">-</div>').on('click', function(e){removeBoard($(this).data('board'));}) );
|
||||
}
|
||||
}
|
||||
|
||||
//Help message so people understand how sorting boards works
|
||||
$("<span>"+_("Drag the boards to sort them.")+"</span><br><br>").appendTo(Options.get_tab('fav-tab').content);
|
||||
|
@ -65,7 +65,7 @@ addDiv.appendTo(Options.get_tab('fav-tab').content); //Adding the plus button
|
|||
|
||||
favList.sortable(); //Making boards with sortable id use the sortable jquery function
|
||||
favList.on('sortstop', function() {
|
||||
favorites = generateList();
|
||||
favorites = generateList();
|
||||
localStorage.favorites = JSON.stringify(favorites);
|
||||
add_favorites();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue