Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- ///////////////// Data icon INFO //////////////////////
- // /members/dataicon_ajx.php?login=cyberlot&item=1008CS-100E_TSG
- $(function(){
- $.ajaxSetup({
- timeout: 20000,
- async: true
- });
- // store whether we are searching for this one yet or not. CACHE
- var cache={};
- var delim_cache = '|||'
- // apply the search results. (callback for ajax)
- cache_ds = function(jsondata,status,xmlReq){
- $.each(jsondata, function(itemno,data) {
- //console.log(itemno,data);
- show_icon(data);
- });
- //console.log(jsondata);
- return false;
- }
- // caching and doing one call to get around the browser limit for # of requests and speed things up
- cache=new Array();
- $('.findthese').each(
- // update the findthese item numbers
- function(index,domEle){
- var $this = $(domEle);
- var st = typeof(cache[$this.html()]);
- if(st == 'undefined'){
- cache.push($this.html());
- }
- }
- );
- cache = $(cache).get().join(delim_cache);
- //console.log(cache);
- // post all the items to get additional info.
- $.post("dataicon_ajx.php", { name: "{{$login}}", items: cache , delim: delim_cache, ac:'items' },cache_ds,'json');
- });
- function show_icon(data){
- if(data.itemNumber){
- console.log('Icon it',data.itemNumber);
- // update the findthese icons
- $('.findthese').each(
- function(index,domEle){
- try{
- var $this = $(domEle);
- if($this.html() == data.itemNumber){
- // clear the temp data
- // make findthese Icon show if needed.$this.html('');
- if(data.pbFree_findthese=='Yes'){
- $this.addClass('findthese_active');
- //alert('Icon On '+data.itemNumber);
- $this.html('').removeClass('findthese');
- }
- // if active, update the link directly to data icon.
- if(data.active=='1' && data.data_icon!=''){
- var parent = $this.parent();
- parent.attr('href',data.data_icon);
- }
- }
- } catch(e) {
- //console.log(e);
- }
- }
- );
- }
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement