[otrs-cvs] Fred/var/httpd/htdocs/js FredJSLint.js, 1.15, 1.16 FredHTMLCheck.js, 1.10, 1.11
"CVS commits notifications of OTRS.org" <[email protected]> Tue, 12 Mar 2013 14:18:48 +0000
| Newsgroups | gmane.comp.otrs.cvs |
|---|---|
| Message-ID | <[email protected]> |
Comments:
Update of /home/cvs/Fred/var/httpd/htdocs/js
In directory lancelot:/tmp/cvs-serv5252/var/httpd/htdocs/js
Modified Files:
FredJSLint.js FredHTMLCheck.js
Log Message:
Make HTML check a bit more robust.
Author: mg
Index: FredJSLint.js
===================================================================
RCS file: /home/cvs/Fred/var/httpd/htdocs/js/FredJSLint.js,v
retrieving revision 1.15
retrieving revision 1.16
diff -2 -u -d -r1.15 -r1.16
--- FredJSLint.js 14 Aug 2012 10:00:57 -0000 1.15
+++ FredJSLint.js 12 Mar 2013 14:18:42 -0000 1.16
@@ -1,4 +1,4 @@
"use strict";
-/*global JSLINT: false */
+/*global JSLINT: false, $: false, jQuery: false */
var Core = Core || {};
@@ -27,5 +27,5 @@
* @description Start JSLint check.
*/
- function StartJSLint() {
+ function startJSLint() {
var Result,
ErrorsFound = false;
@@ -41,4 +41,8 @@
var ErrorObject, Output, i;
+ // Ignore invalid code that is injected by the google analytics opt-out plugin for browsers.
+ if ( this.Src === 'inline' && this.Script.match(/_gaUserPrefs/) ) {
+ return;
+ }
Result = JSLINT(this.Script, (this.Src === 'inline') ? TargetNS.InlineOptions : TargetNS.RemoteOptions);
@@ -111,5 +115,5 @@
// this module needs jQuery!
if (typeof jQuery === 'undefined' || !jQuery) {
- alert('Fred JSLint module needs jQuery loaded');
+ window.alert('Fred JSLint module needs jQuery loaded');
document.getElementById('FredJSLintScripts').style.height = '15px';
}
@@ -173,5 +177,5 @@
TargetNS.CheckForStart = function () {
if (TargetNS.Waiting <= 0 && TargetNS.Started === 0) {
- StartJSLint();
+ startJSLint();
}
else {
@@ -184,3 +188,3 @@
};
return TargetNS;
-}(Core.Fred.JSLint || {}));
\ No newline at end of file
+}(Core.Fred.JSLint || {}));
Author: mg
Index: FredHTMLCheck.js
===================================================================
RCS file: /home/cvs/Fred/var/httpd/htdocs/js/FredHTMLCheck.js,v
retrieving revision 1.10
retrieving revision 1.11
diff -2 -u -d -r1.10 -r1.11
--- FredHTMLCheck.js 4 May 2011 11:52:20 -0000 1.10
+++ FredHTMLCheck.js 12 Mar 2013 14:18:42 -0000 1.11
@@ -1,5 +1,6 @@
"use strict";
+/*global JSLINT: false, $: false, jQuery: false */
-var OTRS = Core || {};
+var Core = Core || {};
Core.Fred = Core.Fred || {};
@@ -15,9 +16,9 @@
ErrorsFound = false;
- function HTMLEncode(Text){
+ function htmlEncode(Text){
return Text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
}
- function OutputError($Element, ErrorType, ErrorDescription, Hint){
+ function outputError($Element, ErrorType, ErrorDescription, Hint){
var $Container,
Code,
@@ -37,5 +38,5 @@
Message = $('<p class="Small"></p>');
- Message.append('<span class="Error">Error:</span> <strong>' + ErrorDescription + '</strong><div>' + Hint + '</div><div><code>' + HTMLEncode(Code) + '</code></div>');
+ Message.append('<span class="Error">Error:</span> <strong>' + ErrorDescription + '</strong><div>' + Hint + '</div><div><code>' + htmlEncode(Code) + '</code></div>');
$('#FredHTMLCheckResults').append(Message);
}
@@ -69,5 +70,5 @@
if ($Label.length > 1) {
- OutputError(
+ outputError(
$this,
'AccessibilityMultipleLabel',
@@ -85,5 +86,5 @@
// ok, no title available, now look for an assigned label element
if (!$Label || !$Label.length) {
- OutputError(
+ outputError(
$this,
'AccessibilityMissingLabel',
@@ -108,5 +109,5 @@
$.each($this[0].attributes, function () {
if (this.name === 'title' && !this.value.length) {
- OutputError(
+ outputError(
$this,
'AccessibilityInaccessibleLink',
@@ -127,5 +128,5 @@
}
- OutputError(
+ outputError(
$this,
'AccessibilityInaccessibleLink',
@@ -152,5 +153,5 @@
$('input:button, input:submit, input:reset').each(function(){
var $this = $(this);
- OutputError(
+ outputError(
$this,
'BadPracticeInputButton',
@@ -167,5 +168,5 @@
var $this = $(this);
if ($this.attr('size') && $this.attr('size') > 0) {
- OutputError(
+ outputError(
$this,
'BadPracticeInputSize',
@@ -188,5 +189,5 @@
$('b, i, font, nobr').each(function(){
var $this = $(this);
- OutputError(
+ outputError(
$this,
'BadPracticeObsoleteElement',
@@ -196,9 +197,9 @@
});
- function ObsoleteClassError(ClassName) {
+ function obsoleteClassError(ClassName) {
// Return a function that can be used as a callback by each().
return function() {
var $this = $(this);
- OutputError(
+ outputError(
$this,
'BadPracticeObsoleteClass',
@@ -210,9 +211,9 @@
// check for inputs with size attributes
- $('.mainbody').each(ObsoleteClassError('mainbody'));
- $('.contentkey').each(ObsoleteClassError('contentkey'));
- $('.contentvalue').each(ObsoleteClassError('contentvalue'));
- $('.searchactive').each(ObsoleteClassError('searchactive'));
- $('.searchpassive').each(ObsoleteClassError('searchpassive'));
+ $('.mainbody').each(obsoleteClassError('mainbody'));
+ $('.contentkey').each(obsoleteClassError('contentkey'));
+ $('.contentvalue').each(obsoleteClassError('contentvalue'));
+ $('.searchactive').each(obsoleteClassError('searchactive'));
+ $('.searchpassive').each(obsoleteClassError('searchpassive'));
// check for events
@@ -236,5 +237,5 @@
// send error to output
if (Events !== null){
- // clean leading space and equals sing from the RegEx matching
+ // clean leading space and equals sign from the RegEx matching
for (Event in Events){
if (Events.hasOwnProperty(Event)) {
@@ -242,7 +243,8 @@
}
}
- // don't output this error for fred itself
- if (!$this.closest('.DevelFredContainer').length) {
- OutputError(
+ // Don't output this error for fred itself.
+ // We also currently need onclick events in the main menu.
+ if ( !$this.closest('.DevelFredContainer, #Navigation').length ) {
+ outputError(
$this,
'BadPracticeEvent',
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log