Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cribjs-editor
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
cribjs-editor
Commits
ec704ac6
Commit
ec704ac6
authored
Jun 10, 2020
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove trailing whitespace
parent
d756e23e
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
63 additions
and
63 deletions
+63
-63
crib-editor2/cribjs-editor.js
crib-editor2/cribjs-editor.js
+7
-7
crib-enable.js
crib-enable.js
+16
-16
gadget/crib-sw-gadget.js
gadget/crib-sw-gadget.js
+7
-7
gadget/gadget_cribjs_header.html
gadget/gadget_cribjs_header.html
+1
-1
gadget/gadget_cribjs_header.js
gadget/gadget_cribjs_header.js
+1
-1
gadget/gadget_cribjs_page_cribjs_home.html
gadget/gadget_cribjs_page_cribjs_home.html
+1
-1
gadget/gadget_cribjs_page_cribjs_home.js
gadget/gadget_cribjs_page_cribjs_home.js
+1
-1
gadget/gadget_cribjs_page_editor.html
gadget/gadget_cribjs_page_editor.html
+1
-1
gadget/gadget_cribjs_page_editor.js
gadget/gadget_cribjs_page_editor.js
+4
-4
gadget/gadget_cribjs_page_mass_remove.html
gadget/gadget_cribjs_page_mass_remove.html
+1
-1
gadget/gadget_cribjs_page_mass_remove.js
gadget/gadget_cribjs_page_mass_remove.js
+4
-4
gadget/gadget_cribjs_page_save_load.html
gadget/gadget_cribjs_page_save_load.html
+1
-1
gadget/gadget_cribjs_page_select_site.html
gadget/gadget_cribjs_page_select_site.html
+2
-2
gadget/gadget_cribjs_page_select_site.js
gadget/gadget_cribjs_page_select_site.js
+3
-3
gadget/gadget_cribjs_page_url_list.html
gadget/gadget_cribjs_page_url_list.html
+1
-1
gadget/gadget_cribjs_page_url_list.js
gadget/gadget_cribjs_page_url_list.js
+4
-4
gadget/gadget_cribjs_router.js
gadget/gadget_cribjs_router.js
+1
-1
gadget/gadget_landing_cribjs.js
gadget/gadget_landing_cribjs.js
+5
-5
landing.js
landing.js
+2
-2
No files found.
crib-editor2/cribjs-editor.js
View file @
ec704ac6
...
...
@@ -32,8 +32,8 @@
url
:
gadget
.
props
.
element
.
querySelector
(
'
.form-use-jio-dav .url
'
).
value
,
basic_login
:
btoa
(
gadget
.
props
.
element
.
querySelector
(
"
.form-use-jio-dav .credential
"
).
value
)
});
}
}
function
displayURLList
(
gadget
,
event
)
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
...
...
@@ -89,7 +89,7 @@
trElement
.
appendChild
(
tdElement
);
tdElement
=
document
.
createElement
(
'
td
'
);
tdElement
.
innerHTML
=
url_number
+
"
URLs
"
;
trElement
.
appendChild
(
tdElement
);
trElement
.
appendChild
(
tdElement
);
tdElement
=
document
.
createElement
(
'
td
'
);
trElement
.
appendChild
(
tdElement
);
footer_element
.
appendChild
(
trElement
);
...
...
@@ -108,7 +108,7 @@
console
.
log
(
"
saving content
"
);
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
'
codeeditor
'
);
return
gadget
.
getDeclaredGadget
(
'
codeeditor
'
);
})
.
push
(
function
(
code_editor_gadget
)
{
return
code_editor_gadget
.
getContent
();
...
...
@@ -177,8 +177,8 @@
[
jio_gadget
.
put
(
"
/
"
+
application_id
+
"
.attachment/
"
,
{
// url: path_to_save
}),
jio_gadget
.
putAttachment
(
"
/
"
,
application_id
,
new
Blob
([
JSON
.
stringify
({
url
:
path_to_save
})],{
type
:
"
application/json
"
}))
]);
jio_gadget
.
putAttachment
(
"
/
"
,
application_id
,
new
Blob
([
JSON
.
stringify
({
url
:
path_to_save
})],{
type
:
"
application/json
"
}))
]);
})
.
push
(
function
()
{
var
promise_list
=
[],
...
...
@@ -263,7 +263,7 @@
index
=
url
.
indexOf
(
location
);
if
(
index
!=
-
1
)
url
=
url
.
substr
(
index
+
location_len
);
promise_list
.
push
(
promise_list
.
push
(
crib_sw_gadget
.
put
(
path_to_load
+
url
,
{
blob
:
response_list
[
i
]})
)
}
...
...
crib-enable.js
View file @
ec704ac6
...
...
@@ -47,8 +47,8 @@
xhr
.
abort
();
});
}
function
sendMessage
(
message
)
{
// This wraps the message posting/response in a promise, which will resolve if the response doesn't
// contain an error, and reject with the error if it does. If you'd prefer, it's possible to call
...
...
@@ -64,7 +64,7 @@
resolve
(
event
.
data
);
}
};
// This sends the message data as well as transferring messageChannel.port2 to the service worker.
// The service worker can then use the transferred port to reply via postMessage(), which
// will in turn trigger the onmessage handler on messageChannel.port1.
...
...
@@ -72,11 +72,11 @@
return
navigator
.
serviceWorker
.
controller
.
postMessage
(
message
,
[
messageChannel
.
port2
]);
});
}
function
setStatus
(
statusMessage
)
{
console
.
log
(
statusMessage
);
}
rJS
(
window
)
.
ready
(
function
(
g
)
{
g
.
props
=
{};
...
...
@@ -84,7 +84,7 @@
.
push
(
function
(
element
)
{
g
.
props
.
element
=
element
;
});
})
})
.
ready
(
function
(
gadget
)
{
// Initialize the gadget local parameters
gadget
.
state_parameter_dict
=
{};
...
...
@@ -108,11 +108,11 @@
throw
"
Service Worker are not available in your browser
"
;
}
})
/**
* allDocs return the list of document in the cache
*
* @params {Object} Not taken into account
* @params {Object} Not taken into account
* @return {} Return the data url of the document
*/
.
declareMethod
(
'
allDocs
'
,
function
(
params
)
{
...
...
@@ -129,14 +129,14 @@
return
sendMessage
({
command
:
'
allDocs
'
});
});
});
})
/**
* get Return a data url. Cannot return a blob as the data
* is transmitted through an iFrame
*
* @url {string} url of the document to retrieve
* @url {string} url of the document to retrieve
* @return {data_url} Return the data url of the document
*/
.
declareMethod
(
'
get
'
,
function
(
url
)
{
...
...
@@ -156,13 +156,13 @@
return
e
.
target
.
result
;
});
})
/**
* put Return a data url. Cannot provide a blob as the data
* is transmitted through an iFrame
*
* @url {string} url of the document to update
* @parameter {data_url} data url of the document to put, it will be transformed in a blob
* @url {string} url of the document to update
* @parameter {data_url} data url of the document to put, it will be transformed in a blob
* @return {data_url} Return the data url of the document
*/
.
declareMethod
(
'
put
'
,
function
(
url
,
parameter
)
{
...
...
@@ -179,11 +179,11 @@
return
'
Added to cache:
'
+
url
+
'
at
'
+
Date
();
}).
fail
(
setStatus
);
})
/**
* Remove an url from the cache
*
* @url {string} url of the document to remove
* @url {string} url of the document to remove
* @return {}
*/
.
declareMethod
(
'
remove
'
,
function
(
url
)
{
...
...
gadget/crib-sw-gadget.js
View file @
ec704ac6
...
...
@@ -37,7 +37,7 @@
}
})
.
push
(
undefined
,
function
(
e
)
{
// Ugly Hack to reload page and make service worker available
// Ugly Hack to reload page and make service worker available
if
(
e
.
indexOf
(
"
Please reload this page to allow Service Worker to control this page
"
)
>
-
1
)
{
console
.
log
(
"
reload
"
);
window
.
location
.
reload
(
false
);
...
...
@@ -48,7 +48,7 @@
}
});
}
rJS
(
window
)
.
ready
(
function
(
g
)
{
g
.
props
=
{};
...
...
@@ -58,7 +58,7 @@
g
.
props
.
element
=
element
;
getURL
.
protocol
+
"
//
"
+
getURL
.
host
+
"
/crib-enable.html
"
});
})
})
.
ready
(
function
(
gadget
)
{
// Initialize the gadget local parameters
gadget
.
state_parameter_dict
=
{};
...
...
@@ -71,7 +71,7 @@
return
storage_gadget
.
allDocs
(
params
)
});
})
.
declareMethod
(
'
get
'
,
function
(
url
)
{
return
getStorageGadget
(
this
)
.
push
(
function
(
storage_gadget
)
{
...
...
@@ -81,14 +81,14 @@
return
jIO
.
util
.
dataURItoBlob
(
result
);
});
})
.
declareMethod
(
'
put
'
,
function
(
url
,
parameter
)
{
var
blob
,
gadget
=
this
;
if
(
parameter
.
blob
!==
undefined
)
{
blob
=
parameter
.
blob
;
}
else
{
blob
=
new
Blob
(
[
parameter
.
content
],
[
parameter
.
content
],
{
type
:
parameter
.
type
,}
);
}
...
...
@@ -105,7 +105,7 @@
.
push
(
console
.
log
,
console
.
log
)
;
})
.
declareMethod
(
'
remove
'
,
function
(
url
)
{
return
getStorageGadget
(
this
)
.
push
(
function
(
storage_gadget
)
{
...
...
gadget/gadget_cribjs_header.html
View file @
ec704ac6
...
...
@@ -36,7 +36,7 @@
<div class="ui-controlgroup-controls">
</div>
</div>
<h1 class="ui-title"></h1>
<div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-right">
...
...
gadget/gadget_cribjs_header.js
View file @
ec704ac6
...
...
@@ -136,7 +136,7 @@
.
push
(
function
(
link_list
)
{
for
(
var
i
=
0
;
i
<
link_list
.
length
;
i
++
)
{
gadget
.
props
.
element
.
querySelector
(
"
.
"
+
page_list
[
i
]).
href
=
link_list
[
i
]
}
}
});
})
...
...
gadget/gadget_cribjs_page_cribjs_home.html
View file @
ec704ac6
...
...
@@ -21,7 +21,7 @@
CribJS offer to you the possibility to create your version of the web application you are using.
Make your copy of the web from here: learn, modify, improve, share.
</p>
<p>
As this application is a place to develop web applications, it can edit itself.
See how it is made, modify it, improve it.
See how it is made, modify it, improve it.
Start developping your own way. Feel free to make this place your own crib.
</p>
<ul>
<li>
1. Browse the
<a
class=
"url_list"
href=
"#page=url_list"
>
list of URLs
</a>
you wish to edit
</li>
...
...
gadget/gadget_cribjs_page_cribjs_home.js
View file @
ec704ac6
...
...
@@ -36,7 +36,7 @@
.
push
(
function
(
link_list
)
{
for
(
var
i
=
0
;
i
<
link_list
.
length
;
i
++
)
{
gadget
.
props
.
element
.
querySelector
(
"
.
"
+
page_list
[
i
]).
href
=
link_list
[
i
]
}
}
});
})
...
...
gadget/gadget_cribjs_page_editor.html
View file @
ec704ac6
...
...
@@ -13,7 +13,7 @@
<!-- Custom -->
<script
src=
"./gadget_cribjs_page_editor.js"
type=
"text/javascript"
></script>
</head>
<body>
<div
class=
"nav_content editor"
>
...
...
gadget/gadget_cribjs_page_editor.js
View file @
ec704ac6
...
...
@@ -11,7 +11,7 @@
mimetype
=
gadget
.
props
.
element
.
querySelector
(
"
form.crib-editor-save .mimetype
"
).
value
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
'
codeeditor
'
);
return
gadget
.
getDeclaredGadget
(
'
codeeditor
'
);
})
.
push
(
function
(
code_editor_gadget
)
{
return
code_editor_gadget
.
getContent
();
...
...
@@ -69,7 +69,7 @@
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
gadget
=
this
;
if
(
options
===
undefined
)
if
(
options
===
undefined
)
options
=
{}
gadget
.
props
.
options
=
options
;
return
new
RSVP
.
Queue
()
...
...
@@ -87,7 +87,7 @@
})
.
push
(
function
()
{
return
gadget
.
props
.
start_deferred
.
resolve
();
})
})
})
.
declareService
(
function
()
{
var
gadget
=
this
;
...
...
@@ -116,5 +116,5 @@
));
return
RSVP
.
all
(
promise_list
);
});
})
})
}(
window
,
rJS
,
loopEventListener
,
jIO
));
\ No newline at end of file
gadget/gadget_cribjs_page_mass_remove.html
View file @
ec704ac6
...
...
@@ -12,7 +12,7 @@
<!-- Custom -->
<script
src=
"./gadget_cribjs_page_mass_remove.js"
type=
"text/javascript"
></script>
</head>
<body>
<div
class=
"nav_content mass_remove container"
>
...
...
gadget/gadget_cribjs_page_mass_remove.js
View file @
ec704ac6
...
...
@@ -22,8 +22,8 @@
gadget
.
props
.
element
.
querySelector
(
"
.crib-mass-remove-status
"
).
textContent
=
error
;
console
.
log
(
error
);
});
}
}
rJS
(
window
)
.
ready
(
function
(
g
)
{
g
.
props
=
{};
...
...
@@ -42,7 +42,7 @@
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
gadget
.
props
.
start_deferred
.
resolve
();
})
})
})
.
declareService
(
function
()
{
var
gadget
=
this
;
...
...
@@ -61,5 +61,5 @@
));
return
RSVP
.
all
(
promise_list
);
});
})
})
}(
window
,
rJS
,
loopEventListener
));
\ No newline at end of file
gadget/gadget_cribjs_page_save_load.html
View file @
ec704ac6
...
...
@@ -14,7 +14,7 @@
<!-- Custom -->
<script
src=
"./gadget_cribjs_page_save_load.js"
type=
"text/javascript"
></script>
</head>
<body>
<div
class=
"nav_content save_load container"
>
...
...
gadget/gadget_cribjs_page_select_site.html
View file @
ec704ac6
...
...
@@ -14,12 +14,12 @@
<!-- Custom -->
<script
src=
"./gadget_cribjs_page_select_site.js"
type=
"text/javascript"
></script>
</head>
<body>
<div
class=
"nav_content save_load container"
>
<h3>
Site Editor Gadget URL
</h3>
<p>
Enter the URL of the Crib Gadget from the site you want to edit. If you want to edit this site use:
<p>
Enter the URL of the Crib Gadget from the site you want to edit. If you want to edit this site use:
"/crib-enable.html"
</p>
<div
class=
"row"
>
<table
class=
"table"
>
...
...
gadget/gadget_cribjs_page_select_site.js
View file @
ec704ac6
...
...
@@ -10,7 +10,7 @@
.
push
(
function
()
{
gadget
.
props
.
element
.
querySelector
(
"
.crib-site-save-status
"
).
textContent
=
"
Saved
"
+
site_editor_gadget_url
+
"
files at
"
+
Date
()
})
}
}
rJS
(
window
)
.
ready
(
function
(
g
)
{
...
...
@@ -39,7 +39,7 @@
.
push
(
function
(
site_editor_gadget_url
)
{
gadget
.
props
.
element
.
querySelector
(
'
form.site-editor-gadget-url .url
'
).
value
=
site_editor_gadget_url
;
return
gadget
.
props
.
start_deferred
.
resolve
();
})
})
})
.
declareService
(
function
()
{
var
gadget
=
this
;
...
...
@@ -58,5 +58,5 @@
));
return
RSVP
.
all
(
promise_list
);
});
})
})
}(
window
,
rJS
,
loopEventListener
));
\ No newline at end of file
gadget/gadget_cribjs_page_url_list.html
View file @
ec704ac6
...
...
@@ -12,7 +12,7 @@
<!-- Custom -->
<script
src=
"./gadget_cribjs_page_url_list.js"
type=
"text/javascript"
></script>
</head>
<body>
<div
class=
"nav_content url_list container"
>
...
...
gadget/gadget_cribjs_page_url_list.js
View file @
ec704ac6
...
...
@@ -70,7 +70,7 @@
trElement
.
appendChild
(
tdElement
);
tdElement
=
document
.
createElement
(
'
td
'
);
tdElement
.
innerHTML
=
url_number
+
"
URLs
"
;
trElement
.
appendChild
(
tdElement
);
trElement
.
appendChild
(
tdElement
);
tdElement
=
document
.
createElement
(
'
td
'
);
trElement
.
appendChild
(
tdElement
);
footer_element
.
appendChild
(
trElement
);
...
...
@@ -90,7 +90,7 @@
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
gadget
=
this
;
if
(
options
===
undefined
)
if
(
options
===
undefined
)
options
=
{}
gadget
.
props
.
options
=
options
;
return
new
RSVP
.
Queue
()
...
...
@@ -99,7 +99,7 @@
})
.
push
(
function
()
{
return
gadget
.
props
.
start_deferred
.
resolve
();
})
})
})
.
declareService
(
function
()
{
var
gadget
=
this
;
...
...
@@ -115,5 +115,5 @@
function
(
event
)
{
displayURLList
(
gadget
,
event
)}
)
});
})
})
}(
window
,
rJS
,
loopEventListener
));
\ No newline at end of file
gadget/gadget_cribjs_router.js
View file @
ec704ac6
...
...
@@ -123,7 +123,7 @@
};
});
})
.
declareAcquiredMethod
(
'
jio_get
'
,
'
jio_get
'
)
.
declareAcquiredMethod
(
'
renderApplication
'
,
'
renderApplication
'
)
.
declareMethod
(
'
start
'
,
function
()
{
...
...
gadget/gadget_landing_cribjs.js
View file @
ec704ac6
...
...
@@ -15,7 +15,7 @@
function
getSetting
(
gadget
,
key
,
default_value
)
{
if
(
key
===
"
site_editor_gadget_url
"
)
{
return
window
.
location
.
protocol
+
"
//
"
+
window
.
location
.
host
+
"
/crib-enable.html
"
}
}
return
default_value
;
}
...
...
@@ -32,11 +32,11 @@
}
relativePath
=
relativePath
.
substring
(
from_path
.
length
);
if
(
!
relativePath
.
startsWith
(
"
/
"
)
&&
!
path_to_load
.
endsWith
(
"
/
"
))
{
end_url
=
path_to_load
+
"
/
"
+
relativePath
end_url
=
path_to_load
+
"
/
"
+
relativePath
}
else
if
(
relativePath
.
startsWith
(
"
/
"
)
&&
path_to_load
.
endsWith
(
"
/
"
))
{
end_url
=
path_to_load
+
relativePath
.
substring
(
1
);
}
else
{
end_url
=
path_to_load
+
relativePath
end_url
=
path_to_load
+
relativePath
}
promise_list
.
push
(
new
RSVP
.
Queue
().
...
...
@@ -53,7 +53,7 @@
}
else
if
(
end_url
.
endsWith
(
"
.css
"
)
)
{
// This is a ugly hack as mimetype needs to be correct for JS
result
=
result
.
slice
(
0
,
result
.
size
,
"
text/css
"
)
}
}
return
crib_sw_gadget
.
put
(
end_url
,
{
blob
:
result
})
})
)
...
...
@@ -67,7 +67,7 @@
file_list
=
options
.
file_list
;
if
(
file_list
.
length
===
0
)
{
return
"
No File to Load
"
;
}
}
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
([
...
...
landing.js
View file @
ec704ac6
...
...
@@ -6,8 +6,8 @@
function
getParameterDict
()
{
var
hash
=
window
.
location
.
hash
.
substring
(
1
),
params
=
{};
hash
.
split
(
'
&
'
).
map
(
hk
=>
{
let
temp
=
hk
.
split
(
'
=
'
);
hash
.
split
(
'
&
'
).
map
(
hk
=>
{
let
temp
=
hk
.
split
(
'
=
'
);
params
[
temp
[
0
]]
=
temp
[
1
];
});
return
params
;
...
...
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