PHP Classes

File: tagcloud.js

Recommend this page to a friend!
  Classes of Dmitry Sheiko   Multi-User Tag Cloud   tagcloud.js   Download  
File: tagcloud.js
Role: Auxiliary data
Content type: text/plain
Description: JS library
Class: Multi-User Tag Cloud
Manage clouds of tags added by multiple users
Author: By
Last change:
Date: 17 years ago
Size: 4,040 bytes
 

Contents

Class file image Download
/* * Tag Cloud JS-library * * @package Tag Cloud * @author $Author: sheiko $ * @version $Id: tagcloud.js, v 1.0 sheiko Exp $ * @since v.1.0 * @copyright (c) Dmitry Sheiko http://www.cmsdevelopment.com */ var TagCloudContent = ''; /** * Output new content into the cloud */ var showList = function(obj) { var respondStructure = eval( '(' + obj.responseText + ')' ); if(TagCloudContent == '') TagCloudContent = document.getElementById('TagCloud').innerHTML; document.getElementById('TagCloud').innerHTML = respondStructure.content; }; /** * Show global message about process results */ var ShowResultMessage = function(obj) { var respondStructure = eval( '(' + obj.responseText + ')' ); document.getElementById('GlobalMessageContent').innerHTML = respondStructure.content; window.setTimeout('GlobalMessage.style.display = "none";', 1800); }; /** * Show message about RSs importing results and reload interface */ var RedirectAndShowResultMessage= function(obj) { var respondStructure = eval( '(' + obj.responseText + ')' ); document.getElementById('GlobalMessageContent').innerHTML = respondStructure.content; window.setTimeout('GlobalMessage.style.display = "none"; document.location.href="admin.php";', 2100); }; /** * Controller of authorization */ var AuthorizationController = function(obj) { var respondStructure = eval( '(' + obj.responseText + ')' ); if(respondStructure.errorcode==0) { document.location.href = "admin.php"; } document.getElementById('GlobalMessageContent').innerHTML = respondStructure.content; window.setTimeout('GlobalMessage.style.display = "none";', 1800); }; /** * Get limited list of tag's records * * @param string tag * @param integer offset */ function getList(tag, offset) { serverRequest("showcloud.php", "action=browsetag&tag="+tag+"&offset="+offset, showList); return false; } /** * Prepare global message window (justifying) * * @param string message */ function initGlobalMessageWindow(message) { var GlobalMessage = document.getElementById('GlobalMessage'); if (window.innerHeight) windowHeight2=window.innerHeight/2; else windowHeight2=window.document.body.offsetHeight/2; if (window.innerWidth) windowWidth2=window.innerWidth/2; else windowWidth2=window.document.body.offsetWidth/2; GlobalMessage.style.top = document.body.scrollTop+windowHeight2-GlobalMessage.clientHeight/2; GlobalMessage.style.left = document.body.scrollLeft+windowWidth2-GlobalMessage.clientWidth/2-50; if(GlobalMessage.style.top=="0px") GlobalMessage.style.top="158px"; document.getElementById('GlobalMessageContent').innerHTML = message; GlobalMessage.style.display = "block"; } /** * Return main tag cloud menu */ function ReturnTagCloud() { document.getElementById('TagCloud').innerHTML = TagCloudContent; return false; } /** * Create request object */ function createRequestObject() { var request = null; if(!request) try { request=new ActiveXObject('Msxml2.XMLHTTP'); } catch (e){} if(!request) try { request=new ActiveXObject('Microsoft.XMLHTTP'); } catch (e){} if(!request) try { request=new XMLHttpRequest(); } catch (e){} return request; } /** * Apply server request * * @param string link - request address * @param string data - parameters * @param string callback - (facultative) a callback-function */ function serverRequest(url, data, callback) { var request = createRequestObject(); if(!request) return false; request.onreadystatechange = function() { if(request.readyState == 4 && callback) callback(request); }; if (data.length != undefined){ request.open('POST', url, true); request.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); request.setRequestHeader("Content-Length",data.length); } else { request.open('GET', url, true); data=''; } try { request.send(data); } catch (e){ alert('The server does not respond'); } return true; }