| 1 | <?php |
|---|
| 2 | header('Content-Type: text/javascript'); |
|---|
| 3 | require_once('header.inc.php'); |
|---|
| 4 | require_once('functions.inc.php'); |
|---|
| 5 | $player_root = $root .'includes/player/';
|
|---|
| 6 | $images_root = $root .'images/';
|
|---|
| 7 | ?> |
|---|
| 8 | |
|---|
| 9 | function _playerAdd(anchor) { |
|---|
| 10 | var url = anchor.href; |
|---|
| 11 | 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">'; |
|---|
| 12 | 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" />'; |
|---|
| 13 | var code = code + '</object>'; |
|---|
| 14 | anchor.parentNode.innerHTML = code +' '+ anchor.parentNode.innerHTML; |
|---|
| 15 | } |
|---|
| 16 | |
|---|
| 17 | String.prototype.trim = function() { |
|---|
| 18 | return this.replace(/^\s+|\s+$/g, ''); |
|---|
| 19 | }; |
|---|
| 20 | |
|---|
| 21 | var deleted = false; |
|---|
| 22 | function deleteBookmark(ele, input){ |
|---|
| 23 | 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>"; |
|---|
| 24 | ele.style.display = 'none'; |
|---|
| 25 | ele.parentNode.innerHTML = ele.parentNode.innerHTML + confirmDelete; |
|---|
| 26 | } |
|---|
| 27 | |
|---|
| 28 | function deleteCancelled(ele) { |
|---|
| 29 | var del = previousElement(ele.parentNode); |
|---|
| 30 | del.style.display = 'inline'; |
|---|
| 31 | ele.parentNode.parentNode.removeChild(ele.parentNode); |
|---|
| 32 | return false; |
|---|
| 33 | } |
|---|
| 34 | |
|---|
| 35 | function deleteConfirmed(ele, input, response) { |
|---|
| 36 | if (deleted == false) { |
|---|
| 37 | deleted = ele.parentNode.parentNode.parentNode; |
|---|
| 38 | } |
|---|
| 39 | var post = deleted; |
|---|
| 40 | post.className = 'xfolkentry deleted'; |
|---|
| 41 | if (response != '') { |
|---|
| 42 | post.style.display = 'none'; |
|---|
| 43 | deleted = false; |
|---|
| 44 | } else { |
|---|
| 45 | loadXMLDoc('<?php echo $root; ?>ajaxDelete.php?id=' + input); |
|---|
| 46 | } |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | function previousElement(ele) { |
|---|
| 50 | ele = ele.previousSibling; |
|---|
| 51 | while (ele.nodeType != 1) { |
|---|
| 52 | ele = ele.previousSibling; |
|---|
| 53 | } |
|---|
| 54 | return ele; |
|---|
| 55 | } |
|---|
| 56 | |
|---|
| 57 | function isAvailable(input, response){ |
|---|
| 58 | var usernameField = document.getElementById("username"); |
|---|
| 59 | var username = usernameField.value; |
|---|
| 60 | username = username.toLowerCase(); |
|---|
| 61 | username = username.trim(); |
|---|
| 62 | var availability = document.getElementById("availability"); |
|---|
| 63 | if (username != '') { |
|---|
| 64 | usernameField.style.backgroundImage = 'url(<?php echo $root; ?>loading.gif)'; |
|---|
| 65 | if (response != '') { |
|---|
| 66 | usernameField.style.backgroundImage = 'none'; |
|---|
| 67 | if (response == 'true') { |
|---|
| 68 | availability.className = 'available'; |
|---|
| 69 | availability.innerHTML = '<?php echo T_('Available'); ?>'; |
|---|
| 70 | } else { |
|---|
| 71 | availability.className = 'not-available'; |
|---|
| 72 | availability.innerHTML = '<?php echo T_('Not Available'); ?>'; |
|---|
| 73 | } |
|---|
| 74 | } else { |
|---|
| 75 | loadXMLDoc('<?php echo $root; ?>ajaxIsAvailable.php?username=' + username); |
|---|
| 76 | } |
|---|
| 77 | } |
|---|
| 78 | } |
|---|
| 79 | |
|---|
| 80 | function useAddress(ele) { |
|---|
| 81 | var address = ele.value; |
|---|
| 82 | if (address != '') { |
|---|
| 83 | if (address.indexOf(':') < 0) { |
|---|
| 84 | address = 'http:\/\/' + address; |
|---|
| 85 | } |
|---|
| 86 | getTitle(address, null); |
|---|
| 87 | ele.value = address; |
|---|
| 88 | } |
|---|
| 89 | } |
|---|
| 90 | |
|---|
| 91 | function getTitle(input, response){ |
|---|
| 92 | var title = document.getElementById('titleField'); |
|---|
| 93 | if (title.value == '') { |
|---|
| 94 | title.style.backgroundImage = 'url(<?php echo $root; ?>loading.gif)'; |
|---|
| 95 | if (response != null) { |
|---|
| 96 | title.style.backgroundImage = 'none'; |
|---|
| 97 | title.value = response; |
|---|
| 98 | } else if (input.indexOf('http') > -1) { |
|---|
| 99 | loadXMLDoc('<?php echo $root; ?>ajaxGetTitle.php?url=' + input); |
|---|
| 100 | } else { |
|---|
| 101 | return false; |
|---|
| 102 | } |
|---|
| 103 | } |
|---|
| 104 | } |
|---|
| 105 | |
|---|
| 106 | var xmlhttp = createRequestObject(); //used for default functions and those pertaining to ratings
|
|---|
| 107 |
|
|---|
| 108 |
|
|---|
| 109 | //default functions
|
|---|
| 110 | |
|---|
| 111 | function createRequestObject() {
|
|---|
| 112 | if (window.XMLHttpRequest) { // Native
|
|---|
| 113 | return new XMLHttpRequest();
|
|---|
| 114 | } else if (window.ActiveXObject) { // ActiveX
|
|---|
| 115 | return new ActiveXObject("Microsoft.XMLHTTP");
|
|---|
| 116 | }
|
|---|
| 117 | }
|
|---|
| 118 |
|
|---|
| 119 | function loadXMLDoc(url) {
|
|---|
| 120 | xmlhttp.onreadystatechange = processStateChange;
|
|---|
| 121 | xmlhttp.open("GET", url, true);
|
|---|
| 122 | if (window.XMLHttpRequest) { // Native
|
|---|
| 123 | xmlhttp.send(null);
|
|---|
| 124 | } else if (window.ActiveXObject) { // ActiveX
|
|---|
| 125 | xmlhttp.send();
|
|---|
| 126 | }
|
|---|
| 127 | }
|
|---|
| 128 |
|
|---|
| 129 | function processStateChange() { |
|---|
| 130 | if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
|---|
| 131 | response = xmlhttp.responseXML.documentElement; |
|---|
| 132 | method = response.getElementsByTagName('method')[0].firstChild.data; |
|---|
| 133 | result = response.getElementsByTagName('result')[0].firstChild.data; |
|---|
| 134 | eval(method + '(\'\', result)'); |
|---|
| 135 | } |
|---|
| 136 | } |
|---|
| 137 | |
|---|
| 138 | function playerLoad() { |
|---|
| 139 | var anchors = document.getElementsByTagName('a'); |
|---|
| 140 | var anchors_length = anchors.length; |
|---|
| 141 | for (var i = 0; i < anchors_length; i++) { |
|---|
| 142 | if (anchors[i].className == 'taggedlink' && anchors[i].href.match(/\.mp3$/i)) { |
|---|
| 143 | _playerAdd(anchors[i]); |
|---|
| 144 | } |
|---|
| 145 | } |
|---|
| 146 | }
|
|---|
| 147 |
|
|---|