[Paulscriptsmods-checkin] ajax_shout/root ajax.php, 1.21.2.33, 1.21.2.34
Status: Beta
Brought to you by:
paulsohier
From: Paul S. <pau...@us...> - 2007-10-03 19:59:52
|
Update of /cvsroot/paulscriptsmods/ajax_shout/root In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24605 Modified Files: Tag: phpbb3_ver ajax.php Log Message: You didnt see this. Index: ajax.php =================================================================== RCS file: /cvsroot/paulscriptsmods/ajax_shout/root/ajax.php,v retrieving revision 1.21.2.33 retrieving revision 1.21.2.34 diff -C2 -d -r1.21.2.33 -r1.21.2.34 *** ajax.php 23 Sep 2007 21:03:33 -0000 1.21.2.33 --- ajax.php 3 Oct 2007 19:59:53 -0000 1.21.2.34 *************** *** 588,794 **** } } - function validate_overige(xml) - { - try - { - if (xml.childNodes.length == 0) - { - return tn(''); - } - else if (xml.childNodes.length == 1 && xml.childNodes[0].nodeValue != null) - { - // With a tag in it, its bigger as 1? - - return tn(xml.childNodes[0].nodeValue); - } - else - { - var div = ce('span'); - loop: - - for (var i = 0; i < xml.childNodes.length; i++) - { - - switch (xml.childNodes[i].nodeType) - { - case 3: - div.appendChild(document.createTextNode(xml.childNodes[i].nodeValue)); - break; - - case 9: - case 8: - case 10: - case 11: - // continue; - break; - - case 1: - if (xml.childNodes[i].childNodes.length == 0 && xml.childNodes[i].nodeName != 'br' && xml.childNodes[i].nodeName != 'img' && xml.childNodes[i].nodeName != 'hr') - { - break; - } - - // This is a difficult one :) - switch (xml.childNodes[i].nodeName) - { - case 'br': - div.appendChild(ce('br')); - break; - - case 'blockquote': - var q = ce('blockquote'); - q.className = 'quote'; - q.appendChild(validate_overige(xml.childNodes[i])); - add_style(xml.childNodes[i], q); - div.appendChild(q); - break; - - case 'a': - var a = ce('a'); - - a.href = xml.childNodes[i].getAttribute('href'); - a.appendChild(validate_overige(xml.childNodes[i])); - - add_style(xml.childNodes[i], a); - - div.appendChild(a); - break; - - case 'img': - var img = ce('img'); - - img.alt = xml.childNodes[i].getAttribute('alt'); - img.src = xml.childNodes[i].getAttribute('src'); - img.border = 0; - add_style(xml.childNodes[i], img); - - div.appendChild(img); - break; - - case 'strong': - case 'b': - var b = ce('strong'); - - b.appendChild(validate_overige(xml.childNodes[i])); - add_style(xml.childNodes[i], b); - div.appendChild(b); - break; - - case 'hr': - var hr = ce('hr'); - - div.appendChild(hr); - break; - - case 'h1': - case 'h2': - case 'h3': - case 'h4': - case 'h5': - case 'h6': - var h = ce(xml.childNodes[i].nodeName); - h.appendChild(validate_overige(xml.childNodes[i])); - add_style(xml.childNodes[i], h); - div.appendChild(h); - break; - - case 'span': - var s = ce('span'); - s.appendChild(validate_overige(xml.childNodes[i])); - - add_style(xml.childNodes[i], s); - div.appendChild(s); - break; - - default: - { - throw err_msg('<?php echo $user->lang['INVALID_EL']; ?>' + xml.childNodes[i].nodeName); - } - } - break; - } - } - } - return div; - } - catch (e) - { - handle(e); - return div; - } - } - function add_style(el, s) - { - var c = el.getAttribute('class'); - - if (c != null) - { - s.className = c; - } - - f = el.getAttribute('style'); - - if (f == null) - { - return; - } - if (f.indexOf(';') == -1) - { - f += ';'; - } - f = f.split(';'); - for (var j = 0; j < f.length; j++) - { - f2 = f[j].split(':'); - - if (f2[0]) - { - f2[0] = trim(f2[0]); - } - - if (f2[1]) - { - f2[1] = trim(f2[1]); - } - - switch (f2[0]) - { - case 'font-style': - s.style.fontStyle = f2[1]; - break; - - case 'font-weight': - s.style.fontWeight = f2[1]; - break; - - case 'font-size': - try - { - s.style.fontSize = f2[1]; - } - catch (e){} - break; - - case 'line-height': - s.style.lineHeigt = f2[1]; - break; - - case 'color': - s.style.color = f2[1]; - break; - - case 'text-decoration': - s.style.textDecoration = f2[1]; - break; - } - } - } - - function trim(value) - { - value = value.replace(/^\s+/,''); - value = value.replace(/\s+$/,''); - return value; - } function reload_page() --- 588,591 ---- *************** *** 1287,1375 **** } } ! function http() ! { ! try ! { ! var http_request = false; ! if (window.XMLHttpRequest) ! { // Mozilla, Safari,... ! http_request = new XMLHttpRequest(); ! if (http_request.overrideMimeType) ! { ! http_request.overrideMimeType('text/xml'); ! } ! } ! else if (window.ActiveXObject) ! { // IE ! try ! { ! http_request = new ActiveXObject('Msxml2.XMLHTTP'); ! } ! catch (e) ! { ! try ! { ! http_request = new ActiveXObject('Microsoft.XMLHTTP'); ! } ! catch (e) ! { ! } ! } ! } ! ! if (!http_request) ! { ! throw err_msg('<?php echo $user->lang['NO_AJAX']; ?>'); ! } ! return http_request; ! ! } ! catch (e) ! { ! handle(e); ! return false; ! } ! } ! function message(msg, color) ! { ! try ! { ! if (document.getElementById('msg_txt') != null) ! { ! document.getElementById('msg_txt').innerHTML = ''; ! var tmp = ce('p'); ! tmp.appendChild(tn(msg)); ! if (color) ! { ! tmp.style.color = 'red'; ! } ! document.getElementById('msg_txt').appendChild(tmp); ! } ! else ! { ! div.innerHTML = ''; ! var tmp = ce('p'); ! tmp.appendChild(tn(msg)); ! if (color) ! { ! tmp.style.color = 'red'; ! } ! div.appendChild(tmp); ! } ! } ! catch (e) ! { ! handle(e); ! return false; ! } ! } ! function ce(e) ! { ! return document.createElement(e); ! } ! function tn(e) { ! return document.createTextNode(e); } function cp() { --- 1084,1093 ---- } } ! ! function no_ajax() { ! return '<?php echo $user->lang['NO_AJAX']; ?>'; } + function cp() { *************** *** 1626,1632 **** function xml($contents) { - error_reporting(E_ALL); - $contents = utf8_encode(trim($contents)); - if ( preg_match('/\<(.*?)\>/xsi', $contents) ) { --- 1344,1347 ---- |