1. JavaScript / Говнокод #23542

    0

    1. 1
    2. 2
    if(services_type == 3) var checked = 1;
    else var checked = 0;

    fellownik, 16 Ноября 2017

    Комментарии (16)
  2. JavaScript / Говнокод #23527

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    function checkAnswer(lastId, connectionString, success, unsuccess, installationNumber) {
      var result;
      for(var i=0;i<3*15/*15min*/;i++) {
        Delay(periodCheckingComponentsInstalled, "Waiting components to be installed");
        result = getDataFromDB(connectionString, lastId);
        var k = [];
        for(var i=0;i<success.length; i++) {
          k.push(false);
        }
        
        for(var i=0;i<success.length;i++) {
          if ((success[i] == "RemoteSuccess") ||  (success[i] == "RemoteUnSuccess")) {
            k[i] = true;
            break;
          }
          else {
            for(var j=0;j<result.length ; j++) {
              if (result[j].length > 40) {
                k[i] = includeArray(result, success[i]);//40 symb
                if (includeArray(result, unsuccess[i])) Log.Error("error while installing, number installation = " + installationNumber);
              }
            }
          }
        }
        var bool = true;
        for (var i=0;i<success.length; i++) {
          bool = bool&&k[i];
        } 
        if (bool) return true; else continue;
        return false;
      }
    }

    Остался скрипт от тестировщика. Блядь, и такого там с мегабайт.

    fluttr, 13 Ноября 2017

    Комментарии (17)
  3. JavaScript / Говнокод #23526

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    /**
     * Queries the DOM for the HTML element based on selector string passed.
     * @param {String} selector Selector we are querying for.
     * @param {String} [parent] Parent is optional, if passed the function will look for a child element of that parent.
     * @param {Boolean} [returnEmptyList] If set to true the function won't throw an error even if the element is not found.
     * @return {Array} HTML objects.
     */
    function getEl( selector, parent, returnEmptyList )
    {
        var classOnly,
            match,
            elPrefix,
            selPrefix,
            context,
            safeNode,
            nodes;
    
        classOnly = /^\.([\w\-]+)$/;
        match = classOnly.exec( selector );
        elPrefix = '.js-';
        selPrefix = selector.substring( 0, 4 );
    
        if ( ( selPrefix !== elPrefix || !typeCheck.isString( selector ) ) && match !== null )
        {
            throw new Error( 'Please make sure you input a valid class name that begins with a proper prefix.' );
        }
    
        if ( typeCheck.isString( parent ) )
        {
            context = document.getElementsByClassName( parent.substring( 1 ) )[ 0 ];
        }
        else if ( typeCheck.isElement( parent ) )
        {
            context = parent;
        }
        else
        {
            context = document;
        }
    
        nodes = match === null ? context.querySelectorAll( selector ) : context.getElementsByClassName( match[ 1 ] );
    
        safeNode = nodes.length > 0 && nodes;
    
        if ( safeNode || !safeNode && returnEmptyList )
        {
            return [].slice.call( nodes ); //converts it to a proper array.
        }
        else
        {
            throw new Error( 'Element with selector "' + selector + '" does not exist on the page.' );
        }
    }

    Koren, 13 Ноября 2017

    Комментарии (0)
  4. JavaScript / Говнокод #23522

    +2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    function isLogged() {
              return '0';
              return '';
    }
    
    function getForumPrefix() {
             return 'forum/';
    }

    https://dota2.ru/forum/

    GreatMASTERcpp, 13 Ноября 2017

    Комментарии (12)
  5. JavaScript / Говнокод #23499

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    ;(function($) {
    	"use strict";
    
    	var rules = {
    		'~': 'Ё',
    		'`': 'ё',
    		'q': 'й',
    		'w': 'ц',
    		'e': 'у',
    		'r': 'к',
    		't': 'е',
    		'y': 'н',
    		'u': 'г',
    		'i': 'ш',
    		'o': 'щ',
    		'p': 'з',
    		'a': 'ф',
    		's': 'ы',
    		'd': 'в',
    		'f': 'а',
    		'g': 'п',
    		'h': 'р',
    		'j': 'о',
    		'k': 'л',
    		'l': 'д',
    		'z': 'я',
    		'x': 'ч',
    		'c': 'с',
    		'v': 'м',
    		'b': 'и',
    		'n': 'т',
    		'm': 'ь',
    		'Q': 'Й',
    		'W': 'Ц',
    		'E': 'У',
    		'R': 'К',
    		'T': 'Е',
    		'Y': 'Н',
    		'U': 'Г',
    		'I': 'Ш',
    		'O': 'Щ',
    		'P': 'З',
    		'A': 'Ф',
    		'S': 'Ы',
    		'D': 'В',
    		'F': 'А',
    		'G': 'П',
    		'H': 'Р',
    		'J': 'О',
    		'K': 'Л',
    		'L': 'Д',
    		'Z': 'Я',
    		'X': 'Ч',
    		'C': 'С',
    		'V': 'М',
    		'B': 'И',
    		'N': 'Т',
    		'M': 'Ь',
    		'[': 'х',
    		'{': 'Х',
    		']': 'ъ',
    		'}': 'Ъ',
    		';': 'ж',
    		':': 'Ж',
    		"'": 'э',
    		'"': 'Э',
    		',': 'б',
    		'<': 'Б',
    		'.': 'ю',
    		'>': 'Ю',
    	};

    На jcat.ru вот сие чудо

    unkwua, 07 Ноября 2017

    Комментарии (2)
  6. JavaScript / Говнокод #23491

    +2

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    // куча if и небольшой кусок логики
    // ...
                   } else {
                      response["message"] = "Access Denied";
                      response.shortlist = undefined;
                      callback(response);
                    }
                  } else {
                    response["message"] = "Access Denied";
                    response.shortlist = undefined;
                    callback(response);
                  }
                } else {
                  response["message"] = "Access Denied";
                  response.shortlist = undefined;
                  callback(response);
                }
              });
            } else {
              response["message"] = "Access Denied";
              response.shortlist = undefined;
              callback(response);
            }
          } else {
            response["message"] = "Access Denied";
            response.shortlist = undefined;
            callback(response);
          }
        } else {
          response["message"] = "Access Denied";
          response.shortlist = undefined;
          callback(response);
        }
      } else {
        response["message"] = "Invalid Method";
        response.shortlist = undefined;
        callback(response);
      }

    rkgrep, 04 Ноября 2017

    Комментарии (41)
  7. JavaScript / Говнокод #23475

    +2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    public do(action: 'un' | 're'): void {
        const result = (<any>this._appApi.app.documentManager.current)[action + 'do']();
        if (!result.success) this._toastService.error(result.errorMessage, `Ошибка ${action}do`);
    }
    
     <button (click)="do('un')" title="Отменить"><i class="material-icons md-36">undo</i></button>
     <button (click)="do('re')" title="Повторить"><i class="material-icons md-36">redo</i></button>

    mazhuravlev, 01 Ноября 2017

    Комментарии (51)
  8. JavaScript / Говнокод #23462

    +2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    var CodeMirror = require("codemirror");
    var Thrift = require("thrift.js");
    require("./src/my.css");
    include(`gen-js/test_types.js')
    include(`gen-js/TestServ.js')
    include(`src/main.js')

    Против m4 нет приёма.

    CHayT, 29 Октября 2017

    Комментарии (149)
  9. JavaScript / Говнокод #23459

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    function CountBack_slider(secs,iid,j_timer) {
    	if (secs < 0) {
    		document.getElementById(iid).innerHTML = FinishMessage;
    		document.getElementById('caption'+j_timer).style.display = "none";
    		document.getElementById('heading'+j_timer).style.display = "none";
    		return;
    	}
    	DisplayStr = DisplayFormat.replace(/%%D%%/g, calcage(secs,86400,100000));
    	DisplayStr = DisplayStr.replace(/%%H%%/g, calcage(secs,3600,24));
    	DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(secs,60,60));
    	DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(secs,1,60));
    	
    	var elems = document.getElementsByTagName('*'), i;
    	for (i in elems) {
    		if((' ' + elems[i].className + ' ').indexOf(' ' + iid + ' ')
    				> -1) {
    			elems[i].innerHTML = DisplayStr;
    		}
    	}
    	
    	jQuery('.'+iid).innerHTML = DisplayStr;
    	  if (CountActive)
    		setTimeout(function(){CountBack_slider((secs+CountStepper),iid,j_timer)}, SetTimeOutPeriod);
    }

    Работаю с купленным html5-шаблоном.
    В шаблоне jq (и еще куча всякого хлама) подключен.
    Кодили с мыслью "работает и *уй с ним".

    Developer, 27 Октября 2017

    Комментарии (0)
  10. JavaScript / Говнокод #23457

    +1

    1. 1
    https://s1.postimg.org/9ay7hrf7fj/js-love-forever.png

    heart, heart, JavaScript!

    wvxvw, 26 Октября 2017

    Комментарии (37)