Guest User

Untitled

a guest
Dec 18th, 2013
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /// <reference path="jquery.d.ts" />
  2. /// <reference path="swf.ts" />
  3. function CheckTextLenghtAndCountDown(taDescription, divCountDownTaDescription, maxLenght) {
  4.     var text = new String(taDescription.val());
  5.     var zbyva = maxLenght - text.length;
  6.     divCountDownTaDescription.text(zbyva);
  7.     divCountDownTaDescription.removeClass("lightgreen");
  8.     divCountDownTaDescription.removeClass("red");
  9.  
  10.     if (zbyva > -1) {
  11.         divCountDownTaDescription.addClass("lightgreen");
  12.     } else {
  13.         divCountDownTaDescription.addClass("red");
  14.     }
  15. }
  16.  
  17. $(document).ready(function () {
  18.     var txtName = $("#txtName");
  19.  
  20.     $(txtName.keyup(function (e) {
  21.         $("#txtGitHubName").val(txtName.val());
  22.     }));
  23.  
  24.     var spanCountDownDescription = $("#spanCountDownDescription");
  25.     var taDescription = $("#taDescription");
  26.  
  27.     //e: JQueryEventObject
  28.     taDescription.bind('input propertychange', (function () {
  29.         CheckTextLenghtAndCountDown(taDescription, spanCountDownDescription, 8000);
  30.     }));
  31.  
  32.     var divTxtVersion = $("#divTxtVersion");
  33.     var txtVersion = $("#txtVersion");
  34.  
  35.     txtVersion.bind('input propertychange', (function () {
  36.         var success = true;
  37.         var text = txtVersion.val();
  38.         var array = ReturnOccurencesOfString(text, ".");
  39.         if (array.length != 3) {
  40.             success = false;
  41.         }
  42.         if (success) {
  43.             for (var i = 1; i < array.length; i++) {
  44.                 if (array[i] - 1 == array[i - 1]) {
  45.                     success = false;
  46.                     break;
  47.                 }
  48.             }
  49.         }
  50.         if (success) {
  51.             var texty = new String(text).split(".");
  52.             for (var i = 0; i < texty.length; i++) {
  53.                 if (!IsInteger(texty[i])) {
  54.                     success = false;
  55.                     break;
  56.                 }
  57.             }
  58.         }
  59.         divTxtVersion.removeClass("error-state");
  60.         divTxtVersion.removeClass("success-state");
  61.         if (success) {
  62.             divTxtVersion.addClass("success-state");
  63.         } else {
  64.             divTxtVersion.addClass("error-state");
  65.         }
  66.     }));
  67.  
  68.     var divCountDownTaChangelog = $("#divCountDownTaChangelog");
  69.     var taChangelog = $("#taChangelog");
  70.  
  71.     taChangelog.bind('input propertychange', (function () {
  72.         CheckTextLenghtAndCountDown(taChangelog, divCountDownTaChangelog, 8000);
  73.     }));
  74. });
Advertisement
Add Comment
Please, Sign In to add comment