2 header('Content-Type: text/javascript');
3 require_once('header.inc.php');
4 require_once('functions.inc.php');
5 $player_root = $root .'includes/player/';
8 function _playerAdd(anchor) {
10 var code = '<object type="application/x-shockwave-flash" data="<?php echo $player_root ?>musicplayer_f6.swf?song_url=' + url +'&b_bgcolor=ffffff&b_fgcolor=000000&b_colors=0000ff,0000ff,ff0000,ff0000&buttons=<?php echo $player_root ?>load.swf,<?php echo $player_root ?>play.swf,<?php echo $player_root ?>stop.swf,<?php echo $player_root ?>error.swf" width="14" height="14">';
11 var code = code + '<param name="movie" value="<?php echo $player_root ?>musicplayer.swf?song_url=' + url +'&b_bgcolor=ffffff&b_fgcolor=000000&b_colors=0000ff,0000ff,ff0000,ff0000&buttons=<?php echo $player_root ?>load.swf,<?php echo $player_root ?>play.swf,<?php echo $player_root ?>stop.swf,<?php echo $player_root ?>error.swf" />';
12 var code = code + '</object>';
13 anchor.parentNode.innerHTML = code +' '+ anchor.parentNode.innerHTML;
16 String.prototype.trim = function() {
17 return this.replace(/^\s+|\s+$/g, '');
21 function deleteBookmark(ele, input){
22 var confirmDelete = "<span><?php echo T_('Are you sure?') ?> <a href=\"#\" onclick=\"deleteConfirmed(this, " + input + ", \'\'); return false;\"><?php echo T_('Yes'); ?></a> - <a href=\"#\" onclick=\"deleteCancelled(this); return false;\"><?php echo T_('No'); ?></a></span>";
23 ele.style.display = 'none';
24 ele.parentNode.innerHTML = ele.parentNode.innerHTML + confirmDelete;
27 function deleteCancelled(ele) {
28 var del = previousElement(ele.parentNode);
29 del.style.display = 'inline';
30 ele.parentNode.parentNode.removeChild(ele.parentNode);
34 function deleteConfirmed(ele, input, response) {
35 if (deleted == false) {
36 deleted = ele.parentNode.parentNode.parentNode;
39 post.className = 'xfolkentry deleted';
41 post.style.display = 'none';
44 loadXMLDoc('<?php echo $root; ?>ajaxDelete.php?id=' + input);
48 function previousElement(ele) {
49 ele = ele.previousSibling;
50 while (ele.nodeType != 1) {
51 ele = ele.previousSibling;
56 function isAvailable(input, response){
57 var usernameField = document.getElementById("username");
58 var username = usernameField.value;
59 username = username.toLowerCase();
60 username = username.trim();
61 var availability = document.getElementById("availability");
63 usernameField.style.backgroundImage = 'url(<?php echo $root; ?>loading.gif)';
65 usernameField.style.backgroundImage = 'none';
66 if (response == 'true') {
67 availability.className = 'available';
68 availability.innerHTML = '<?php echo T_('Available'); ?>';
70 availability.className = 'not-available';
71 availability.innerHTML = '<?php echo T_('Not Available'); ?>';
74 loadXMLDoc('<?php echo $root; ?>ajaxIsAvailable.php?username=' + username);
79 function useAddress(ele) {
80 var address = ele.value;
82 if (address.indexOf(':') < 0) {
83 address = 'http:\/\/' + address;
85 getTitle(address, null);
90 function getTitle(input, response){
91 var title = document.getElementById('titleField');
92 if (title.value == '') {
93 title.style.backgroundImage = 'url(<?php echo $root; ?>loading.gif)';
94 if (response != null) {
95 title.style.backgroundImage = 'none';
96 title.value = response;
97 } else if (input.indexOf('http') > -1) {
98 loadXMLDoc('<?php echo $root; ?>ajaxGetTitle.php?url=' + input);
106 function loadXMLDoc(url) {
108 if (window.XMLHttpRequest) {
109 xmlhttp = new XMLHttpRequest();
110 xmlhttp.onreadystatechange = processStateChange;
111 xmlhttp.open("GET", url, true);
114 } else if (window.ActiveXObject) {
115 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
117 xmlhttp.onreadystatechange = processStateChange;
118 xmlhttp.open("GET", url, true);
124 function processStateChange() {
125 if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
126 response = xmlhttp.responseXML.documentElement;
127 method = response.getElementsByTagName('method')[0].firstChild.data;
128 result = response.getElementsByTagName('result')[0].firstChild.data;
129 eval(method + '(\'\', result)');
133 function playerLoad() {
134 var anchors = document.getElementsByTagName('a');
135 var anchors_length = anchors.length;
136 for (var i = 0; i < anchors_length; i++) {
137 if (anchors[i].className == 'taggedlink' && anchors[i].href.match(/\.mp3$/i)) {
138 _playerAdd(anchors[i]);