A lot of projects ported from the old metanohi site.
This commit is contained in:
		
							
								
								
									
										35
									
								
								site/projects/wontofor/parts/ajax.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								site/projects/wontofor/parts/ajax.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
/*  wontofor: A JavaScript shortcut system
 | 
			
		||||
 *  Copyright (C) 2010  Niels 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.org>
 | 
			
		||||
 *  See <http://metanohi.org/projects/wontofor/>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
wontofor.ajax.getWeb = function(url, func, args, method) {
 | 
			
		||||
    var req = new XMLHttpRequest()
 | 
			
		||||
    req.open(method, url, true)
 | 
			
		||||
    req.onreadystatechange = function() {
 | 
			
		||||
        if (req.readyState == 4) {
 | 
			
		||||
            if (req.status == 200)
 | 
			
		||||
                func(req.responseText, true)
 | 
			
		||||
            else
 | 
			
		||||
                func(req.status, false)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    req.send(null)
 | 
			
		||||
}.base('.', alert, [], 'GET')
 | 
			
		||||
							
								
								
									
										48
									
								
								site/projects/wontofor/parts/html.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								site/projects/wontofor/parts/html.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
			
		||||
/*  wontofor: A JavaScript shortcut system
 | 
			
		||||
 *  Copyright (C) 2010  Niels 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.org>
 | 
			
		||||
 *  See <http://metanohi.org/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
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user