Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JavaScript]Przerobienie kodu
RaiZeN
post 23.02.2015, 17:53:05
Post #1





Grupa: Zarejestrowani
Postów: 112
Pomógł: 4
Dołączył: 6.03.2014
Skąd: Suwałki

Ostrzeżenie: (0%)
-----


Witam,

Proszę o przeróbkę prostego kodu javascript. Oto on:
  1. var itemName = $(this).find(".smallimg").first().attr("alt");
  2.  
  3. if (itemName in PriceList) {
  4. $(this).find(".rarity").html(PriceList[itemName]);
  5. return;
  6. }
  7. $(this).find(".rarity").html("Loading ...");
  8. var item =$(this);
  9.  
  10. storage.get("currency", function(currency) {
  11. $.getJSON("http://steamcommunity.com/market/priceoverview/?currency="+currency+"&appid="+appId+"&market_hash_name=" + itemName, function(json){
  12. var price = "Not found";
  13. if (json.success){
  14. if (typeof json.lowest_price != 'undefined')
  15. price = json.lowest_price;
  16. else if (typeof json.median_price != 'undefined')
  17. price = json.median_price;
  18. }
  19. PriceList[itemName] = price;
  20. item.find(".rarity").html(price);
  21. item.addClass("priced");
  22. }).fail(function(){
  23. item.find(".rarity").html("Not found");
  24. item.addClass("priced");
  25. });
  26. });
  27. });


Chcę aby kod nie zmieniał napisu w klasie "rarity" tylko aby dodawał klasę "priced" pod divem z klasą "item". W JS jestem noga, dlatego proszę was o pomoc. tongue.gif

// jeśli zły dział proszę o przeniesienie
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 20.06.2025 - 05:50