ЙажаСценарий / Говнокод #919 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
f = 0;
while (f != -1) {
f = title.indexOf("<img ");
if (f == -1 ) { f = title.indexOf("< img "); }
if (f == -1 ) { f = title.indexOf("<  img "); }
if (f == -1 ) { f = title.indexOf("<IMG "); }
if (f == -1 ) { f = title.indexOf("< IMG "); }
if (f == -1 ) { f = title.indexOf("<  IMG "); }
if ( f != -1 ) {
    t = -1;
    for (i = f ; i < title.length ; i++) {
        if ( title.substr(i, 1) == ">" ) { t = i ; i = title.length; }
    }
    if (t != -1) {
        ttl = title;
        title = ttl.substring(0, f) + ttl.substring(t + 1, title.length);
    }
}

Индия ближе чем ты думаешь, %username%

guest guest, (Updated )

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

ЙажаСценарий / Говнокод #915 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  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
var CanvasText = {
        /** The letters definition. It is a list of letters, 
         * with their width, and the coordinates of points compositing them.
         * The syntax for the points is : [x, y], null value means "pen up"
         */
        letters: {
                '\n':{ width: -1, points: [] },
                ' ': { width: 10, points: [] },
                '!': { width: 10, points: [[5,21],[5,7],null,[5,2],[4,1],[5,0],[6,1],[5,2]] },
                '"': { width: 16, points: [[4,21],[4,14],null,[12,21],[12,14]] },
                '#': { width: 21, points: [[11,25],[4,-7],null,[17,25],[10,-7],null,[4,12],[18,12],null,[3,6],[17,6]] },
                '$': { width: 20, points: [[8,25],[8,-4],null,[12,25],[12,-4],null,[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]] },
                '%': { width: 24, points: [[21,21],[3,0],null,[8,21],[10,19],[10,17],[9,15],[7,14],[5,14],[3,16],[3,18],[4,20],[6,21],[8,21],null,[17,7],[15,6],[14,4],[14,2],[16,0],[18,0],[20,1],[21,3],[21,5],[19,7],[17,7]] },
                '&': { width: 26, points: [[23,12],[23,13],[22,14],[21,14],[20,13],[19,11],[17,6],[15,3],[13,1],[11,0],[7,0],[5,1],[4,2],[3,4],[3,6],[4,8],[5,9],[12,13],[13,14],[14,16],[14,18],[13,20],[11,21],[9,20],[8,18],[8,16],[9,13],[11,10],[16,3],[18,1],[20,0],[22,0],[23,1],[23,2]] },
                '\'':{ width: 10, points: [[5,19],[4,20],[5,21],[6,20],[6,18],[5,16],[4,15]] },
                '(': { width: 14, points: [[11,25],[9,23],[7,20],[5,16],[4,11],[4,7],[5,2],[7,-2],[9,-5],[11,-7]] },
                ')': { width: 14, points: [[3,25],[5,23],[7,20],[9,16],[10,11],[10,7],[9,2],[7,-2],[5,-5],[3,-7]] },
                '*': { width: 16, points: [[8,21],[8,9],null,[3,18],[13,12],null,[13,18],[3,12]] },
                '+': { width: 26, points: [[13,18],[13,0],null,[4,9],[22,9]] },
                ',': { width: 10, points: [[6,1],[5,0],[4,1],[5,2],[6,1],[6,-1],[5,-3],[4,-4]] },
                '-': { width: 26, points: [[4,9],[22,9]] },
                '.': { width: 10, points: [[5,2],[4,1],[5,0],[6,1],[5,2]] },
                '/': { width: 22, points: [[20,25],[2,-7]] },
                '0': { width: 20, points: [[9,21],[6,20],[4,17],[3,12],[3,9],[4,4],[6,1],[9,0],[11,0],[14,1],[16,4],[17,9],[17,12],[16,17],[14,20],[11,21],[9,21]] },
                '1': { width: 20, points: [[6,17],[8,18],[11,21],[11,0]] },
                '2': { width: 20, points: [[4,16],[4,17],[5,19],[6,20],[8,21],[12,21],[14,20],[15,19],[16,17],[16,15],[15,13],[13,10],[3,0],[17,0]] },
                '3': { width: 20, points: [[5,21],[16,21],[10,13],[13,13],[15,12],[16,11],[17,8],[17,6],[16,3],[14,1],[11,0],[8,0],[5,1],[4,2],[3,4]] },
                '4': { width: 20, points: [[13,21],[3,7],[18,7],null,[13,21],[13,0]] },
                '5': { width: 20, points: [[15,21],[5,21],[4,12],[5,13],[8,14],[11,14],[14,13],[16,11],[17,8],[17,6],[16,3],[14,1],[11,0],[8,0],[5,1],[4,2],[3,4]] },
                '6': { width: 20, points: [[16,18],[15,20],[12,21],[10,21],[7,20],[5,17],[4,12],[4,7],[5,3],[7,1],[10,0],[11,0],[14,1],[16,3],[17,6],[17,7],[16,10],[14,12],[11,13],[10,13],[7,12],[5,10],[4,7]] },
                '7': { width: 20, points: [[17,21],[7,0],null,[3,21],[17,21]] },
                '8': { width: 20, points: [[8,21],[5,20],[4,18],[4,16],[5,14],[7,13],[11,12],[14,11],[16,9],[17,7],[17,4],[16,2],[15,1],[12,0],[8,0],[5,1],[4,2],[3,4],[3,7],[4,9],[6,11],[9,12],[13,13],[15,14],[16,16],[16,18],[15,20],[12,21],[8,21]] },
                '9': { width: 20, points: [[16,14],[15,11],[13,9],[10,8],[9,8],[6,9],[4,11],[3,14],[3,15],[4,18],[6,20],[9,21],[10,21],[13,20],[15,18],[16,14],[16,9],[15,4],[13,1],[10,0],[8,0],[5,1],[4,3]] },
                ':': { width: 10, points: [[5,14],[4,13],[5,12],[6,13],[5,14],null,[5,2],[4,1],[5,0],[6,1],[5,2]] },
                ';': { width: 10, points: [[5,14],[4,13],[5,12],[6,13],[5,14],null,[6,1],[5,0],[4,1],[5,2],[6,1],[6,-1],[5,-3],[4,-4]] },
                '<': { width: 24, points: [[20,18],[4,9],[20,0]] },
                '=': { width: 26, points: [[4,12],[22,12],null,[4,6],[22,6]] },
                '>': { width: 24, points: [[4,18],[20,9],[4,0]] },
                '?': { width: 18, points: [[3,16],[3,17],[4,19],[5,20],[7,21],[11,21],[13,20],[14,19],[15,17],[15,15],[14,13],[13,12],[9,10],[9,7],null,[9,2],[8,1],[9,0],[10,1],[9,2]] },
                '@': { width: 27, points: [[18,13],[17,15],[15,16],[12,16],[10,15],[9,14],[8,11],[8,8],[9,6],[11,5],[14,5],[16,6],[17,8],null,[12,16],[10,14],[9,11],[9,8],[10,6],[11,5],null,[18,16],[17,8],[17,6],[19,5],[21,5],[23,7],[24,10],[24,12],[23,15],[22,17],[20,19],[18,20],[15,21],[12,21],[9,20],[7,19],[5,17],[4,15],[3,12],[3,9],[4,6],[5,4],[7,2],[9,1],[12,0],[15,0],[18,1],[20,2],[21,3],null,[19,16],[18,8],[18,6],[19,5]] },
                'A': { width: 18, points: [[9,21],[1,0],null,[9,21],[17,0],null,[4,7],[14,7]] },
                'B': { width: 21, points: [[4,21],[4,0],null,[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],null,[4,11],[13,11],[16,10],[17,9],[18,7],[18,4],[17,2],[16,1],[13,0],[4,0]] },
                'C': { width: 21, points: [[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5]] },
                'D': { width: 21, points: [[4,21],[4,0],null,[4,21],[11,21],[14,20],[16,18],[17,16],[18,13],[18,8],[17,5],[16,3],[14,1],[11,0],[4,0]] },
                'E': { width: 19, points: [[4,21],[4,0],null,[4,21],[17,21],null,[4,11],[12,11],null,[4,0],[17,0]] },
                'F': { width: 18, points: [[4,21],[4,0],null,[4,21],[17,21],null,[4,11],[12,11]] },
                'G': { width: 21, points: [[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[18,8],null,[13,8],[18,8]] },
                'H': { width: 22, points: [[4,21],[4,0],null,[18,21],[18,0],null,[4,11],[18,11]] },

// ...

Нашли причину нежелания Flotr (одна из многочисленных JavaScript библиотек для генерации графиков) работать с кириллическими кодировками при отрисовке шрифтов.

http://code.google.com/p/flotr/source/browse/trunk/flotr/flotr/prototype/lib/canvastext.js

guest guest, (Updated )

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

ЙажаСценарий / Говнокод #846 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
// Test whether the input is numeric
function IsNumeric(sText)
{
  var ValidChars = "0123456789.";
  var IsNumber=true;
  var Char;

  for (i = 0; i < sText.length && IsNumber == true; i++)
  {
    Char = sText.charAt(i);
    if (ValidChars.indexOf(Char) == -1)
    {
      IsNumber = false;
    }
  }
  return IsNumber; 
}

Nokia WenRuntime Developer guide
Инструментарий для разработчика, там типа пример как правильно кодить под их платформу. Когда увидел в коде это.. дальше читать не стал.. :)

guest guest, (Updated )

Комментарии (9, +9)

ЙажаСценарий / Говнокод #838 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
function check_finished_pending() {

var v_wrt_id = document.getElementById('writer_id').value;

if( 9 == 26 )
{
return confirm("Status 'finished pending' confirmation:\nAre you sure you made all needed operations on this order?");
}
else
{    
..................................

Старнное условие....

Обратите внимание на 5 строчку....

n3m0

guest guest, (Updated )

Комментарии (7, +7)

ЙажаСценарий / Говнокод #780 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  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
  72. 72
  73. 73
  74. 74
  75. 75
  76. 76
  77. 77
  78. 78
  79. 79
  80. 80
  81. 81
  82. 82
  83. 83
  84. 84
  85. 85
  86. 86
  87. 87
  88. 88
  89. 89
  90. 90
  91. 91
  92. 92
  93. 93
  94. 94
  95. 95
  96. 96
  97. 97
  98. 98
  99. 99
  100. 100
fillValuesSelects: function(defaultNStargets, defaultNSgeo, xmlDoc){
		try{
			var ageStr = xmlDoc.getElementsByTagName(defaultNStargets+this.profileMessageParamageTagName)[0].childNodes[0].nodeValue;
			ageStr = (ageStr && ageStr.indexOf("-") != ageStr.lastIndexOf("-"))?ageStr.split("-"):[null, null, null];
			document.getElementById("yearagept").value = ageStr[0]?ageStr[0]:"";
			document.getElementById("monthagept").value = ageStr[1]?ageStr[1]:"";
			document.getElementById("dayagept").value = ageStr[2]?ageStr[2]:"";
		}
		catch(ex){}
	
		try{
			for(var i=0; i < document.getElementById("sexpt").childNodes.length; i++){
				if(document.getElementById("sexpt").childNodes[i].childNodes[0].nodeValue.toLowerCase() ==
					this.getShortTargetNameValue('sex', xmlDoc.getElementsByTagName(defaultNStargets+this.profileMessageParamsexTagName)[0].childNodes[0].nodeValue.toLowerCase()).toLowerCase()){
						document.getElementById("sexpt").selectedIndex = i;
						break;
				}
			}
		}
		catch(ex){}
	
		try{
			var gid = xmlDoc.getElementsByTagName(defaultNSgeo+this.profileMessageParamGeoIDTagName)[0].childNodes[0].nodeValue;
			if(gid.indexOf(':') != -1) gid = gid.substring(0, gid.indexOf(':'));
			this.findGeoLocationById(gid);
		}
		catch(ex){}
	
		try{
			for(var i=0; i < document.getElementById("socialpt").childNodes.length; i++){
				if(document.getElementById("socialpt").childNodes[i].childNodes[0].nodeValue.toLowerCase() ==
					this.getShortTargetNameValue('socialstatus', xmlDoc.getElementsByTagName(defaultNStargets+this.profileMessageParamSocialStatusTagName)[0].childNodes[0].nodeValue.toLowerCase()).toLowerCase()){
						document.getElementById("socialpt").selectedIndex = i;
						break;
				}
			}
		}
		catch(ex){}
	
		try{
			for(var i=0; i < document.getElementById("familypt").childNodes.length; i++){
				if(document.getElementById("familypt").childNodes[i].childNodes[0].nodeValue.toLowerCase() ==
					this.getShortTargetNameValue('maritalstatus', xmlDoc.getElementsByTagName(defaultNStargets+this.profileMessageParamMaritalStatusTagName)[0].childNodes[0].nodeValue.toLowerCase()).toLowerCase()){
						document.getElementById("familypt").selectedIndex = i;
						break;
				}
			}
		}
		catch(ex){}
	
		try{
			for(var i=0; i < document.getElementById("childpt").childNodes.length; i++){
				if(document.getElementById("childpt").childNodes[i].childNodes[0].nodeValue.toLowerCase() ==
					this.getShortTargetNameValue('children', xmlDoc.getElementsByTagName(defaultNStargets+this.profileMessageParamchildrenTagName)[0].childNodes[0].nodeValue.toLowerCase()).toLowerCase()){
						document.getElementById("childpt").selectedIndex = i;
						break;
				}
			}
		}
		catch(ex){}
	
		try{
			for(var i=0; i < document.getElementById("edupt").childNodes.length; i++){
				if(document.getElementById("edupt").childNodes[i].childNodes[0].nodeValue.toLowerCase() ==
					this.getShortTargetNameValue('education', xmlDoc.getElementsByTagName(defaultNStargets+this.profileMessageParameducationTagName)[0].childNodes[0].nodeValue.toLowerCase()).toLowerCase()){
						document.getElementById("edupt").selectedIndex = i;
						break;
				}
			}
		}
		catch(ex){}
	
		try{
			for(var i=0; i < document.getElementById("worknpt").childNodes.length; i++){
				if(document.getElementById("worknpt").childNodes[i].childNodes[0].nodeValue.toLowerCase() ==
					this.getShortTargetNameValue('jobstatus', xmlDoc.getElementsByTagName(defaultNStargets+this.profileMessageParamjobTagName)[0].childNodes[0].nodeValue.toLowerCase()).toLowerCase()){
						document.getElementById("worknpt").selectedIndex = i;
						break;
				}
			}
		}
		catch(ex){}
	
		try{
			for(var i=0; i < document.getElementById("incomept").childNodes.length; i++){
				if(document.getElementById("incomept").childNodes[i].childNodes[0].nodeValue.toLowerCase() ==
					this.getShortTargetNameValue('incomestatus', xmlDoc.getElementsByTagName(defaultNStargets+this.profileMessageParamincomeTagName)[0].childNodes[0].nodeValue.toLowerCase()).toLowerCase()){
						document.getElementById("incomept").selectedIndex = i;
						break;
				}
			}
		}
		catch(ex){}
	
		try{
			for(var i=0; i < document.getElementById("inetpt").childNodes.length; i++){
				if(document.getElementById("inetpt").childNodes[i].childNodes[0].nodeValue.toLowerCase() ==
					this.getShortTargetNameValue('internetaccessstatus', xmlDoc.getElementsByTagName(defaultNStargets+this.profileMessageParaminternetaccessTagName)[0].childNodes[0].nodeValue.toLowerCase()).toLowerCase()){
						document.getElementById("inetpt").selectedIndex = i;
						break;

Кусочек кода одной системы одной довольно известной IT-компании в Рунете ;-)

guest guest, (Updated )

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