diff --git a/src/core/static/css/main.css b/src/core/static/css/main.css index d854fc0..0622437 100644 --- a/src/core/static/css/main.css +++ b/src/core/static/css/main.css @@ -46,11 +46,12 @@ +.icon-style { + width: 2em; + height: auto; +} .dir-style, .video-style, .image-style, .file-style { - /* max-width: 24vw; */ - /* height: auto; - position: relative; */ max-width: 20em; } diff --git a/src/core/static/js/post-ajax.js b/src/core/static/js/post-ajax.js index 7654ad1..9b173e9 100644 --- a/src/core/static/js/post-ajax.js +++ b/src/core/static/js/post-ajax.js @@ -45,19 +45,15 @@ const generateFavesList = (data) => { const updateHTMLDirList = async (data) => { - console.log(data); - let pathElm = document.getElementById("path"); - let dirs = (data.list.dirs) ? data.list.dirs[0] : []; - let videos = (data.list.vids) ? data.list.vids[0] : []; - let images = (data.list.images) ? data.list.images[0] : []; - let files = (data.list.ungrouped) ? data.list.ungrouped[0] : []; - let isInFaves = data.in_fave; - - console.log(data.list.images); + // let dirs = data.list.dirs[0]; + // let videos = data.list.vids[0]; + let images = data.list.images[0]; + // let files = data.list.files[0]; + let isInFaves = data.in_fave; let background_image = (images[0]) ? images[0][0] : ""; - console.log(background_image); - pathElm.innerText = data.path_head; // Can still set the path info if locked... + + document.getElementById("path").innerText = data.path_head; // Setup background if there is a 000.* in selection if (background_image.match(/000\.(jpg|png|gif)\b/) != null) { // Due to same hash for 000 we add date to make link unique for each run to bypass cache issues... @@ -69,11 +65,11 @@ const updateHTMLDirList = async (data) => { } // See if in faves - let elm = document.getElementById("tggl-faves-btn"); + let tggl_faves_btn = document.getElementById("tggl-faves-btn"); if (isInFaves == "true") - elm.classList.add("btn-info"); + tggl_faves_btn.classList.add("btn-info"); else - elm.classList.remove("btn-info"); + tggl_faves_btn.classList.remove("btn-info"); renderFilesList(data.list); @@ -163,26 +159,26 @@ const updateHTMLDirList = async (data) => { // ulElm.appendChild(clone); } -const setFileIconType = (fileName) => { - icoPath = ""; - - if (fileName.match(/\.(doc|docx|xls|xlsx|rtf)\b/) != null) { - icoPath = "static/imgs/icons/doc.png"; - } else if (fileName.match(/\.(7z|7zip|zip|tar.gz|tar.xz|gz|rar|jar)\b/) != null) { - icoPath = "resources/images/icons/arc.png"; - } else if (fileName.match(/\.(pdf)\b/) != null) { - icoPath = "static/imgs/icons/pdf.png"; - } else if (fileName.match(/\.(html)\b/) != null) { - icoPath = "static/imgs/icons/html.png"; - } else if (fileName.match(/\.(txt|conf)\b/) != null) { - icoPath = "static/imgs/icons/text.png"; - } else if (fileName.match(/\.(iso|img)\b/) != null) { - icoPath = "static/imgs/icons/img.png"; - } else if (fileName.match(/\.(sh|batch|exe)\b/) != null) { - icoPath = "static/imgs/icons/scrip.png"; - } else { - icoPath = "static/imgs/icons/bin.png"; - } - - return formatURL(icoPath) -} +// const setFileIconType = (fileName) => { +// icoPath = ""; +// +// if (fileName.match(/\.(doc|docx|xls|xlsx|rtf)\b/) != null) { +// icoPath = "static/imgs/icons/doc.png"; +// } else if (fileName.match(/\.(7z|7zip|zip|tar.gz|tar.xz|gz|rar|jar)\b/) != null) { +// icoPath = "resources/images/icons/arc.png"; +// } else if (fileName.match(/\.(pdf)\b/) != null) { +// icoPath = "static/imgs/icons/pdf.png"; +// } else if (fileName.match(/\.(html)\b/) != null) { +// icoPath = "static/imgs/icons/html.png"; +// } else if (fileName.match(/\.(txt|conf)\b/) != null) { +// icoPath = "static/imgs/icons/text.png"; +// } else if (fileName.match(/\.(iso|img)\b/) != null) { +// icoPath = "static/imgs/icons/img.png"; +// } else if (fileName.match(/\.(sh|batch|exe)\b/) != null) { +// icoPath = "static/imgs/icons/scrip.png"; +// } else { +// icoPath = "static/imgs/icons/bin.png"; +// } +// +// return formatURL(icoPath) +// } diff --git a/src/core/static/js/react-ui-logic.js b/src/core/static/js/react-ui-logic.js index d584afe..88ccc42 100644 --- a/src/core/static/js/react-ui-logic.js +++ b/src/core/static/js/react-ui-logic.js @@ -1,21 +1,49 @@ +const setFileIconType = (fileName) => { + let icoPath = ""; + + if (fileName.match(/\.(doc|docx|xls|xlsx|rtf)\b/) != null) { + icoPath = "static/imgs/icons/doc.png"; + } else if (fileName.match(/\.(7z|7zip|zip|tar.gz|tar.xz|gz|rar|jar)\b/) != null) { + icoPath = "resources/images/icons/arc.png"; + } else if (fileName.match(/\.(pdf)\b/) != null) { + icoPath = "static/imgs/icons/pdf.png"; + } else if (fileName.match(/\.(html)\b/) != null) { + icoPath = "static/imgs/icons/html.png"; + } else if (fileName.match(/\.(txt|conf)\b/) != null) { + icoPath = "static/imgs/icons/text.png"; + } else if (fileName.match(/\.(iso|img)\b/) != null) { + icoPath = "static/imgs/icons/img.png"; + } else if (fileName.match(/\.(sh|batch|exe)\b/) != null) { + icoPath = "static/imgs/icons/scrip.png"; + } else { + icoPath = "static/imgs/icons/bin.png"; + } + + return icoPath +} + // Create a ES6 class component class FilesList extends React.Component { // Use the render function to return JSX component render() { let final = []; - let files = this.props.files; + let files = this.props.files[0]; + console.log(files); for (let file of files) { final.push(
-
{file}
+
+ {file[0]} + {file[0]} +
- {file} + {file[0]}
@@ -31,13 +59,9 @@ class FilesList extends React.Component { } const renderFilesList = (data = null) => { - // Obtain the root - const filesListElm = document.getElementById('files') - console.log(data); - - // // Use the ReactDOM.render to show our component on the browser - // ReactDOM.render( - // React.createElement(FilesList, data), - // filesListElm - // ) + const filesListElm = document.getElementById('files'); + ReactDOM.render( + React.createElement(FilesList, data), + filesListElm + ) } diff --git a/src/core/templates/favorites-modal.html b/src/core/templates/favorites-modal.html new file mode 100644 index 0000000..8312b75 --- /dev/null +++ b/src/core/templates/favorites-modal.html @@ -0,0 +1,26 @@ + + diff --git a/src/core/templates/file-modal.html b/src/core/templates/file-modal.html new file mode 100644 index 0000000..d45a9d7 --- /dev/null +++ b/src/core/templates/file-modal.html @@ -0,0 +1,77 @@ + + diff --git a/src/core/templates/options-modal.html b/src/core/templates/options-modal.html new file mode 100644 index 0000000..9833809 --- /dev/null +++ b/src/core/templates/options-modal.html @@ -0,0 +1,42 @@ + +