Advertisement
Guest User

Untitled

a guest
Mar 17th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.12 KB | None | 0 0
  1. /*
  2. * Created by Laercio Calheiros
  3. * WebNity.com.br
  4. * A copia total ou parcial desse arquivo é totalmente proibida.
  5. */
  6. var baseUrl = 'http://'+window.location.hostname;
  7. var Alerta = {
  8. Init: function(txt) {
  9. var Quant = ($('#area-alertas .alerta').length+1);
  10. var Incre = "'";
  11. var Unico = new Date();
  12. Unico = Unico.getHours()+ '-' +Unico.getMinutes()+ '-' +Unico.getSeconds()+ '-' +Quant;
  13.  
  14. var Html = '<div class="alerta '+Unico+'">';
  15. Html+= ' <div class="titulo"><div class="icone"></div> Aviso Importante <div class="fechar" onclick="Alerta.Close(' + Incre + Unico + Incre + ')"></div></div>';
  16. Html+= ' <p>'+txt+'</p>';
  17. Html+= '</div>';
  18.  
  19. $('#area-alertas').append(Html);
  20.  
  21. setTimeout(function(){
  22. Alerta.Close(Unico);
  23. }, 10000);
  24.  
  25. },
  26.  
  27. Pok: function(titulo, txt) {
  28. var Quant = ($('#area-alertas .alerta').length+1);
  29. var Incre = "'";
  30. var Unico = new Date();
  31. Unico = Unico.getHours()+ '-' +Unico.getMinutes()+ '-' +Unico.getSeconds()+ '-' +Quant;
  32.  
  33. var Html = '<div class="alerta '+Unico+'">';
  34. Html+= ' <div class="titulo"><div class="icone"></div> '+titulo+' <div class="fechar" onclick="Alerta.Close(' + Incre + Unico + Incre + ')"></div></div>';
  35. Html+= ' <p>'+txt+'</p>';
  36. Html+= '</div>';
  37.  
  38. $('#area-alertas').append(Html);
  39.  
  40. setTimeout(function(){
  41. Alerta.Close(Unico);
  42. }, 10000);
  43.  
  44. },
  45.  
  46. Close: function(f) {
  47. $('.'+ f).animate({ opacity: 0 }, 250, function() {
  48. $('.'+ f).animate({ 'margin-top' : '0px' }, 250).children().slideUp(250, function() {
  49. $('.'+ f).remove();
  50. });
  51. });
  52. },
  53.  
  54. TempoReal:function(){
  55. $.ajax({
  56. url: 'lib/Alerta',
  57. type: 'POST',
  58. dataType: 'Json',
  59. data: {'tipo': 'ver'},
  60. success:function(data){
  61. console.log(data);
  62. if(data.length >= 1){
  63. for(i = 0; i < data.length; i++) {
  64. console.log(data[i].texto);
  65. var Quant = ($('#area-alertas .alerta').length+1);
  66. var Incre = "'";
  67. var Unico = new Date();
  68. Unico = Unico.getHours()+ '-' +Unico.getMinutes()+ '-' +Unico.getSeconds()+ '-' +Quant;
  69.  
  70. var Html = '<div class="alerta '+Unico+'">';
  71. Html+= ' <div class="titulo"><div class="icone"></div> Alerta do site <div class="fechar" onclick="Alerta.Close(' + Incre + Unico + Incre + ')"></div></div>';
  72. Html+= ' <p>'+data[i].texto+'</p>';
  73. Html+= '</div>';
  74.  
  75. $('#area-alertas').append(Html);
  76. }
  77.  
  78. }
  79.  
  80. }
  81. });
  82.  
  83. }
  84. }
  85. var Topico = {
  86. $(function () {
  87. $('form').bind('submit', function () {
  88. $.ajax({
  89. type: 'post',
  90. url: 'post.php',
  91. data: $('form').serialize(),
  92. success: function () {
  93. alert('form was submitted');
  94. }
  95. });
  96. return false;
  97. });
  98. });
  99. }
  100. var Vip = {
  101. Comprar:function(tp){
  102. $.ajax({
  103. url: 'lib/Vip',
  104. type: 'POST',
  105. dataType: 'Json',
  106. data: {'tipo': 'Comprar', 'plano':tp},
  107. success:function(data){
  108. if(data['erro']){
  109. Alerta.Init(data['erro']);
  110. }else{
  111. Alerta.Init('Plano adquirido com sucesso! <br/>Você será redirecionado aguarde 3 segundos.');
  112. location.reload();
  113.  
  114. }
  115.  
  116. }
  117. });
  118.  
  119. }
  120. }
  121.  
  122. var Forum = {
  123. Ranking: function() {
  124. $('.forum-ranking .item').click(function() {
  125. var Verifica = $(this).hasClass('ativo');
  126. var rel = $(this).attr('rel');
  127. if(!Verifica){
  128. $('.forum-ranking .item').removeClass('ativo');
  129. $(this).addClass('ativo');
  130.  
  131. $.ajax({
  132. url: 'lib/Ranking',
  133. type: 'POST',
  134. dataType: 'JSON',
  135. data: {'rel': rel},
  136. beforeSend: function(){
  137. $('.conteudo-ranking-forum').prepend('<div id="loading"></div>');
  138. },success: function(data){
  139. setTimeout(function(){
  140. $('.conteudo-ranking-forum .box-rank:eq(4)').animate({'opacity':'0'}, function(){ $(this).remove()});
  141. }, 150)
  142.  
  143. setTimeout(function(){
  144. $('.conteudo-ranking-forum .box-rank:eq(3)').animate({'opacity':'0'}, function(){ $(this).remove()});
  145. }, 250)
  146.  
  147. setTimeout(function(){
  148. $('.conteudo-ranking-forum .box-rank:eq(2)').animate({'opacity':'0'}, function(){ $(this).remove()});
  149. }, 350)
  150.  
  151. setTimeout(function(){
  152. $('.conteudo-ranking-forum .box-rank:eq(1)').animate({'opacity':'0'}, function(){ $(this).remove()});
  153. }, 450)
  154.  
  155. setTimeout(function(){
  156. $('.conteudo-ranking-forum .box-rank:eq(0)').animate({'opacity':'0'}, function(){ $(this).remove()});
  157. $('.conteudo-ranking-forum').html('');
  158. }, 550);
  159.  
  160. setTimeout(function(){
  161. for (var i = 0; i < data.length; i++) {
  162. var Html = '<div class="box-rank" style="opacity:0;">';
  163. Html+= ' <div class="user '+data[i].pos+'">';
  164. Html+= ' <div class="habbo" style="background-image: url(https://www.habbo.com.br/habbo-imaging/avatarimage?&user='+data[i].autor+'&action=std&direction=3&head_direction=3&img_format=png&gesture=std&headonly=0&size=s);"></div>';
  165. Html+= ' </div>';
  166. Html+= ' <div class="lugar">'+(i+1)+'º</div>';
  167. Html+= ' <div class="nome">'+data[i].autor+'</div>';
  168. Html+= ' <div class="pontos"><b>'+data[i].pts+'</b> '+data[i].type+'</div>';
  169. Html+= '</div>';
  170.  
  171. $('.conteudo-ranking-forum').append(Html);
  172. $('.conteudo-ranking-forum .box-rank:eq('+i+')').animate({'opacity':'1'}, (i+1)*100);
  173.  
  174. }
  175.  
  176. }, 800);
  177.  
  178. setTimeout(function(){
  179. $('#loading').remove();
  180. }, 1100);
  181.  
  182.  
  183.  
  184.  
  185. }
  186. });
  187.  
  188. }
  189.  
  190. });
  191. },
  192.  
  193. Denunciar: function(id){
  194. $.ajax({
  195. url: 'lib/Sistem',
  196. type: 'post',
  197. data: {'id': id, 'tipo':'DenunciarForum'},
  198. beforeSend: function() {
  199. $('.denuciar').animate({'opacity': '.5'});
  200. },
  201. success: function(data) {
  202. $('.denuciar').animate({'opacity': '1'});
  203. Alerta.Init(data);
  204. }
  205. });
  206. }
  207. }
  208.  
  209.  
  210. var Usuario = {
  211. Login: function() {
  212. $('input[name="username"]').keyup(function() {
  213. var username = $('input[name="username"]').val();
  214.  
  215. if(username == ''){
  216. $('#avatarLogin').css('background-image', 'url(https://www.habbo.com.br/habbo-imaging/avatarimage?&user=Laerciocraq&action=std&direction=3&head_direction=3&img_format=png&gesture=std&headonly=0&size=l)');
  217. }else{
  218. $('#avatarLogin').css('background-image', 'url(https://www.habbo.com.br/habbo-imaging/avatarimage?&user='+username+'&action=std&direction=3&head_direction=3&img_format=png&gesture=std&headonly=0&size=l)');
  219. }
  220. });
  221.  
  222. $('#formLogin').submit(function(e) {
  223. e.preventDefault();
  224. var usuario = $('input[name="username"]').val();
  225. var senha = $('input[name="password"]').val();
  226. var manter = $('input[type="checkbox"]').is(':checked');
  227. if (senha == '' || senha == '') {
  228. alert('Os campos não podem ficar em branco.');
  229. }else {
  230. $.ajax({
  231. url: baseUrl+'/lib/Login',
  232. type: 'POST',
  233. dataType: 'Json',
  234. data: {'username': usuario,'password': senha},
  235. beforeSend: function() {
  236. $('#formLogin').animate({'opacity': '0.5'}, 100);
  237. },
  238. success: function(data) {
  239. $('#formLogin').animate({'opacity': '1'}, 100);
  240.  
  241. if(data['erro']){
  242. alert(data['erro']);
  243. }else{
  244. alert('Usuário logado com succeso!');
  245. location.reload();
  246. }
  247.  
  248.  
  249. }
  250. }).fail(function(data) {
  251. alert("Houve um erro ao conectar-se. Verifique seus dados, se o problema persistir, entre em contato com a administração.");
  252. console.log();
  253. });
  254. }
  255. })
  256. },
  257.  
  258. Registro: function(){
  259.  
  260. $('input[name="username"]').keyup(function() {
  261. var username = $('input[name="username"]').val();
  262.  
  263. if(username == ''){
  264. $('.avatar_username').css('background-image', 'url(https://www.habbo.com.br/habbo-imaging/avatarimage?&user=Bromarks&action=std&direction=2&head_direction=3&img_format=png&gesture=std&headonly=0&size=b)');
  265. }else{
  266. $('.avatar_username').css('background-image', 'url(https://www.habbo.com.br/habbo-imaging/avatarimage?&user='+username+'&action=std&direction=2&head_direction=3&img_format=png&gesture=std&headonly=0&size=b)');
  267. }
  268. });
  269.  
  270. $('.prox_1').click(function() {
  271. var username = $('input[name="username"]').val();
  272. var password = $('input[name="password"]').val();
  273. var password_r = $('input[name="password_r"]').val();
  274. var email = $('input[name="email"]').val();
  275.  
  276. if(username == '' || username.trim().length < 3) {
  277. Alerta.Init('O campo de usuário não pode ficar em branco ao ser menor que 3 caracteres.');
  278.  
  279. }else if(password == '' || password.trim().length < 6){
  280. Alerta.Init('Sua senha não pode ficar em branco ao ser menor que 6 caracteres.');
  281.  
  282. }else if(password != password_r){
  283. Alerta.Init('As senhas digitas não coincidem.');
  284.  
  285. }else if(!Email_Validation(email)){
  286. Alerta.Init('Digite um email valido.');
  287.  
  288. }else{
  289. Alerta.Init('Verificando se esses dados já foram usados...');
  290. $.ajax({
  291. url: baseUrl+'/lib/verificadados.php',
  292. type: 'POST',
  293. dataType: 'json',
  294. data: {'usuario': username},
  295. success: function(data){
  296. if(data['result'] == 'ok'){
  297. $('.etapas .etapa:eq(0)').addClass('concluido').removeClass('atual').next().addClass('atual');
  298. $('.tela_1').animate({'margin-top':'+=10px'}, 400).animate({'margin-top':'-=220px'}, 250);
  299. $('.nao-necessario').animate({'opacity':'1'});
  300. $('.hotel, .pc').removeClass('inativo');
  301.  
  302. $('.prox_2').click(function() {
  303.  
  304. $('.etapas .etapa:eq(1)').addClass('concluido').removeClass('atual').next().addClass('atual');
  305. $('.tela_1').animate({'margin-top':'+=10px'}, 400).animate({'margin-top':'-=220px'}, 250);
  306. $('.mao, .workers, .worker, .punk').removeClass('inativo');
  307.  
  308. });
  309.  
  310. $('.prox_3').click(function() {
  311. var pais = $('select[name="pais"]').val();
  312. var quarto = $('input[name="quarto"]').val();
  313. var grupo = $('input[name="grupo"]').val();
  314. var nick_2 = $('input[name="nick_2"]').val();
  315.  
  316. $('.etapas .etapa:eq(2)').addClass('concluido').removeClass('atual').next().addClass('atual');
  317. $('.tela_1').animate({'margin-top':'+=10px'}, 400).animate({'margin-top':'-=220px'}, 250);
  318. $('.nao-necessario').animate({'opacity':'0'});
  319. $('.porta, .beta, .park').removeClass('inativo');
  320.  
  321. $('.prox_4').click(function() {
  322.  
  323. var idade = $('input[name="idade"]').val();
  324. var escola = $('select[name="escola"]').val();
  325. var trabalho = $('input[name="trabalho"]').val();
  326. var tempo = $('input[name="tempo"]').val();
  327.  
  328. $.ajax({
  329. url: 'lib/Login',
  330. type: 'POST',
  331. dataType: 'json',
  332. data: {
  333. 'codigo': $('.codigo').html(),
  334. 'trabalho': trabalho,
  335. 'usuario': username,
  336. 'tipo': 'Registro',
  337. 'senha': password,
  338. 'escola': escola,
  339. 'quarto': quarto,
  340. 'email': email,
  341. 'idade': idade,
  342. 'tempo': tempo,
  343. 'grupo': grupo,
  344. 'nick_n': nick_2,
  345. 'pais': pais
  346. },beforeSend: function(){
  347. $('.tela_4').append('<div id="loading" style="top: 0; left: 0; right: 0;"></div>');
  348. },success: function(data) {
  349. $('#loading').remove();
  350.  
  351. if(data['erro']){
  352. Alerta.Init(data['erro']);
  353. }else{
  354. $('.etapas .etapa:eq(3)').addClass('concluido').removeClass('atual');
  355.  
  356. setTimeout(function(){
  357. location.href="index.php";
  358. }, 5000);
  359.  
  360. Alerta.Init(data['sucess']);
  361. Alerta.Init('Você será redirecionado, aguarde.');
  362. }
  363. }
  364. })
  365.  
  366.  
  367. });
  368.  
  369. });
  370.  
  371. }else{
  372. Alerta.Init(data['result']);
  373. var Verifica = false;
  374. }
  375. }
  376. });
  377.  
  378. }
  379.  
  380.  
  381. });
  382.  
  383. },
  384.  
  385. Logout:function(){
  386. $.ajax({
  387. url: baseUrl+'lib/Login',
  388. type: 'POST',
  389. data: {'tipo': 'Logout'},
  390. success:function(data){
  391. location.reload();
  392. Alerta.Init(data);
  393. }
  394. })
  395.  
  396. },
  397.  
  398. Denunciar: function(id, tp){
  399. $.ajax({
  400. url: baseUrl+'lib/Sistem',
  401. type: 'POST',
  402. dataType: 'json',
  403. data: {'id': id, 'Area':tp, 'tipo': 'Geral_c'},
  404. beforeSend: function(){
  405. $('.denunciaC[rel="'+id+'"]').animate({'opacity':'0.5'})
  406. },success: function(data){
  407. $('.denunciaC[rel="'+id+'"]').animate({'opacity':'1'})
  408. Alerta.Init(data['result']);
  409. }
  410.  
  411. })
  412. },
  413.  
  414. Pedidos: function(){
  415. $('#pedidos').submit(function(e) {
  416. e.preventDefault();
  417. var texto = $('textarea[name="texto_pedido"]').val();
  418. if(texto.length < 5){
  419. Alerta.Init('Seu pedido precisa ter pelo menos 5 caracteres');
  420. }else{
  421.  
  422. $.ajax({
  423. url: baseUrl+'lib/Sistem',
  424. type: 'POST',
  425. dataType: 'Json',
  426. data: {'texto': texto, 'tipo': 'Pedido'},
  427. beforeSend: function(){
  428. $('#pedidos').animate({'opacity':'0.5'})
  429. },success: function(data){
  430. console.log(data);
  431. $('#pedidos').animate({'opacity':'1'});
  432. if(data['erro']){
  433. Alerta.Init(data['erro']);
  434. }else{
  435. Alerta.Init(data['result']);
  436. }
  437.  
  438. if(data['result'] == 'Pedido enviado com sucesso!'){
  439. $('.no-blurred').removeClass('blurred'),
  440. $('#box-pedido').removeClass('ativo');
  441. }
  442. }
  443.  
  444. })
  445. }
  446.  
  447. });
  448. },
  449.  
  450. Perfil: function() {
  451. $('#perfilSubmit').submit(function(e) {
  452. e.preventDefault();
  453.  
  454. var recebe = $('.ftPerfil').attr('rel');
  455. var texto = $('textarea[name="texto_p"]').val();
  456. var privida = $('input[name="privada"]').is(":checked");
  457.  
  458. if(texto.length < 5){
  459. Alerta.Init('O texto do comentário precisa ter no minimo 5 caracteres.');
  460. }else{
  461. $.ajax({
  462. url: baseUrl+'lib/Comentar',
  463. type: 'POST',
  464. dataType: 'json',
  465. data: {'texto': texto, 'recebe': recebe, 'privada': privida, 'tipo':'perfil'},
  466. beforeSend: function(){
  467. $('#perfilSubmit').animate({'opacity':'0.5'});
  468. },success: function(data){
  469. $('#perfilSubmit').animate({'opacity':'1'});
  470.  
  471. if(data['erro']){
  472. Alerta.Init(data['erro']);
  473. }else{
  474. RefreshPerfil(recebe);
  475. }
  476. }
  477. });
  478. }
  479. });
  480. }
  481. }
  482.  
  483. var Voto = {
  484. Comentario: function(id, tipo, voto, div) {
  485. $.ajax({
  486. url: baseUrl+'lib/Votar_comentario',
  487. type: 'POST',
  488. dataType: 'json',
  489. data: {'id': id, 'tipo': tipo, 'voto': voto},
  490. beforeSend: function(){
  491. $('.btn[rel="'+div+'"]').animate({'opacity':'0.5'});
  492. },success: function(data){
  493. $('.btn[rel="'+div+'"]').animate({'opacity':'1'});
  494. if(!data['erro']){
  495. var Total = $('.btn[rel="'+div+'"]').html();
  496. $('.btn[rel="'+div+'"]').html((parseInt(Total)+1));
  497. }else{
  498. Alerta.Init(data['erro']);
  499. }
  500. }
  501.  
  502. })
  503.  
  504. },
  505.  
  506. Geral: function(id, tipo, voto, div) {
  507. $.ajax({
  508. url: 'lib/Votar',
  509. type: 'POST',
  510. dataType: 'json',
  511. data: {'id': id, 'tipo': tipo, 'voto': voto},
  512. beforeSend: function(){
  513. $(div).animate({'opacity':'0.5'});
  514. },success: function(data){
  515. $(div).animate({'opacity':'1'});
  516. if(!data['erro']){
  517. var Total = $(div).html();
  518. $(div).html((parseInt(Total)+1));
  519. }else{
  520. Alerta.Init(data['erro']);
  521. }
  522. }
  523.  
  524. })
  525. }
  526.  
  527. }
  528.  
  529. var Radio = {
  530. Start: function(i, tp) {
  531. $.ajax({
  532. url: '../../lib/status.php',
  533. type: 'GET',
  534. dataType: 'Json',
  535. data: {'op': 'View'},
  536. beforeSend:function(){
  537. if(tp != 'Avatar'){
  538. $(i+'[name="'+tp+'"]').html('...');
  539. }else{
  540. $('div[name="Avatar"]').css('background-image', 'url(https://www.habbo.com.br/habbo-imaging/avatarimage?&user=AutoFest&action=std&direction=3&head_direction=3&gesture=spk&headonly=0&size=b)')
  541. }
  542. },success:function(data) {
  543.  
  544. if(!i && !tp){
  545. $('div[name="Avatar"]').css('background-image', 'url(https://www.habbo.com.br/habbo-imaging/avatarimage?&user='+data['Locutor']+'&action=std&direction=3&head_direction=3&gesture=spk&headonly=0&size=b)')
  546. $('i[name="OuvType"]').html(data['Type']);
  547. $('span[name="Unicos"]').html(data['Unicos']);
  548. $('i[name="Programa"]').html(data['Programa']);
  549. $('div[name="Locutor"]').html(data['Locutor']);
  550.  
  551. if(data['Alerta'] > 0){
  552. Alerta.TempoReal();
  553. }
  554. }else{
  555. if(tp == 'Avatar'){
  556. $('div[name="Avatar"]').css('background-image', 'url(https://www.habbo.com.br/habbo-imaging/avatarimage?&user='+data['Locutor']+'&action=std&direction=3&head_direction=3&gesture=spk&headonly=0&size=b)')
  557.  
  558. }else{
  559. $(i+'[name="'+tp+'"]').html(data[tp]);
  560. $('i[name="OuvType"]').html(data['Type']);
  561.  
  562. }
  563.  
  564. }
  565.  
  566. $('div[name="PFT"]').css('background-image', 'url(https://www.habbo.com.br/habbo-imaging/avatarimage?&user='+data['horario'][0]['dj']+'&action=std&direction=2&head_direction=3&gesture=sml&headonly=0&size=b)')
  567. $('div[name="PDJ"]').html(data['horario'][0]['dj']);
  568. $('div[name="PPG"]').html('<span>com</span> '+ data['horario'][0]['pg']);
  569. $('div[name="PHR"]').html(data['horario'][0]['duracao']);
  570.  
  571. }
  572. })
  573. }
  574.  
  575. }
  576.  
  577. var Loja = {
  578. Paginacao: function(id) {
  579. $.ajax({
  580. url: 'lib/LojaPgt',
  581. type: 'POST',
  582. data: {'id': id},
  583. beforeSend: function(){
  584. $('.recebeLoja').animate({'opacity':'0.5'});
  585. },success: function(data) {
  586. $('.recebeLoja').animate({'opacity':'1'}).html(data);
  587. }
  588. })
  589.  
  590. },
  591.  
  592. Compra:function(id){
  593. $.ajax({
  594. url: 'lib/Loja',
  595. type: 'post',
  596. data: {'id': id},
  597. success:function(data){
  598. Alerta.Init(data);
  599. }
  600. });
  601. }
  602. }
  603.  
  604. var Format = {
  605. Remover: function() {
  606. $("#NOTICIAS *").css({
  607. 'font-family': 'Verdana',
  608. 'font-size': '14px'
  609. });
  610. }
  611. }
  612.  
  613. var Pokemon = {
  614. Captura: function() {
  615. $('.pokemon').on('click', function(e) {
  616. e.preventDefault();
  617. var pokemonId = $(this).attr('data-id');
  618. $.ajax({
  619. url: 'lib/Pokemon',
  620. type: 'POST',
  621. dataType: 'json',
  622. data: {'pokemonId': pokemonId, 'tipo':'capturar'},
  623. beforeSend: function(){
  624. },
  625. success: function(data){
  626. if (!data['erro']) {
  627. Alerta.Init(data['result']);
  628. } else {
  629. Alerta.Init(data['erro']);
  630. }
  631. }
  632. })
  633. });
  634. },
  635. Cria: function() {
  636. $.ajax({
  637. url: 'lib/Pokemon',
  638. type: 'POST',
  639. dataType: 'json',
  640. data: {'tipo': 'criar'},
  641. success: function(data) {
  642. if (data['result']) {
  643. Alerta.Pok('Dj.bigbang diz:', data['result']);
  644. }
  645. }
  646. });
  647. },
  648. Comentar: function(){
  649. var comentario = $('#comentario').val();
  650. var idNoticia = document.getElementById("comentario").getAttribute("noticiaId");
  651. var nota = $('#nota-recebe').val();
  652. if(comentario.length < 5){
  653. alert('O texto do comentário precisa ter no minimo 5 caracteres.')
  654. }else{
  655. $.ajax({
  656. type:'POST',
  657. url: baseUrl+'/lib/Comentar',
  658. data:{'comentario':comentario, 'idNew':idNoticia},
  659. beforeSend: function(){
  660. $('.box-padrao').animate({'opacity':'0.5'});
  661. },success: function(data){
  662. $('.box-padrao').animate({'opacity':'1'});
  663. if(html == 'aguarde'){
  664. alert('Você está indo rápido demais.');
  665. }
  666.  
  667. }
  668. });
  669. }
  670. },
  671. Nota:function(modo){
  672. if(modo == 'positivo'){
  673. $('#content_votar_positivo_ler_ver').animate({opacity:0.5}).css('cursor','default');
  674. $('#content_votar_negativo_ler_ver').css('opacity',1).css('cursor','pointer');
  675. }
  676. if(modo == 'negativo'){
  677. $('#content_votar_negativo_ler_ver').animate({opacity:0.5}).css('cursor','default');
  678. $('#content_votar_positivo_ler_ver').css('opacity',1).css('cursor','pointer');
  679. }
  680. $('#nota-recebe').val(modo);
  681. },votar:function(tipo){
  682. $.ajax({
  683. type:'POST',
  684. url:'ajax/Leitura-Votar',
  685. data:{'id':'<?php echo $id; ?>', 'modo':'noticia', 'tipo':tipo},
  686. success:function(html){
  687. //alert('votou com sucesso!');
  688. }
  689. })
  690. }
  691. }
  692. $(function(){
  693. $('#enviar-comentario').click(function(){
  694. Pokemon.Comentar();
  695. });
  696. });
  697.  
  698.  
  699. $(document).ready(function(){
  700. setTimeout(function(){
  701. Pokemon.Cria()}, 60000);
  702. Pokemon.Captura();
  703. Format.Remover();
  704. Forum.Ranking();
  705. Usuario.Registro();
  706. Usuario.Login();
  707. Radio.Start();
  708. Usuario.Pedidos();
  709. Usuario.Perfil();
  710. //Alerta.TempoReal();
  711.  
  712. setInterval(function(){
  713. Radio.Start();
  714. }, 10000);
  715.  
  716. $('div[name="Avatar"]').click(function() {
  717. Radio.Start('div', 'Avatar');
  718. });
  719.  
  720. $('span[name="Unicos"]').click(function() {
  721. Radio.Start('span', 'Unicos');
  722. });
  723.  
  724. $('i[name="Programa"]').click(function() {
  725. Radio.Start('i', 'Programa');
  726. });
  727.  
  728. $('div[name="Locutor"]').click(function() {
  729. Radio.Start('div', 'Locutor');
  730. });
  731.  
  732. $('.box-membro').click(function() {
  733. $('.box-membro').removeClass('e-ativo');
  734. $(this).addClass('e-ativo');
  735. Equipe($(this).attr('icone'), $(this).attr('nome'), $(this).attr('rel'));
  736.  
  737. });
  738.  
  739. $('.ver__mais__').click(function() {
  740. if(!$(this).hasClass('ativo')){
  741. $('.ver__mais__').removeClass('ativo');
  742. $('.ver__mais__').next().css({'overflow':'hidden','height':'0px'});
  743. $(this).addClass('ativo');
  744. $(this).next().removeAttr('style');
  745. }else{
  746. $(this).removeClass('ativo');
  747. $(this).next().css({'overflow':'hidden','height':'0px'});
  748. }
  749.  
  750. });
  751.  
  752. $('.btnApagarP').click(function() {
  753. var self = $(this);
  754. var id = self.attr('rel');
  755.  
  756. $.ajax({
  757. url: 'lib/Sistem',
  758. type: 'post',
  759. dataType: 'json',
  760. data: {'id': id, 'tipo':'apagar'},
  761. beforeSend:function(){
  762. self.animate({'opacity':'0.5'});
  763. },success:function(data){
  764. self.animate({'opacity':'1'});
  765.  
  766. if(data['erro']){
  767. Alerta.init(data['erro'])
  768. }else{
  769. self.parent().parent().remove();
  770. }
  771. }
  772. })
  773.  
  774. });
  775.  
  776.  
  777. })
  778.  
  779.  
  780. /*
  781. * Plugin de paginacao ColdHabbo
  782. * Created by Laercio Calheiros
  783. * Uso por 3º não autorizado
  784. */
  785.  
  786. $.fn.paginacao = function(options) {
  787. var defaults = {
  788. 'url' : null,
  789. 'type' : null,
  790. 'dataType' : null,
  791. 'tipo' : null,
  792. 'direcao' : null,
  793. 'proximo' : null,
  794. 'anterior' : null,
  795. 'box_princ' : null,
  796. 'total' : null,
  797. 'movimento' : null,
  798. 'result' : null,
  799. 'init' : null,
  800. 'refresh' : null,
  801. 'pg_atual' : 1,
  802. 'pg_aberta' : 1,
  803. 'cadastros' : 0,
  804. };
  805.  
  806. var config = $.extend({}, defaults, options);
  807. config.init = 'A páginação para "' + this.selector + '" foi iniciada.';
  808. var pg_total = Number(config.cadastros/config.total);
  809. var element = this.selector;
  810. config.box_princ = element;
  811. console.log(config.init);
  812.  
  813. $(config.refresh).click(function() {
  814. $(config.box_princ).animate({'opacity':'0.5'});
  815. config.pg_atual = 1;
  816. config.pg_aberta = 0;
  817. $(config.box_princ).animate({'margin-left':'0'});
  818. $(config.box_princ).animate({'margin-top':'0'});
  819.  
  820. $.ajax({
  821. url: 'lib/Refresh',
  822. type: config.type,
  823. data: {'tipo': config.tipo},
  824. success:function(data){
  825. $(config.box_princ).animate({'opacity':'1'}).html(data);
  826. }
  827. });
  828.  
  829. });
  830.  
  831. if(config.tipo == 'noticia'){
  832. $('.icone-categoria-noticia').click(function() {
  833. var id = $(this).data('id');
  834. if(!$(this).hasClass('ativo')){
  835. $('.icone-categoria-noticia').removeClass('ativo');
  836. $(this).addClass('ativo');
  837.  
  838. $.ajax({
  839. url: 'lib/Noticia',
  840. type: config.type,
  841. data: {'id':id},
  842. beforeSend:function(){
  843. $(config.box_princ).animate({'opacity':'0.5'});
  844. },success:function(data){
  845. config.pg_atual = 1;
  846. config.pg_aberta = 0;
  847. $(config.box_princ).animate({'margin-left':'0'});
  848. $(config.box_princ).animate({'margin-top':'0'});
  849. $(config.box_princ).animate({'opacity':'1'}).html(data);
  850. }
  851. });
  852. }
  853. });
  854.  
  855. $('.searchNews').submit(function(e) {
  856. e.preventDefault();
  857. var val = $('input[name="search"]').val();
  858.  
  859. $.ajax({
  860. url: 'lib/Noticia',
  861. type: config.type,
  862. data: {'search':val},
  863. beforeSend:function(){
  864. $(config.box_princ).animate({'opacity':'0.5'});
  865. },success:function(data){
  866. config.pg_atual = 1;
  867. config.pg_aberta = 0;
  868. $(config.box_princ).animate({'margin-left':'0'});
  869. $(config.box_princ).animate({'margin-top':'0'});
  870. $(config.box_princ).animate({'opacity':'1'}).html(data);
  871. }
  872. });
  873.  
  874.  
  875. });
  876. }
  877.  
  878.  
  879. $(config.proximo).click(function() {
  880. if(config.pg_atual < pg_total){
  881. pagination.next();
  882. }else{
  883. $(config.proximo).animate({'opacity':'0.5'}, 0);
  884. $(config.proximo).css('cursor','default');
  885. }
  886.  
  887. if(config.pg_atual < 1) {
  888. $(config.anterior).animate({'opacity':'0.5'}, 0);
  889. $(config.anterior).css('cursor','default');
  890. }else{
  891. $(config.anterior).animate({'opacity':'1'}, 0);
  892. $(config.anterior).css('cursor','pointer');
  893. }
  894. });
  895.  
  896. $(config.anterior).click(function() {
  897. pagination.prev();
  898. var pg_total = Number(config.cadastros/config.total);
  899. if(config.pg_aberta >= pg_total){
  900. $(config.proximo).animate({'opacity':'1'}, 0);
  901. $(config.proximo).css('cursor','pointer');
  902. }
  903. });
  904.  
  905. var pagination = {
  906. next:function(){
  907. if(config.pg_atual >= config.pg_aberta){
  908. $.ajax({
  909. url: config.url,
  910. type: config.type,
  911. dataType: config.dataType,
  912. data: {'tipo': config.tipo, 'pg':config.pg_atual+1},
  913. beforeSend:function(){
  914. $(config.box_princ).animate({'opacity':'0.5'});
  915. },success:function(data){
  916. config.result(data, element);
  917. if(config.direcao == 'left'){
  918. $(config.box_princ).animate({'opacity':'1'});
  919. $(config.box_princ).animate({'margin-left':'+=30px'}, 600);
  920. $(config.box_princ).animate({'margin-left':'-='+config.movimento+'px'}, 300);
  921. }else{
  922. $(config.box_princ).animate({'opacity':'1'});
  923. $(config.box_princ).animate({'margin-top':'+=30px'}, 600);
  924. $(config.box_princ).animate({'margin-top':'-='+config.movimento+'px'}, 300);
  925. }
  926. config.pg_atual++;
  927. config.pg_aberta++;
  928.  
  929. if(config.pg_atual < pg_total){
  930. $(config.proximo).animate({'opacity':'1'}, 0);
  931. $(config.proximo).css('cursor','pointer');
  932. }else{
  933. $(config.proximo).animate({'opacity':'0.5'}, 0);
  934. $(config.proximo).css('cursor','default');
  935. }
  936.  
  937. }
  938. })
  939.  
  940. }else{
  941. if(config.direcao == 'left'){
  942. $(config.box_princ).animate({'margin-left':'+=30px'}, 600);
  943. $(config.box_princ).animate({'margin-left':'-='+config.movimento+'px'}, 300);
  944. }else{
  945. $(config.box_princ).animate({'margin-top':'+=30px'}, 600);
  946. $(config.box_princ).animate({'margin-top':'-='+config.movimento+'px'}, 300);
  947. }
  948. config.pg_atual++;
  949.  
  950. }
  951. },
  952.  
  953. prev:function(){
  954. if(config.pg_atual > 1){
  955. $(config.box_princ).animate({'opacity':'1'});
  956.  
  957. if(config.direcao == 'left'){
  958. $(config.box_princ).animate({'margin-left' : '-=30px'}, 400);
  959. $(config.box_princ).animate({'margin-left' : '+='+config.movimento+'px'}, 400);
  960. }else{
  961. $(config.box_princ).animate({'margin-top' : '-=30px'}, 400);
  962. $(config.box_princ).animate({'margin-top' : '+='+config.movimento+'px'}, 400);
  963.  
  964. }
  965. config.pg_atual--;
  966. if(config.pg_atual <= 1) {
  967. $(config.anterior).animate({'opacity':'0.5'}, 0);
  968. $(config.anterior).css('cursor','default');
  969. }else{
  970. $(config.anterior).animate({'opacity':'1'}, 0);
  971. $(config.anterior).css('cursor','pointer');
  972. }
  973. }else{
  974. $(config.anterior).animate({'opacity':'0.5'}, 0);
  975. $(config.anterior).css('cursor','default');
  976. }
  977.  
  978. }
  979.  
  980. }
  981. }
  982.  
  983.  
  984. function Email_Validation(mail){
  985. var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  986. return regex.test(mail);
  987. }
  988.  
  989. function Equipe(icone, nome, id){
  990. $('.add_equipe .icone').css('background-image', 'url('+icone+')');
  991. $('.add_equipe span').html(nome);
  992. $.ajax({
  993. url: 'lib/Equipe',
  994. type: 'POST',
  995. dataType: 'HTML',
  996. data: {'id': id},
  997. beforeSend: function(){
  998. $('.add_membros').animate({'opacity':'0.5'});
  999. },success: function(data){
  1000. $('.add_membros').animate({'opacity':'1'}).html(data);
  1001. }
  1002. })
  1003.  
  1004. }
  1005.  
  1006. function RefreshPerfil(user){
  1007. $.ajax({
  1008. url: 'lib/RefreshPerfil',
  1009. type: 'POST',
  1010. data: {'user': user},
  1011. beforeSend: function(){
  1012. $('.perfilComentarios').animate({'opacity':'0.5'});
  1013. },success:function(data){
  1014. $('.perfilComentarios').html(data).animate({'opacity':'1'});
  1015. }
  1016. })
  1017.  
  1018. }
  1019.  
  1020. function setBBCode(elementID, openTag, closeTag) {
  1021. var textArea = $('#' + elementID);
  1022. var len = textArea.val().length;
  1023. var start = textArea[0].selectionStart;
  1024. var end = textArea[0].selectionEnd;
  1025. var selectedText = textArea.val().substring(start, end);
  1026. var replacement = openTag + selectedText + closeTag;
  1027. textArea.val(textArea.val().substring(0, start) + replacement + textArea.val().substring(end, len)).focus();
  1028. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement