Advertisement
SSYT

Hmm, ce sa facem?

Dec 29th, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var NotifList = [
  2.     {name: "see_all", desc: "Vedeti toate notificarile"},
  3.     {name: "priv_msg", desc: "Ati primit un <a href=\"/privmsg?folder=inbox&amp;nid=%(nid)s\">mesaj privat</a> de la <a href=\"/u%(id)d\">%(name)s</a>"},
  4.     {name: "report", desc: "<a href=\"/u%(id)d\">%(name)s</a> a creat un <a href=\"/report?nid=%(nid)s\">raport de alerta</a>"},
  5.     {name: "friend_req", desc: "Ati primit o <a href=\"/profile?mode=editprofile&amp;nid=%(nid)s&amp;page_profil=friendsfoes\">cerere de prietenie</a> de la <a href=\"/u%(id)d\">%(name)s</a>"},
  6.     {name: "group_req", desc: "Ati primit o cerere de aderare la grupul <a href=\"/g%(group_id)d-%(group_url_name)s?nid=%(nid)s\">%(group_name)s</a> din partea lui <a href=\"/u%(id)d\">%(name)s</a>"},
  7.     {name: "friend_con", desc: "<a href=\"/u%(id)d\">%(name)s</a> s-a conectat pe forum"},
  8.     {name: "wall_msg", desc: "<a href=\"/u%(id)d\">%(name)s</a> tocmai v-a scris un mesaj in <a href=\"/u%(self)dwall?nid=%(nid)s\">profil.</a>"},
  9.     {name: "abuse", desc: "A fost raportat <a href=\"/admin/index.forum?mode=active&amp;nid=%(nid)s&amp;part=misc&amp;sub=support&amp;tid=%(tid)s\">un abuz</a>"},
  10.     {name: "topic_watch", desc: ""},
  11.     {name: "topic_watch_p", desc: ""},
  12.     {name: "topic_watch_guest", desc: ""},
  13.     {name: "topic_watch_p_guest", desc: ""},
  14.     {name: "mention", desc: "<a href=\"/u%(id)d\">%(name)s</a> te-a etichetat intr-un <a href=\"/t%(topic_id)dp%(start)d-%(topic_name)s?nid=%(nid)s#%(post_id)d\">subiect</a>"},
  15.     {name: "hashtag", desc: ""},
  16.     {name: "advert_validate", desc: ""},
  17.     {name: "advert_delete", desc: ""},
  18.     {name: "advert_refuse", desc: ""},
  19.     {name: "advert_expired", desc: ""}
  20. ];
  21.  
  22. $.getJSON('/notification.forum', function(notif) {
  23.     if(notif.store.length > 0) {
  24.         for(var i = 0; i < notif.store.length; i++) {
  25.             switch(notif.store[i].text.type) {
  26.                 case 0: // PM
  27.                     var str = NotifList[1].desc;
  28.                     str = str.replace(/%\(nid\)s/g, notif.store[i].text.id).replace(/%\(id\)d/g, notif.store[i].text.from.id).replace(/%\(name\)s/g, notif.store[i].text.from.name);
  29.                     console.log(str);
  30.                     break;
  31.                 case 1:
  32.                     var str = NotifList[1].desc;
  33.                     console.log(str.replace(/%\(nid\)s/g, notif.store[i].text.id).replace(/%\(id\)d/g, notif.store[i].text.from.id).replace(/%\(name\)s/g, notif.store[i].text.from.name));
  34.                     break;
  35.                 case 2:
  36.                     var str = NotifList[1].desc;
  37.                     console.log(str.replace(/%\(nid\)s/g, notif.store[i].text.id).replace(/%\(id\)d/g, notif.store[i].text.from.id).replace(/%\(name\)s/g, notif.store[i].text.from.name));
  38.                     break;
  39.                 case 3:
  40.                     // cod aici
  41.                     break;
  42.                 case 4:
  43.                     // cod aici
  44.                     break;
  45.                 case 5:
  46.                     // cod aici
  47.                     break;
  48.                 case 6:
  49.                     // cod aici
  50.                     break;
  51.                 case 7:
  52.                     // cod aici
  53.                     break;
  54.                 case 8:
  55.                     var str = NotifList[12].desc;
  56.                     str = str.replace(/%\(nid\)s/g, notif.store[i].text.id).replace(/%\(id\)d/g, notif.store[i].text.from.id).replace(/%\(name\)s/g, notif.store[i].text.from.name).replace(/%\(topic_id\)d/g, notif.store[i].text.post.topic_id).replace(/%\(topic_name\)s/g, notif.store[i].text.post.topic_name).replace(/%\(post_id\)d/g, notif.store[i].text.post.post_id);
  57.                     console.log(str);
  58.                     break;
  59.             }
  60.         }
  61.     }
  62. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement