rename 'keywords' option to 'references'

This commit is contained in:
rolux 2012-06-12 14:31:45 +02:00
parent 9c044300ef
commit b71d9148d0
2 changed files with 12 additions and 11 deletions

View file

@ -14,6 +14,7 @@ Ox.ExamplePage = function(options, self) {
.defaults({ .defaults({
html: '', html: '',
js: '', js: '',
references: [],
replaceCode: [], replaceCode: [],
replaceComment: [], replaceComment: [],
selected: 'source', selected: 'source',
@ -113,9 +114,9 @@ Ox.ExamplePage = function(options, self) {
}) })
.appendTo(self.$toolbar); .appendTo(self.$toolbar);
self.$keywordMenu = Ox.MenuButton({ self.$referencesMenu = Ox.MenuButton({
items: self.options.keywords.map(function(keyword) { items: self.options.references.map(function(reference) {
return {id: keyword, title: keyword}; return {id: reference, title: reference};
}), }),
//title: 'Documentation', //title: 'Documentation',
//width: 128 //width: 128

View file

@ -14,8 +14,8 @@ Ox.ExamplePanel = function(options, self) {
.defaults({ .defaults({
element: '', element: '',
examples: [], examples: [],
keywords: null,
path: '', path: '',
references: null,
replaceCode: [], replaceCode: [],
replaceComment: [], replaceComment: [],
selected: '', selected: '',
@ -83,16 +83,16 @@ Ox.ExamplePanel = function(options, self) {
var items = []; var items = [];
self.options.examples.forEach(function(example) { self.options.examples.forEach(function(example) {
var item = { var item = {
html: self.options.path + example + '/index.html', html: self.options.path + example + '/index.html',
id: example, id: example,
js: self.options.path + example + '/js/example.js' js: self.options.path + example + '/js/example.js'
}; };
Ox.get(item.html, function(html) { Ox.get(item.html, function(html) {
var title = html.match(/<title>(.+)<\/title>/); var title = html.match(/<title>(.+)<\/title>/);
item.title = title ? title[1] : 'Untitled' item.title = title ? title[1] : 'Untitled'
Ox.get(item.js, function(js) { Ox.get(item.js, function(js) {
var keywords = js.match(self.options.keywords); var references = js.match(self.options.references);
item.keywords = keywords ? Ox.unique(keywords).sort(function(a, b) { item.references = references ? Ox.unique(references).sort(function(a, b) {
a = a.toLowerCase(); a = a.toLowerCase();
b = b.toLowerCase(); b = b.toLowerCase();
return a < b ? -1 : a > b ? 1 : 0; return a < b ? -1 : a > b ? 1 : 0;
@ -113,7 +113,7 @@ Ox.ExamplePanel = function(options, self) {
height: window.innerHeight, height: window.innerHeight,
html: item.html, html: item.html,
js: item.js, js: item.js,
keywords: item.keywords, references: item.references,
replaceCode: self.options.replaceCode, replaceCode: self.options.replaceCode,
replaceComment: self.options.replaceComment, replaceComment: self.options.replaceComment,
title: item.title, title: item.title,