Plugin Directory

Changeset 534391


Ignore:
Timestamp:
04/21/2012 08:57:23 AM (14 years ago)
Author:
slowmove
Message:

Now doing a more strict search followed by a fuzzy, for more exact result

Location:
spotify-embed-creator/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • spotify-embed-creator/trunk/Admin-pages/Spotify-Search-Page.php

    r533694 r534391  
    9191                    async: true,
    9292                    timeout: 50000,
     93                    data: { searchtype: type, searchquery: query.replace(/ /g,"+") },
     94                    success: function(data) {
     95                        console.log("lyckades");
     96                        var html = '<ul class="result-list">';
     97                        if(type == "artist")
     98                        {
     99                            for(var i = 0; i < data.artists.length; ++i)
     100                            {
     101                                //html += '<li>'+ data.artists[i].name +' - <input type="button" onClick="get_iframe_code(\''+data.artists[i].href+'\');" value="Skapa iframe"/></li>';
     102                            }
     103                        }
     104                        if(type == "album")
     105                        {
     106                            for(var i = 0; i < data.albums.length; ++i)
     107                            {
     108                                //html += '<li>'+ data.albums[i].artists[0].name + ' - ' + data.albums[i].name +' - <input type="button" onClick="get_iframe_code(\''+data.albums[i].href+'\');" value="Skapa iframe"/></li>';
     109                                html += '<li><a href="#" onClick="get_iframe_code(\''+data.albums[i].href+'\');">'+ data.albums[i].artists[0].name + ' - ' + data.albums[i].name +'</a></li>';
     110                            }                   
     111                        }
     112                        if(type == "track")
     113                        {
     114                            for(var i = 0; i < data.tracks.length; ++i)
     115                            {
     116                                //html += '<li>'+ data.tracks[i].artists[0].name + ' - ' + data.tracks[i].name +' - <input type="button" onclick="get_iframe_code(\''+data.tracks[i].href+'\');" value="Skapa iframe"/></li>';
     117                                html += '<li><a href="#" onclick="get_iframe_code(\''+data.tracks[i].href+'\');">' + data.tracks[i].artists[0].name + ' - ' + data.tracks[i].name +'</a></li>';
     118                            }                   
     119                        }
     120                        html += '</ul>';
     121                        jQuery("#spotify-result-container").html(html);
     122                    },
     123                    error: function(data) {
     124                      if(data.status == 404)
     125                      {
     126                        alert("Something went wrong with the url (seems to happend on Binero)");
     127                      }
     128                      else
     129                      {
     130                        console.log("misslyckades");
     131                        alert("Something went wrong");
     132                      }
     133                    }
     134                });
     135                jQuery.ajax({
     136                    type: "POST",
     137                    url: "<?php echo $pluginRoot ?>" + path + "/Api/Spotify-Request-handler.php",
     138                    async: true,
     139                    timeout: 50000,
    93140                    data: { searchtype: type, searchquery: query },
    94141                    success: function(data) {
     
    119166                        }
    120167                        html += '</ul>';
    121                         jQuery("#spotify-result-container").html(html);
     168                        jQuery("#spotify-result-container").append(html);
    122169                    },
    123170                    error: function(data) {
     
    132179                      }
    133180                    }
    134                 });     
     181                });                
    135182    }
    136183
  • spotify-embed-creator/trunk/Admin-pages/edit-post-box.php

    r533694 r534391  
    9494    jQuery("#spotify-preview-container").hide();
    9595    jQuery("#codeboxes").hide();
    96             jQuery.ajax({
    97                 type: "POST",
    98                 url: "<?php echo $pluginRoot ?>/Api/Spotify-Request-handler.php",
    99                 async: true,
    100                 timeout: 50000,
    101                 data: { searchtype: type, searchquery: query },
    102                 success: function(data) {
    103                     console.log("lyckades");
    104                     var html = '<ul class="result-list">';
    105                     if(type == "artist")
    106                     {
    107                         for(var i = 0; i < data.artists.length; ++i)
    108                         {
    109                             //html += '<li>'+ data.artists[i].name +' - <input type="button" onClick="get_iframe_code(\''+data.artists[i].href+'\');" value="Skapa iframe"/></li>';
    110                         }
    111                     }
    112                     if(type == "album")
    113                     {
    114                         for(var i = 0; i < data.albums.length; ++i)
    115                         {
    116                             //html += '<li>'+ data.albums[i].artists[0].name + ' - ' + data.albums[i].name +' - <input type="button" onClick="get_iframe_code(\''+data.albums[i].href+'\');" value="Skapa iframe"/></li>';
    117                             html += '<li><a href="#" onClick="get_iframe_code(\''+data.albums[i].href+'\');return false;">'+ data.albums[i].artists[0].name + ' - ' + data.albums[i].name +'</a></li>';
    118                         }                   
    119                     }
    120                     if(type == "track")
    121                     {
    122                         for(var i = 0; i < data.tracks.length; ++i)
    123                         {
    124                             //html += '<li>'+ data.tracks[i].artists[0].name + ' - ' + data.tracks[i].name +' - <input type="button" onclick="get_iframe_code(\''+data.tracks[i].href+'\');" value="Skapa iframe"/></li>';
    125                             html += '<li><a href="#" onclick="get_iframe_code(\''+data.tracks[i].href+'\'); return false;">' + data.tracks[i].artists[0].name + ' - ' + data.tracks[i].name +'</a></li>';
    126                         }                   
    127                     }
    128                     html += '</ul>';
    129                     jQuery("#spotify-result-container").html(html);
    130                 },
    131                 error: function(data) {
    132                       if(data.status == 404)
     96                jQuery.ajax({
     97                    type: "POST",
     98                    url: "<?php echo $pluginRoot ?>/Api/Spotify-Request-handler.php",
     99                    async: true,
     100                    timeout: 50000,
     101                    data: { searchtype: type, searchquery: query.replace(/ /g,"+") },
     102                    success: function(data) {
     103                        console.log("lyckades");
     104                        var html = '<ul class="result-list">';
     105                        if(type == "artist")
     106                        {
     107                            for(var i = 0; i < data.artists.length; ++i)
     108                            {
     109                                //html += '<li>'+ data.artists[i].name +' - <input type="button" onClick="get_iframe_code(\''+data.artists[i].href+'\');" value="Skapa iframe"/></li>';
     110                            }
     111                        }
     112                        if(type == "album")
     113                        {
     114                            for(var i = 0; i < data.albums.length; ++i)
     115                            {
     116                                //html += '<li>'+ data.albums[i].artists[0].name + ' - ' + data.albums[i].name +' - <input type="button" onClick="get_iframe_code(\''+data.albums[i].href+'\');" value="Skapa iframe"/></li>';
     117                                html += '<li><a href="#" onClick="get_iframe_code(\''+data.albums[i].href+'\');">'+ data.albums[i].artists[0].name + ' - ' + data.albums[i].name +'</a></li>';
     118                            }                   
     119                        }
     120                        if(type == "track")
     121                        {
     122                            for(var i = 0; i < data.tracks.length; ++i)
     123                            {
     124                                //html += '<li>'+ data.tracks[i].artists[0].name + ' - ' + data.tracks[i].name +' - <input type="button" onclick="get_iframe_code(\''+data.tracks[i].href+'\');" value="Skapa iframe"/></li>';
     125                                html += '<li><a href="#" onclick="get_iframe_code(\''+data.tracks[i].href+'\');">' + data.tracks[i].artists[0].name + ' - ' + data.tracks[i].name +'</a></li>';
     126                            }                   
     127                        }
     128                        html += '</ul>';
     129                        jQuery("#spotify-result-container").html(html);
     130                    },
     131                    error: function(data) {
     132                      if(data.status == 404)
    133133                      {
    134134                        alert("Something went wrong with the url (seems to happend on Binero)");
     
    139139                        alert("Something went wrong");
    140140                      }
    141                 }
    142             });     
     141                    }
     142                });
     143                jQuery.ajax({
     144                    type: "POST",
     145                    url: "<?php echo $pluginRoot ?>/Api/Spotify-Request-handler.php",
     146                    async: true,
     147                    timeout: 50000,
     148                    data: { searchtype: type, searchquery: query },
     149                    success: function(data) {
     150                        console.log("lyckades");
     151                        var html = '<ul class="result-list">';
     152                        if(type == "artist")
     153                        {
     154                            for(var i = 0; i < data.artists.length; ++i)
     155                            {
     156                                //html += '<li>'+ data.artists[i].name +' - <input type="button" onClick="get_iframe_code(\''+data.artists[i].href+'\');" value="Skapa iframe"/></li>';
     157                            }
     158                        }
     159                        if(type == "album")
     160                        {
     161                            for(var i = 0; i < data.albums.length; ++i)
     162                            {
     163                                //html += '<li>'+ data.albums[i].artists[0].name + ' - ' + data.albums[i].name +' - <input type="button" onClick="get_iframe_code(\''+data.albums[i].href+'\');" value="Skapa iframe"/></li>';
     164                                html += '<li><a href="#" onClick="get_iframe_code(\''+data.albums[i].href+'\');">'+ data.albums[i].artists[0].name + ' - ' + data.albums[i].name +'</a></li>';
     165                            }                   
     166                        }
     167                        if(type == "track")
     168                        {
     169                            for(var i = 0; i < data.tracks.length; ++i)
     170                            {
     171                                //html += '<li>'+ data.tracks[i].artists[0].name + ' - ' + data.tracks[i].name +' - <input type="button" onclick="get_iframe_code(\''+data.tracks[i].href+'\');" value="Skapa iframe"/></li>';
     172                                html += '<li><a href="#" onclick="get_iframe_code(\''+data.tracks[i].href+'\');">' + data.tracks[i].artists[0].name + ' - ' + data.tracks[i].name +'</a></li>';
     173                            }                   
     174                        }
     175                        html += '</ul>';
     176                        jQuery("#spotify-result-container").append(html);
     177                    },
     178                    error: function(data) {
     179                      if(data.status == 404)
     180                      {
     181                        alert("Something went wrong with the url (seems to happend on Binero)");
     182                      }
     183                      else
     184                      {
     185                        console.log("misslyckades");
     186                        alert("Something went wrong");
     187                      }
     188                    }
     189                });         
    143190}
    144191
  • spotify-embed-creator/trunk/Readme.txt

    r533694 r534391  
    44Requires at least: 3.0
    55Tested up to: 3.3
    6 Stable tag: 1.0.4
     6Stable tag: 1.0.5
    77
    88Search for Album or Track on Spotify and create a Spotify Play Button.
     
    3535== Changelog ==
    3636
     37= 1.0.5 =
     38* Now doing a more strict search followed by a fuzzy, for more exact result
     39
    3740= 1.0.4 =
    3841* dirname(__FILE__) instead of __DIR__ since it didn't work everywhere
  • spotify-embed-creator/trunk/Spotify-Embed-Creator.php

    r533694 r534391  
    55  Plugin URI: http://slowmove.se/wordpress-plugin-spotify-embed-creator/
    66  Description: Search for Album or Song on Spotify and create a Spotify Play Button
    7   Version: 1.0.4
     7  Version: 1.0.5
    88  Author: Erik Johansson
    99  Author URI: http://slowmove.se
Note: See TracChangeset for help on using the changeset viewer.