Advertisement
Guest User

push

a guest
Jun 23rd, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.27 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <title>PUSH JS</title>
  8. <link href="http://www.jqueryscript.net/css/jquerysctipttop.css" rel="stylesheet" type="text/css">
  9. <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  10. <style>
  11. body { background-color:#fafafa; font-family:'Roboto';}
  12. h1 { margin:150px auto 30px auto;}
  13. </style>
  14. </head>
  15.  
  16. <body>
  17.  
  18. <div class="container">
  19.  
  20.  
  21. <form action="" method="POST" role="form">
  22.  
  23. <div class="form-group">
  24. <label for="">Título</label>
  25. <input type="text" class="form-control" id="title" value="Novo Cliente" placeholder="Título do Lembrete" required>
  26. <label for="">Horário</label>
  27. <select id="feedback" class="form-control">
  28. <option value="600000">10 minutos</option>
  29. <option value="1800000">30 minutos</option>
  30. <option value="3600000">60 minutos</option>
  31. </select>
  32. <label for="">Minha Mensagem de Alerta</label>
  33. <textarea placeholder="Mensagem do Alerta" id="message" value="Você tem um novo contato no Whatszapp! Clique aqui!" class="form-control" required>Você tem um novo contato no Whatszapp! Clique aqui!</textarea>
  34. </div>
  35.  
  36. <button id="enviar" type="submit" class="btn btn-success"> <span class="glyphicon glyphicon-ok" aria-hidden="true"></span>Avisa-me!</button>
  37. </form>
  38.  
  39. </div>
  40.  
  41. <script src="http://code.jquery.com/jquery-1.12.4.min.js"></script>
  42. <script>
  43. var myFunction = function() {
  44. confirm('Você tem um cliente para atender!');
  45. };
  46. var myImg = "http://leadsback.com.br/app/wp-content/uploads/2018/06/iconmonstr-whatsapp-2-240-1.png";
  47.  
  48. $("form").submit(function(event) {
  49. event.preventDefault();
  50.  
  51. var options = {
  52. title: $("#title").val(),
  53. options: {
  54. body: $("#message").val(),
  55. icon: myImg,
  56. lang: 'pt-BR',
  57. onClick: myFunction
  58. }
  59. };
  60. console.log(options);
  61. $("#easyNotify").easyNotify(options);
  62. });
  63. </script>
  64. <script type="text/javascript">
  65.  
  66. var _gaq = _gaq || [];
  67. _gaq.push(['_setAccount', 'UA-36251023-1']);
  68. _gaq.push(['_setDomainName', 'jqueryscript.net']);
  69. _gaq.push(['_trackPageview']);
  70.  
  71. (function() {
  72. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  73. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  74. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  75. })();
  76.  
  77. </script>
  78.  
  79. <script>
  80. $('#enviar').click(function(){
  81. var valFeed = $("#feedback option:selected").val ();
  82. if(valFeed != 0) {
  83. setTimeout(myFunction,valFeed);
  84. }
  85. });
  86. </script>
  87.  
  88.  
  89. <script>(function($) {
  90.  
  91. $.fn.easyNotify = function(options) {
  92.  
  93. var settings = $.extend({
  94. title: "Notification",
  95. options: {
  96. body: "",
  97. icon: "",
  98. lang: 'pt-BR',
  99. onClose: "",
  100. onClick: "",
  101. onError: ""
  102. }
  103. }, options);
  104.  
  105. this.init = function() {
  106. var notify = this;
  107. if (!("Notification" in window)) {
  108. alert("This browser does not support desktop notification");
  109. } else if (Notification.permission === "granted") {
  110.  
  111. var notification = new Notification(settings.title, settings.options);
  112.  
  113. notification.onclose = function() {
  114. if (typeof settings.options.onClose == 'function') {
  115. settings.options.onClose();
  116. }
  117. };
  118.  
  119. notification.onclick = function(){
  120. if (typeof settings.options.onClick == 'function') {
  121. settings.options.onClick();
  122. }
  123. };
  124.  
  125. notification.onerror = function(){
  126. if (typeof settings.options.onError == 'function') {
  127. settings.options.onError();
  128. }
  129. };
  130.  
  131. } else if (Notification.permission !== 'denied') {
  132. Notification.requestPermission(function(permission) {
  133. if (permission === "granted") {
  134. notify.init();
  135. }
  136.  
  137. });
  138. }
  139.  
  140. };
  141.  
  142. this.init();
  143. return this;
  144. };
  145.  
  146. }(jQuery));</script>
  147. </body>
  148. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement