metanohi/site/projects/wontofor/parts/html.js

49 lines
1.4 KiB
JavaScript

/* wontofor: A JavaScript shortcut system
* Copyright (C) 2010 Niels G. W. Serup
*
* This file is part of wontofor.
*
* wontofor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* wontofor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with wontofor. If not, see <http://www.gnu.org/licenses/>.
*
* Maintained by Niels Serup <ns@metanohi.name>
* See <http://metanohi.name/projects/wontofor/>
*/
wontofor.html.body = document.body
HTMLElement.prototype.set_opacity = function(val) {
this.style.opacity = val
this.style.filter = 'alpha(opacity=' + val*100 + ')'
}
HTMLElement.prototype.remove = function() {
this.parentNode.removeChild(this)
}
HTMLElement.prototype.setText = function(text) {
this.innerHTML = text
}
HTMLElement.prototype.append = function(elem) {
this.appendChild(elem)
}
wontofor.html.create = function(tag) {
return document.createElement(tag)
}
wontofor.html.setTitle = function(title) {
document.title = title
}