Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
uncloud
files_readmemd
Commits
8248023a
Commit
8248023a
authored
Oct 23, 2018
by
Matthieu Le Corre
Browse files
Initial commit
parents
Changes
4
Show whitespace changes
Inline
Side-by-side
appinfo/app.php
0 → 100644
View file @
8248023a
<?php
$eventDispatcher
=
\
OC
::
$server
->
getEventDispatcher
();
$eventDispatcher
->
addListener
(
'OCA\Files::loadAdditionalScripts'
,
function
()
{
OCP\Util
::
addscript
(
'files_readmemd'
,
'script'
);
OCP\Util
::
addStyle
(
'files_readmemd'
,
'style'
)
;
});
appinfo/info.xml
0 → 100644
View file @
8248023a
<?xml version="1.0"?>
<info>
<id>
files_readmemd
</id>
<name>
README.md
</name>
<summary>
Show README.md gitlab style
</summary>
<description>
<![CDATA[Show README.md gitlab style ]]>
</description>
<version>
0.0.1
</version>
<licence>
agpl
</licence>
<author
mail=
"matthieu.lecorre@univ-nantes.fr"
homepage=
"http://www.univ-nantes.fr"
>
Matthieu Le Corre
</author>
<namespace>
ReadMeMd
</namespace>
<bugs>
https://gitlab.univ-nantes.fr
</bugs>
<dependencies>
<nextcloud
min-version=
"12"
max-version=
"14"
/>
</dependencies>
<types>
<filesystem/>
</types>
</info>
css/style.css
0 → 100644
View file @
8248023a
.readmemd
{
padding
:
2em
;
border-top
:
1px
solid
silver
;
margin-top
:
1em
;
background-color
:
#c6d6390
f
;
}
.readmemd
::before
{
content
:
"README.md"
;
color
:
silver
;
}
.headermd
{
padding
:
2em
;
border-bottom
:
1px
solid
silver
;
margin-bottom
:
1em
;
background-color
:
#c6d6390
f
;
}
js/script.js
0 → 100644
View file @
8248023a
/**
* @namespace OCA.IndexMD
*/
OCA
.
ReadmeMD
=
{};
/**
* @namespace OCA.IndexMD.App
*/
OCA
.
ReadmeMD
.
App
=
{
/**
* Holds the MD container and content
*/
container
:
null
,
content
:
null
,
/**
* Setup on page load
*/
initialize
:
function
(
container
)
{
// Don't load if not in the files app
if
(
!
$
(
'
#content.app-files
'
).
length
)
{
return
;
}
//Don't load if the markdown apps is not present
if
(
!
OCA
.
Files_Texteditor
.
previewPlugins
[
"
text/markdown
"
])
{
console
.
error
(
'
MarkDown Apps not available !
'
)
;
return
;
}
//initialise MD renderer
OCA
.
Files_Texteditor
.
previewPlugins
[
"
text/markdown
"
].
init
()
;
// trigger on filetable
$
(
"
#filestable
"
).
on
(
'
updated
'
,
this
.
checkMD
);
// container creation
this
.
container
=
container
;
this
.
createContainer
()
;
},
/**
* check MD handler
*/
checkMD
:
function
()
{
OCA
.
ReadmeMD
.
container
.
addClass
(
"
hidden
"
)
;
for
(
var
filenum
in
OCA
.
Files
.
App
.
fileList
.
files
)
{
if
(
OCA
.
Files
.
App
.
fileList
.
files
[
filenum
].
name
==
"
README.md
"
)
{
OCA
.
ReadmeMD
.
container
.
removeClass
(
"
hidden
"
)
;
OCA
.
ReadmeMD
.
fillContainer
()
;
}
;
}
;
},
/**
* show contenair
*/
createContainer
:
function
()
{
$
(
'
#filestable
'
).
after
(
this
.
container
)
;
},
/**
* fill contant
*/
fillContainer
:
function
()
{
dir
=
OCA
.
Files
.
App
.
fileList
.
_currentDirectory
;
filename
=
"
README.md
"
;
$
.
get
(
OC
.
generateUrl
(
'
/apps/files_texteditor/ajax/loadfile
'
),
{
filename
:
filename
,
dir
:
dir
}
).
done
(
function
(
data
)
{
OCA
.
ReadmeMD
.
content
=
data
.
filecontents
;
OCA
.
ReadmeMD
.
renderMD
()
;
})
;
},
/**
* Render Markdown
**/
renderMD
:
function
()
{
OCA
.
ReadmeMD
.
container
.
addClass
(
'
icon-loading
'
)
.
children
().
remove
();
OCA
.
Files_Texteditor
.
previewPlugins
[
"
text/markdown
"
].
renderer
.
renderText
(
OCA
.
ReadmeMD
.
content
,
OCA
.
ReadmeMD
.
container
).
done
(
function
(
data
)
{
$
(
"
#filestable > tfoot > tr
"
).
height
(
"
auto
"
)
;
OCA
.
ReadmeMD
.
container
.
removeClass
(
'
icon-loading
'
)
;
});
}
};
OCA
.
ReadmeMD
=
OCA
.
ReadmeMD
.
App
;
$
(
document
).
ready
(
function
()
{
OCA
.
ReadmeMD
.
initialize
(
$
(
'
<div id="preview" class="hidden text-markdown readmemd"></div>
'
)
);
});
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