From 41a91c76d3b82dbc337bdfff23015af6e5dbd1c0 Mon Sep 17 00:00:00 2001 From: jyamihud Date: Fri, 15 Apr 2022 22:25:42 +0300 Subject: [PATCH] CSS-fu beutifying of the site. No JS --- data/favicon_requests.json | 8 +- default.css | 31 ++++ faq.html | 16 ++ modules/#render.py# | 360 ------------------------------------- modules/.#render.py | 1 - modules/render.py | 11 +- server.py | 21 ++- 7 files changed, 72 insertions(+), 376 deletions(-) delete mode 100644 modules/#render.py# delete mode 120000 modules/.#render.py diff --git a/data/favicon_requests.json b/data/favicon_requests.json index 31b62eb..621ee7c 100644 --- a/data/favicon_requests.json +++ b/data/favicon_requests.json @@ -16,5 +16,11 @@ 1650043490.4135377, 1650043958.2914546, 1650043959.0416543, - 1650044037.8992538 + 1650044037.8992538, + 1650046703.1072881, + 1650046892.2908967, + 1650046892.7005703, + 1650046895.821551, + 1650049035.9363937, + 1650050029.5476623 ] \ No newline at end of file diff --git a/default.css b/default.css index 67f03a7..6878962 100644 --- a/default.css +++ b/default.css @@ -126,4 +126,35 @@ p { margin-right: 5%; margin-left: 5%; } + +.searchbar { + width: 90%; + height: 70; + position: fixed; + top: 0; + margin-top: 1%; + left: 5%; +} + +.side_found { margin-top: 100} +.footer {} +@media screen and (min-width: 1024px) { + .recomendations { + margin-left: 40%;} + + .searchbar { + width: 35%;} + .footer { + width: 60%; + height: 70; + position: fixed; + bottom: 70; + left: 40%;} + .side_found { + margin-top: 0; + width: 35%; + position: fixed; + top:100; + left:5%;} } + } diff --git a/faq.html b/faq.html index 46bf728..8470ddb 100644 --- a/faq.html +++ b/faq.html @@ -1,3 +1,18 @@ + +
Some test text
+ +

Frequently Asked Questions:

@@ -118,3 +133,4 @@

Now search for something and get a list of Free Competitors for it. + diff --git a/modules/#render.py# b/modules/#render.py# deleted file mode 100644 index aa08c08..0000000 --- a/modules/#render.py# +++ /dev/null @@ -1,360 +0,0 @@ -# THIS SOFTWARE IS A PART OF FREE COMPETITOR PROJECT -# THE FOLLOWING SOURCE CODE I UNDER THE GNU -# AGPL LICENSE V3 OR ANY LATER VERSION. - -# This project is not for simple users, but for -# web-masters and a like, so we are counting on -# your ability to set it up and running. - -import os -from modules import search - - -def html(page, json): - - # This function adds a rendering of the json into the page - - free = search.is_free(json) - name = json.get("names",["Unknown"])[0] - page = page + """ - - - - - """ - page = page + "\n " - page = page + "\n

" - try: - page = page + '\n [LOGO] \n' - except: - pass - - page = page + " "+ name +" \n" - page = page + "

\n
\n\n" - - page = page + """ - - - - """ - - # Few words about it - comment = json.get("comment","") - not_foss = ['open source', 'open-source'] - if "open source" or "open-source" in comment.lower(): - # Well... Here is a thing. Free Software, not open source. - where = comment.lower().find("open source") - # In case it has a slash in it. - if where == -1: - where = comment.lower().find("open-source") - ops = comment[where:where+11] - if ops: - comment = comment.replace(ops, - ""+ops+"") - page = page + "\n

\n "+comment+"\n

\n\n" - - # I want to show nothing else from if it's proprietary - issues_files = list(os.listdir("data/issues")) - if "issues" in json: - l = json.get("issues", []) - page = page +"

Anti-Features / Problems:

" - - for i in l: - if i+".html" not in issues_files: - page = page + "  "+i+"
" - else: - page = page + '
' - page = page + "  "+i+"" - issuefile = open("data/issues/"+i+".html") - page = page + "

"+issuefile.read()+"

" - page = page + "
" - if not free: - return page - - - # Links - - page = page + """ - - - """ - - page = page + """ - - - - - """ - - page = page + "" - linksfilter = {"git":"source"} - links = json.get("links", {}) - for website in links: - if website in ["icon"]: - continue - link = links[website] - page = page + """ - - - - - """ - - page = page + "
-
- -
-
" - - page = page + """ - - - - """ - - # Details - - categories = {"generic_name":"Features", - "licenses":"License(s)", - "platforms":"Platforms", - "networks_read":"Accesses Data from", - "networks_write":"Interacts / Publishes to", - "formats_read":"Opens from File-Formats", - "formats_write":"Saves to File-Formats", - "interface":"Interface", - "languages":"Programming Languages"} - - for c in categories: - - l = json.get(c, []) - if not l: - continue - - # I want to look whether this category has a list of files - alldata = list(os.listdir("data")) - allfiles = [] - for folder in alldata: - if c.startswith(folder): - try: - allfiles = list(os.listdir("data/"+folder)) - break - except: - pass - # Count matches - matches = 0 - for i in l: - if i.startswith("*"): - matches += 1 - if matches: - matchtext = "( "+str(matches)+" )" - else: - matchtext = "" - page = page + "\n\n
" - page = page +"\n "+categories[c]+": "+matchtext+"" - - for i in l: - matchtext = "" - if i.startswith("*"): - i = i[1:] - matchtext = "    ( match ) " - if i+".html" in allfiles: - datapage = open("data/"+folder+"/"+i+".html") - page = page + """ - - - - """ - page = page + "
\n" - page = page + "     "+matchtext+i+"\n" - page = page + " \n

\n" - page = page + " " + datapage.read()+"\n" - page = page + "

\n
\n
" - else: - page = page + "\n     "+matchtext+i+"\n
\n" - page = page + """ - - -
- -
- - """ - - - return page - -def suggestions(page, json): - - # This function will render suggestions - - page = page + """ - - - -

Free Competitors:

- - """ - - found = search.suggest(json) - - biggest = 0 - for i in found: - if i[0] > biggest: - biggest = i[0] - more = False - for i in found: - free = search.is_free(i[-1]) - - if not i[0] or i[-1]["names"] == json["names"] or not free: - continue - try: - frac = int(i[0]/biggest*100) - except: - frac = 0 - - if frac < 20 and not more: # Below 40% features match - page = page + """ - - - -
-
-

Problematic Competitors:

- - """ - more = True - - page = page +""" - -
- - - """ - - page = page + "
Suggestion score: " + str(frac) + "%" - page = html(page, i[-1]) - - if more: - page = page + "
" - return page - -def search_widget(page, address): - - # Adds a search bar to the page - - page = page + """ - - -
- - -
- - - - """ - #page = page.format(ADDRESS) - - return page - -def source_code_link(page): - - # Adds a source code link - - page = page + """ - - - -
-
- -
- -

This website is under the GNU AGPL license.

- - - - - - - - - - - - - - - - - - - -
- -
- -
- -
- -
- -
- -
-
- - - - - """ - - - - return page diff --git a/modules/.#render.py b/modules/.#render.py deleted file mode 120000 index 95a612e..0000000 --- a/modules/.#render.py +++ /dev/null @@ -1 +0,0 @@ -vcs@vcs-Lenovo-IdeaPad-S145-15IWL.3286:1650042546 \ No newline at end of file diff --git a/modules/render.py b/modules/render.py index a4a95b7..db730f0 100644 --- a/modules/render.py +++ b/modules/render.py @@ -24,7 +24,6 @@ def html(page, json): to search Free Competitors to what is found. --> """ - page = page + "\n " page = page + "\n

" try: @@ -301,12 +300,7 @@ def source_code_link(page): -
-
- -
- -

This website is under the GNU AGPL license.

+ This website is under the GNU AGPL license. @@ -346,9 +340,6 @@ def source_code_link(page): -
-
- diff --git a/server.py b/server.py index 3a3ee83..43315bd 100644 --- a/server.py +++ b/server.py @@ -97,9 +97,9 @@ class handler(BaseHTTPRequestHandler): csstext = '' text = " \n\n" text = text + "\n" - text = text + ''+csstext+'\n\n' + text = text + ''+csstext+'\n\n' text = text + "\n\n" - text = text + '' + text = text + '\n\n' text = text + "\n" text = text + '\n\n'+textin+'\n\n' @@ -211,13 +211,26 @@ class handler(BaseHTTPRequestHandler): software = self.path.replace("/", "").replace("+", " ") software_data, match = search.search_app(software) - - page = render.search_widget("", ADDRESS) + + page = "" + page = page + '" + + page = page + '
' page = page +"Search match: "+ str(int(match*100))+"%" # Let's add the found software to the page page = render.html(page, software_data) + page = page + "
" + + page = page + '
' page = render.suggestions(page, software_data) + page = page + "
" + + page = page + '" + self.send(page)