Installation
Plugin's js code Minified version of the js file Plugin's stylesheet A CSS reset stylesheet A sprite pgn file for the remove list item image |
The cleanslate.css is a CSS reset stylesheet, for aggressively resetting the styling of an element and its children. It helps protecting the default anonymousLists styling from being overruled by other existing CSS styles. It is particularly helpful for widgets and plugins. It is written by Premasagar Rose and you can find more about it in its own site on github/premasager/cleanslate. The remSprite.png is just a sprite for the remove list item button image. Of course, you can and you are advised to change the default styling to match your own site's style. You will find plenty of classes for changing almost everything inside the anonymousLists stylesheet.
After you download the files above, you need to include them to your pages, along with the jQuery lib.
<link rel="Stylesheet" href="styles/cleanslate.css" />
<link rel="Stylesheet" href="styles/jquery.anonymousLists.css" />
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="scripts/jquery.anonymousLists.min.js"></script>
Example use
var hist = tabsHolder("#history").anonymousLists();
var hist = tabsHolder("#history").anonymousLists({
id: "anonLists",
lists: ["History", "Favorites"]
});
// You can add a list item by passing its values to the addTolist method
hist.anonymousLists("addToList", "Favorites",
"American Hustle",
"http://www.imdb.com/title/tt1800241/?ref_=nv_sr_1",
"Christian Bale, Amy Adams, Bradley Cooper");
// Or you can create a list item and then, pass it to the addItemToList method
var movie = {
title: "The Wolf of Wall Street",
url: "http://www.imdb.com/title/tt0993846/?ref_=nv_sr_1",
info: "Leonardo DiCaprio, Jonah Hill, Margot Robbie"
};
hist.anonymousLists("addItemToList", "Favorites", movie);
movie = {
title: "Heat",
url: "http://www.imdb.com/title/tt0113277/?ref_=nv_sr_4",
info: "Al Pacino, Robert De Niro, Val Kilmer"
};
hist.anonymousLists("addItemToList", "Favorites", movie);
var hist = tabsHolder("#history").anonymousLists({
id: "anonLists",
lists: ["History", "Favorites"],
deleteItemButton: false,
onRenderItem: function (item) {
return getMultilineHtml(item);
//return getUlHtml(item);
}
});
function getMultilineHtml(item)
{
return "<a href='" +
item.url + "' class='item'>" +
item.title + "</a>" + (item.info === "" ? "" : "<br><em>" +
item.info + "</em>");
}
function getUlHtml(item)
{
var actors = item.info.split(", "),
actorsHtml = "";
for (var i = 0; i < actors.length; i++) {
actorsHtml += "<li><em>" + actors[i] + "</em></li>";
}
return "<a href='" +
item.url + "' class='item'>" +
item.title + "</a>" + (item.info === "" ? "" : "<br><ul>" +
actorsHtml + "</ul>");
}
|
var movies = tabsHolder("#moviesTbList").anonymousLists({
id: "dkLists",
lists: ["Favorites", "Watch List", "History"],
emptyListsHTML: [
"<div class='emptyText'>Add your favorite movies here</div>",
"<div class='emptyText'>Add movies you wish to see here</div>",
"<div class='emptyText'></div>"],
listSizes: [100, 100, 20],
preserveTab: true,
clearListButton: false,
autoTabSwitch: true,
deleteItemButton: true
});
Future development and issues
MIT Licence
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.