Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
31cb3d4b
Commit
31cb3d4b
authored
Jan 16, 2015
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the non-AMD case.
parent
0a1a98d2
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
11260 additions
and
267 deletions
+11260
-267
Gruntfile.js
Gruntfile.js
+16
-0
builds/locales.js
builds/locales.js
+11108
-0
builds/templates.js
builds/templates.js
+80
-62
converse.js
converse.js
+3
-1
dev.html
dev.html
+0
-1
locale/locales.js
locale/locales.js
+0
-34
non_amd.html
non_amd.html
+30
-156
package.json
package.json
+1
-0
src/utils.js
src/utils.js
+22
-13
No files found.
Gruntfile.js
View file @
31cb3d4b
...
...
@@ -4,6 +4,7 @@ module.exports = function(grunt) {
jst
:
{
compile
:
{
options
:
{
namespace
:
'
templates
'
,
templateSettings
:
{
evaluate
:
/
\{\[([\s\S]
+
?)\]\}
/g
,
interpolate
:
/
\{\{([\s\S]
+
?)\}\}
/g
...
...
@@ -20,6 +21,20 @@ module.exports = function(grunt) {
}
},
json
:
{
main
:
{
options
:
{
namespace
:
'
locales
'
,
includePath
:
true
,
processName
:
function
(
filename
)
{
return
filename
.
toLowerCase
().
match
(
/^locale
\/(
.*
)\/
lc_messages/
)[
1
];
}
},
src
:
[
'
locale/**/LC_MESSAGES/*.json
'
],
dest
:
'
builds/locales.js
'
}
},
jshint
:
{
options
:
{
trailing
:
true
...
...
@@ -52,6 +67,7 @@ module.exports = function(grunt) {
grunt
.
loadNpmTasks
(
'
grunt-contrib-cssmin
'
);
grunt
.
loadNpmTasks
(
'
grunt-contrib-jshint
'
);
grunt
.
loadNpmTasks
(
'
grunt-contrib-jst
'
);
grunt
.
loadNpmTasks
(
'
grunt-json
'
);
grunt
.
loadNpmTasks
(
'
grunt-contrib-requirejs
'
);
grunt
.
registerTask
(
'
test
'
,
'
Run Tests
'
,
function
()
{
...
...
builds/locales.js
0 → 100644
View file @
31cb3d4b
This diff is collapsed.
Click to expand it.
builds/templates.js
View file @
31cb3d4b
This diff is collapsed.
Click to expand it.
converse.js
View file @
31cb3d4b
...
...
@@ -37,7 +37,7 @@
}
);
}
else
{
root
.
converse
=
factory
(
jQuery
,
_
,
OTR
,
DSA
,
JST
,
moment
,
utils
);
root
.
converse
=
factory
(
jQuery
,
_
,
OTR
,
DSA
,
templates
,
moment
,
utils
);
}
}(
this
,
function
(
$
,
_
,
OTR
,
DSA
,
templates
,
moment
,
utils
)
{
// "use strict";
...
...
@@ -282,6 +282,8 @@
// Allow only whitelisted configuration attributes to be overwritten
_
.
extend
(
this
,
_
.
pick
(
settings
,
Object
.
keys
(
default_settings
)));
this
.
jed
=
new
Jed
(
this
.
i18n
);
if
(
settings
.
visible_toolbar_buttons
)
{
_
.
extend
(
this
.
visible_toolbar_buttons
,
...
...
dev.html
View file @
31cb3d4b
...
...
@@ -13,7 +13,6 @@
<link
type=
"text/css"
rel=
"stylesheet"
media=
"screen"
href=
"components/fontawesome/css/font-awesome.min.css"
/>
<link
type=
"text/css"
rel=
"stylesheet"
media=
"screen"
href=
"css/theme.css"
/>
<link
type=
"text/css"
rel=
"stylesheet"
media=
"screen"
href=
"css/converse.css"
/>
<script
type=
"text/javascript"
src=
"analytics.js"
></script>
<script
data-main=
"main"
src=
"components/requirejs/require.js"
></script>
</head>
...
...
locale/locales.js
View file @
31cb3d4b
...
...
@@ -7,40 +7,6 @@
(
function
(
root
,
factory
)
{
define
(
"
locales
"
,
[
'
jquery
'
,
'
jed
'
,
'
text!af
'
,
'
text!de
'
,
'
text!en
'
,
'
text!es
'
,
'
text!fr
'
,
'
text!he
'
,
'
text!hu
'
,
'
text!id
'
,
'
text!it
'
,
'
text!ja
'
,
'
text!nb
'
,
'
text!nl
'
,
'
text!pl
'
,
'
text!pt_BR
'
,
'
text!ru
'
,
'
text!zh
'
],
function
(
$
,
Jed
,
af
,
de
,
en
,
es
,
fr
,
he
,
hu
,
id
,
it
,
ja
,
nb
,
nl
,
pl
,
pt_BR
,
ru
,
zh
)
{
root
.
locales
=
{
'
af
'
:
new
Jed
(
$
.
parseJSON
(
af
)),
'
de
'
:
new
Jed
(
$
.
parseJSON
(
de
)),
'
en
'
:
new
Jed
(
$
.
parseJSON
(
en
)),
'
es
'
:
new
Jed
(
$
.
parseJSON
(
es
)),
'
fr
'
:
new
Jed
(
$
.
parseJSON
(
fr
)),
'
he
'
:
new
Jed
(
$
.
parseJSON
(
he
)),
'
hu
'
:
new
Jed
(
$
.
parseJSON
(
hu
)),
'
id
'
:
new
Jed
(
$
.
parseJSON
(
id
)),
'
it
'
:
new
Jed
(
$
.
parseJSON
(
it
)),
'
ja
'
:
new
Jed
(
$
.
parseJSON
(
ja
)),
'
nb
'
:
new
Jed
(
$
.
parseJSON
(
nb
)),
'
nl
'
:
new
Jed
(
$
.
parseJSON
(
nl
)),
'
pl
'
:
new
Jed
(
$
.
parseJSON
(
pl
)),
'
pt-br
'
:
new
Jed
(
$
.
parseJSON
(
pt_BR
)),
'
ru
'
:
new
Jed
(
$
.
parseJSON
(
ru
)),
'
zh
'
:
new
Jed
(
$
.
parseJSON
(
zh
))
};
});
})(
this
);
non_amd.html
View file @
31cb3d4b
This diff is collapsed.
Click to expand it.
package.json
View file @
31cb3d4b
...
...
@@ -40,6 +40,7 @@
"
po2json
"
:
"
^0.3.0
"
},
"dependencies"
:
{
"
grunt-json
"
:
"
^0.1.3
"
,
"
requirejs
"
:
"
~2.1.11
"
}
}
src/utils.js
View file @
31cb3d4b
define
([
"
jquery
"
,
"
converse-templates
"
],
function
(
$
,
templates
)
{
(
function
(
root
,
factory
)
{
if
(
typeof
define
===
'
function
'
&&
define
.
amd
)
{
define
([
"
jquery
"
,
"
converse-templates
"
,
"
locales
"
],
factory
);
}
else
{
root
.
utils
=
factory
(
jQuery
,
templates
);
}
}(
this
,
function
(
$
,
templates
)
{
"
use strict
"
;
var
XFORM_TYPE_MAP
=
{
...
...
@@ -49,10 +55,13 @@ define(["jquery", "converse-templates"], function ($, templates) {
// ---------------------
__
:
function
(
str
)
{
// Translation factory
if
(
t
his
.
i18n
===
undefined
)
{
if
(
t
ypeof
this
.
i18n
===
"
undefined
"
)
{
this
.
i18n
=
locales
.
en
;
}
var
t
=
this
.
i18n
.
translate
(
str
);
if
(
typeof
this
.
jed
===
"
undefined
"
)
{
this
.
jed
=
new
Jed
(
this
.
i18n
);
}
var
t
=
this
.
jed
.
translate
(
str
);
if
(
arguments
.
length
>
1
)
{
return
t
.
fetch
.
apply
(
t
,
[].
slice
.
call
(
arguments
,
1
));
}
else
{
...
...
@@ -73,10 +82,10 @@ define(["jquery", "converse-templates"], function ($, templates) {
webForm2xForm
:
function
(
field
)
{
/* Takes an HTML DOM and turns it into an XForm field.
*
* Parameters:
* (DOMElement) field - the field to convert
*/
*
* Parameters:
* (DOMElement) field - the field to convert
*/
var
$input
=
$
(
field
),
value
;
if
(
$input
.
is
(
'
[type=checkbox]
'
))
{
value
=
$input
.
is
(
'
:checked
'
)
&&
1
||
0
;
...
...
@@ -100,11 +109,11 @@ define(["jquery", "converse-templates"], function ($, templates) {
xForm2webForm
:
function
(
$field
,
$stanza
)
{
/* Takes a field in XMPP XForm (XEP-004: Data Forms) format
* and turns it into a HTML DOM field.
*
* Parameters:
* (XMLElement) field - the field to convert
*/
* and turns it into a HTML DOM field.
*
* Parameters:
* (XMLElement) field - the field to convert
*/
// FIXME: take <required> into consideration
var
options
=
[],
j
,
$options
,
$values
,
value
,
values
;
...
...
@@ -186,4 +195,4 @@ define(["jquery", "converse-templates"], function ($, templates) {
}
};
return
utils
;
});
})
)
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment