Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
renderjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
renderjs
Commits
381dafb4
Commit
381dafb4
authored
Aug 06, 2013
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JSLint examples.
parent
90a54b2f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
84 additions
and
75 deletions
+84
-75
Makefile
Makefile
+6
-3
examples/officejs/aceeditor.js
examples/officejs/aceeditor.js
+5
-5
examples/officejs/catalog.js
examples/officejs/catalog.js
+17
-17
examples/officejs/editor.js
examples/officejs/editor.js
+5
-5
examples/officejs/io.js
examples/officejs/io.js
+8
-8
examples/officejs/jqteditor.js
examples/officejs/jqteditor.js
+4
-4
examples/officejs/officejs.js
examples/officejs/officejs.js
+39
-33
No files found.
Makefile
View file @
381dafb4
...
...
@@ -3,6 +3,8 @@ RENDERJS = renderjs.js
RENDERJS_MIN
=
renderjs.min.js
BUILDDIR
=
tmp
LINT_OPTS
=
--maxlen
79
--indent
2
--maxerr
3
include
config.mk
all
:
external lint test build doc
...
...
@@ -67,10 +69,11 @@ lib/jio/complex_queries.js:
$(RENDERJS_MIN)
:
$(RENDERJS)
$(UGLIFY_CMD)
"
$<
"
>
"
$@
"
${BUILDDIR}/$(RENDERJS).lint
:
$(RENDERJS) test/renderjs_test.js
${BUILDDIR}/$(RENDERJS).lint
:
$(RENDERJS) test/renderjs_test.js
examples/officejs/*.js
@
mkdir
-p
$
(
@D
)
$(LINT_CMD)
"
$(RENDERJS)
"
$(LINT_CMD)
"test/renderjs_test.js"
$(LINT_CMD)
$(LINT_OPTS)
"
$(RENDERJS)
"
$(LINT_CMD)
$(LINT_OPTS)
"test/renderjs_test.js"
$(LINT_CMD)
$(LINT_OPTS)
examples/officejs/
*
.js
touch
$@
${BUILDDIR}/index.html.ok
:
test/index.html
...
...
examples/officejs/aceeditor.js
View file @
381dafb4
...
...
@@ -8,10 +8,10 @@
rJS
(
this
).
editor
.
getSession
().
setValue
(
value
);
// return rJS(this).context.find('textarea').val(escape_text(value));
})
.
declareMethod
(
'
getContent
'
,
function
()
{
return
rJS
(
this
).
editor
.
getSession
().
getValue
();
// return rJS(this).context.find('textarea').val();
});
.
declareMethod
(
'
getContent
'
,
function
()
{
return
rJS
(
this
).
editor
.
getSession
().
getValue
();
// return rJS(this).context.find('textarea').val();
});
gk
.
ready
(
function
()
{
var
g
=
rJS
(
this
);
...
...
@@ -22,4 +22,4 @@
// editor.getSession().setMode("ace/mode/javascript");
});
}(
window
,
jQuery
,
rJS
,
ace
))
}(
window
,
jQuery
,
rJS
,
ace
))
;
examples/officejs/catalog.js
View file @
381dafb4
...
...
@@ -4,25 +4,25 @@
var
gk
=
rJS
(
window
),
io_dict
=
{
"
path
"
:
"
./io.html
"
,
"
title
"
:
"
IO
"
,
"
interface
"
:
"
http://www.renderjs.org/interface/io
"
,
},
"
path
"
:
"
./io.html
"
,
"
title
"
:
"
IO
"
,
"
interface
"
:
"
http://www.renderjs.org/interface/io
"
,
},
editor_1_dict
=
{
"
path
"
:
"
./editor.html
"
,
"
title
"
:
"
Simple Text Editor Gadget
"
,
"
interface
"
:
"
http://www.renderjs.org/interface/editor
"
,
},
"
path
"
:
"
./editor.html
"
,
"
title
"
:
"
Simple Text Editor Gadget
"
,
"
interface
"
:
"
http://www.renderjs.org/interface/editor
"
,
},
editor_2_dict
=
{
"
path
"
:
"
./jqteditor.html
"
,
"
title
"
:
"
JQuery Text Editor Gadget
"
,
"
interface
"
:
"
http://www.renderjs.org/interface/editor
"
,
},
"
path
"
:
"
./jqteditor.html
"
,
"
title
"
:
"
JQuery Text Editor Gadget
"
,
"
interface
"
:
"
http://www.renderjs.org/interface/editor
"
,
},
editor_3_dict
=
{
"
path
"
:
"
./aceeditor.html
"
,
"
title
"
:
"
Ace Editor Gadget
"
,
"
interface
"
:
"
http://www.renderjs.org/interface/editor
"
,
},
"
path
"
:
"
./aceeditor.html
"
,
"
title
"
:
"
Ace Editor Gadget
"
,
"
interface
"
:
"
http://www.renderjs.org/interface/editor
"
,
},
catalog_list
=
[
{
"
path
"
:
"
./officejs.html
"
,
...
...
@@ -52,4 +52,4 @@
return
deferred
.
promise
();
});
}(
window
,
$
,
rJS
))
}(
window
,
jQuery
,
rJS
));
examples/officejs/editor.js
View file @
381dafb4
...
...
@@ -7,15 +7,15 @@
return
text
.
replace
(
/&/g
,
"
&
"
)
.
replace
(
/</g
,
"
<
"
)
.
replace
(
/>/g
,
"
>
"
);
}
;
}
var
gk
=
rJS
(
window
);
gk
.
declareMethod
(
'
setContent
'
,
function
(
value
)
{
return
rJS
(
this
).
context
.
find
(
'
textarea
'
).
val
(
escape_text
(
value
));
})
.
declareMethod
(
'
getContent
'
,
function
()
{
return
rJS
(
this
).
context
.
find
(
'
textarea
'
).
val
();
});
.
declareMethod
(
'
getContent
'
,
function
()
{
return
rJS
(
this
).
context
.
find
(
'
textarea
'
).
val
();
});
}(
window
,
$
,
rJS
))
}(
window
,
jQuery
,
rJS
));
examples/officejs/io.js
View file @
381dafb4
...
...
@@ -13,7 +13,7 @@
rJS
(
this
).
jio_key
=
key
;
})
.
declareMethod
(
'
getIO
'
,
function
()
{
.
declareMethod
(
'
getIO
'
,
function
()
{
var
deferred
=
$
.
Deferred
(),
default_value
=
""
,
gadget
=
rJS
(
this
);
...
...
@@ -34,9 +34,9 @@
});
return
deferred
.
promise
();
})
})
.
declareMethod
(
'
setIO
'
,
function
(
value
)
{
.
declareMethod
(
'
setIO
'
,
function
(
value
)
{
var
deferred
=
$
.
Deferred
(),
default_value
=
""
,
...
...
@@ -60,17 +60,17 @@
}
});
}
});
});
return
deferred
.
promise
();
})
})
.
declareMethod
(
'
configureDataSourceCallback
'
,
function
(
that
,
callback
)
{
.
declareMethod
(
'
configureDataSourceCallback
'
,
function
(
that
,
callback
)
{
var
g
=
rJS
(
this
);
g
.
context
.
find
(
'
a
'
).
unbind
(
'
click
'
).
click
(
function
()
{
callback
.
apply
(
that
).
done
(
function
(
value
)
{
g
.
setIO
(
value
);
});
});
});
});
}(
window
,
$
,
jIO
,
rJS
))
}(
window
,
jQuery
,
jIO
,
rJS
));
examples/officejs/jqteditor.js
View file @
381dafb4
...
...
@@ -8,12 +8,12 @@
// return rJS(this).context.find('textarea').val(escape_text(value));
return
rJS
(
this
).
context
.
find
(
'
#textarea-b
'
).
jqteVal
(
value
);
})
.
declareMethod
(
'
getContent
'
,
function
()
{
return
rJS
(
this
).
context
.
find
(
'
#textarea-b
'
).
val
();
});
.
declareMethod
(
'
getContent
'
,
function
()
{
return
rJS
(
this
).
context
.
find
(
'
#textarea-b
'
).
val
();
});
gk
.
ready
(
function
()
{
var
g
=
rJS
(
this
);
g
.
context
.
find
(
"
#textarea-b
"
).
jqte
();
});
}(
window
,
$
,
rJS
))
}(
window
,
jQuery
,
rJS
));
examples/officejs/officejs.js
View file @
381dafb4
...
...
@@ -21,43 +21,49 @@
io_a_context
=
g
.
context
.
find
(
"
.editor_a_safe
"
).
last
();
// editor_b_context = g.context.find(".editor_b").last(),
// io_b_context = g.context.find(".editor_b_safe").last();
;
// First, load the catalog gadget
g
.
declareGadget
(
'
./catalog.html
'
,
catalog_context
).
done
(
function
(
catalog
)
{
// Fetch the list of editor and io gadgets
// This is done in 2 different queries to the catalog
$
.
when
(
catalog
.
allDocs
(
{
query
:
'
interface: "http://www.renderjs.org/interface/editor"
'
}),
catalog
.
allDocs
(
{
query
:
'
interface: "http://www.renderjs.org/interface/io"
'
}))
.
done
(
function
(
editor_list
,
io_list
)
{
var
panel_context
=
g
.
context
.
find
(
"
.bare_panel
"
);
g
.
declareGadget
(
'
./catalog.html
'
,
catalog_context
).
done
(
function
(
catalog
)
{
// Fetch the list of editor and io gadgets
// This is done in 2 different queries to the catalog
$
.
when
(
catalog
.
allDocs
(
{
query
:
'
interface: "http://www.renderjs.org/interface/editor"
'
}
),
catalog
.
allDocs
(
{
query
:
'
interface: "http://www.renderjs.org/interface/io"
'
}
)
).
done
(
function
(
editor_list
,
io_list
)
{
var
panel_context
=
g
.
context
.
find
(
"
.bare_panel
"
);
// Load 1 editor and 1 IO and plug them
$
.
when
(
g
.
declareIframedGadget
(
editor_list
[
0
].
path
,
editor_a_context
),
g
.
declareGadget
(
io_list
[
0
].
path
,
io_a_context
),
"
officejs
"
).
done
(
attachIOToEditor
);
// Load 1 editor and 1 IO and plug them
$
.
when
(
g
.
declareIframedGadget
(
editor_list
[
0
].
path
,
editor_a_context
),
g
.
declareGadget
(
io_list
[
0
].
path
,
io_a_context
),
"
officejs
"
).
done
(
attachIOToEditor
);
// Fill the panel
$
.
each
(
editor_list
,
function
(
i
,
editor_definition
)
{
panel_context
.
append
(
'
<a href="#" data-role="button" data-icon="edit"
'
+
'
data-iconpos="left">
'
+
editor_definition
.
title
+
'
</a>
'
);
panel_context
.
find
(
'
a
'
).
last
().
click
(
function
()
{
$
.
when
(
g
.
declareIframedGadget
(
editor_definition
.
path
,
editor_a_context
),
g
.
declareGadget
(
io_list
[
0
].
path
,
io_a_context
),
"
officejs
"
).
done
(
attachIOToEditor
);
});
});
panel_context
.
trigger
(
'
create
'
);
});
});
// Fill the panel
$
.
each
(
editor_list
,
function
(
i
,
editor_definition
)
{
panel_context
.
append
(
'
<a href="#" data-role="button" data-icon="edit"
'
+
'
data-iconpos="left">
'
+
editor_definition
.
title
+
'
</a>
'
);
panel_context
.
find
(
'
a
'
).
last
().
click
(
function
()
{
$
.
when
(
g
.
declareIframedGadget
(
editor_definition
.
path
,
editor_a_context
),
g
.
declareGadget
(
io_list
[
0
].
path
,
io_a_context
),
"
officejs
"
).
done
(
attachIOToEditor
);
});
});
panel_context
.
trigger
(
'
create
'
);
});
}
);
// $.when(
// g.declareGadget('./jqteditor.html', editor_a_context),
...
...
@@ -70,4 +76,4 @@
// "officejs_b").done(attachIOToEditor);
});
}(
window
,
$
,
rJS
))
}(
window
,
jQuery
,
rJS
));
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