mirror of
https://github.com/flynx/pWiki.git
synced 2025-12-18 00:51:38 +00:00
internal css support + noscript filter + tweaks...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
e9da7ecd4c
commit
5a95f8c8ab
@ -53,8 +53,13 @@ var update_editor = function(){
|
|||||||
.focus(function(){
|
.focus(function(){
|
||||||
$(this).text(Wiki.title)
|
$(this).text(Wiki.title)
|
||||||
})
|
})
|
||||||
.blur(() => {
|
.blur(function(){
|
||||||
Wiki.title = $('.title').text()
|
var text = $(this).text().trim()
|
||||||
|
if(text[0] == '/'){
|
||||||
|
Wiki.path = text
|
||||||
|
} else {
|
||||||
|
Wiki.title = text
|
||||||
|
}
|
||||||
reload()
|
reload()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
57
wiki.js
57
wiki.js
@ -110,6 +110,7 @@ var macro = {
|
|||||||
// NOTE: these are added AFTER the user defined filters...
|
// NOTE: these are added AFTER the user defined filters...
|
||||||
__filters__: [
|
__filters__: [
|
||||||
'wikiword',
|
'wikiword',
|
||||||
|
'noscript',
|
||||||
],
|
],
|
||||||
|
|
||||||
// Macros...
|
// Macros...
|
||||||
@ -326,6 +327,21 @@ var macro = {
|
|||||||
wikiword: function(context, elem){
|
wikiword: function(context, elem){
|
||||||
return $('<span>')
|
return $('<span>')
|
||||||
.html(setWikiWords($(elem).html(), true, this.__include_marker__)) },
|
.html(setWikiWords($(elem).html(), true, this.__include_marker__)) },
|
||||||
|
noscript: function(context, elem){
|
||||||
|
return $(elem)
|
||||||
|
// remove script tags...
|
||||||
|
.find('script')
|
||||||
|
.remove()
|
||||||
|
.end()
|
||||||
|
// remove js links...
|
||||||
|
.find('[href]')
|
||||||
|
.filter(function(i, e){ return /javascript:/i.test($(e).attr('href')) })
|
||||||
|
.attr('href', '#')
|
||||||
|
.end()
|
||||||
|
.end()
|
||||||
|
// remove event handlers...
|
||||||
|
// XXX .off() will not work here as we need to remove on* handlers...
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
// XXX move this to a plugin...
|
// XXX move this to a plugin...
|
||||||
@ -639,6 +655,24 @@ var BaseData = {
|
|||||||
//
|
//
|
||||||
// XXX add .json support...
|
// XXX add .json support...
|
||||||
var data = {
|
var data = {
|
||||||
|
// System pages...
|
||||||
|
'System/style': {
|
||||||
|
text: ''
|
||||||
|
+'.button {\n'
|
||||||
|
+' text-decoration: none;\n'
|
||||||
|
+' margin: 5px;\n'
|
||||||
|
+'}\n'
|
||||||
|
+'\n'
|
||||||
|
+'.separator~* {\n'
|
||||||
|
+' float: right;\n'
|
||||||
|
+'}\n'
|
||||||
|
+'',
|
||||||
|
},
|
||||||
|
'System/settings': {
|
||||||
|
text: JSON.stringify({}),
|
||||||
|
},
|
||||||
|
|
||||||
|
// Templates...
|
||||||
'Templates': {
|
'Templates': {
|
||||||
text: '@filter(nl2br)'
|
text: '@filter(nl2br)'
|
||||||
+'XXX Genereal template description...\n'
|
+'XXX Genereal template description...\n'
|
||||||
@ -650,7 +684,6 @@ var data = {
|
|||||||
+'</macro>\n'
|
+'</macro>\n'
|
||||||
+'\n',
|
+'\n',
|
||||||
},
|
},
|
||||||
|
|
||||||
'Templates/EmptyPage': {
|
'Templates/EmptyPage': {
|
||||||
text: ''
|
text: ''
|
||||||
+'<!-- place filters here so as not to takup page space: ... -->\n'
|
+'<!-- place filters here so as not to takup page space: ... -->\n'
|
||||||
@ -661,28 +694,35 @@ var data = {
|
|||||||
+'@include(./links)' +'<br><br>\n'
|
+'@include(./links)' +'<br><br>\n'
|
||||||
+'\n',
|
+'\n',
|
||||||
},
|
},
|
||||||
|
|
||||||
'Templates/pages': {
|
'Templates/pages': {
|
||||||
text: '<macro src="../*"> [@source(./path)]<br> </macro>\n'
|
text: '<macro src="../*"> [@source(./path)]<br> </macro>\n'
|
||||||
},
|
},
|
||||||
'Templates/tree': {
|
'Templates/tree': {
|
||||||
text: '<macro src="../**"> [@source(./path)]<br> </macro>\n'
|
text: '<macro src="../**"> [@source(./path)]<br> </macro>\n'
|
||||||
},
|
},
|
||||||
|
|
||||||
'Templates/_raw': {
|
'Templates/_raw': {
|
||||||
text: '@source(..)',
|
text: '@source(..)',
|
||||||
},
|
},
|
||||||
|
'Templates/_css': {
|
||||||
|
text: '<style>\n'
|
||||||
|
+'@source(..)\n'
|
||||||
|
+'</style>',
|
||||||
|
},
|
||||||
'Templates/_view': {
|
'Templates/_view': {
|
||||||
text: '\n'
|
text: '\n'
|
||||||
|
+'@include(style/_css)\n'
|
||||||
+'\n'
|
+'\n'
|
||||||
+'<div>\n'
|
+'<div>\n'
|
||||||
+'<a href="#pages">☰</a> \n'
|
+'<a href="#pages" class="pages-list-button button">☰</a> \n'
|
||||||
+'[@source(../path)]\n'
|
+'[@source(../path)]\n'
|
||||||
+'\n'
|
+'\n'
|
||||||
+'<slot name="toggle-edit-link">\n'
|
+'<slot name="toggle-edit-link">\n'
|
||||||
+'(<a href="#./_edit">edit</a>)\n'
|
+'(<a href="#./_edit">edit</a>)\n'
|
||||||
+'</slot>\n'
|
+'</slot>\n'
|
||||||
|
+'\n'
|
||||||
|
+'<span class="separator"/>\n'
|
||||||
|
+'\n'
|
||||||
|
+'<a href="#NewPage/_edit" class="new-page-button button">+</a>\n'
|
||||||
+'</div>\n'
|
+'</div>\n'
|
||||||
+'\n'
|
+'\n'
|
||||||
+'<hr>\n'
|
+'<hr>\n'
|
||||||
@ -797,9 +837,12 @@ var Wiki = {
|
|||||||
.replace(/^\*|([^.])\*/g, '$1[^\\/]*')
|
.replace(/^\*|([^.])\*/g, '$1[^\\/]*')
|
||||||
+'$')
|
+'$')
|
||||||
|
|
||||||
return Object.keys(this.__wiki_data)
|
var data = this.__wiki_data
|
||||||
|
return Object.keys(data)
|
||||||
// XXX is this correct???
|
// XXX is this correct???
|
||||||
.concat(Object.keys(this.__wiki_data.__proto__))
|
.concat(Object.keys(data.__proto__)
|
||||||
|
// do not repeat overloaded stuff...
|
||||||
|
.filter(function(e){ return !data.hasOwnProperty(e) }))
|
||||||
.map(function(p){ return tail != '' ?
|
.map(function(p){ return tail != '' ?
|
||||||
normalizePath(p +'/'+ tail)
|
normalizePath(p +'/'+ tail)
|
||||||
: p })
|
: p })
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user