commit a71d1240665d46393d644aa6df7eb6da7a1ceb7d Author: benny Date: Thu Jun 6 13:47:07 2024 +0300 git init of winget repo statistics and manager diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..60d49a7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +Logs/ +*.exe \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..608d3c6 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Launch Package", + "type": "go", + "request": "launch", + "mode": "auto", + "program": "${fileDirname}" + } + ] +} \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..5aa5e07 --- /dev/null +++ b/go.mod @@ -0,0 +1,21 @@ +module main + +go 1.22.3 + +require ( + github.com/dustin/go-humanize v1.0.1 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-sqlite3 v1.14.22 // indirect + github.com/ncruces/go-strftime v0.1.9 // indirect + github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect + golang.org/x/sys v0.19.0 // indirect + modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 // indirect + modernc.org/libc v1.50.9 // indirect + modernc.org/mathutil v1.6.0 // indirect + modernc.org/memory v1.8.0 // indirect + modernc.org/sqlite v1.30.0 // indirect + modernc.org/strutil v1.2.0 // indirect + modernc.org/token v1.1.0 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..e22a11d --- /dev/null +++ b/go.sum @@ -0,0 +1,31 @@ +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= +github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= +github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4= +github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= +github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= +github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 h1:5D53IMaUuA5InSeMu9eJtlQXS2NxAhyWQvkKEgXZhHI= +modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6/go.mod h1:Qz0X07sNOR1jWYCrJMEnbW/X55x206Q7Vt4mz6/wHp4= +modernc.org/libc v1.50.9 h1:hIWf1uz55lorXQhfoEoezdUHjxzuO6ceshET/yWjSjk= +modernc.org/libc v1.50.9/go.mod h1:15P6ublJ9FJR8YQCGy8DeQ2Uwur7iW9Hserr/T3OFZE= +modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4= +modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo= +modernc.org/memory v1.8.0 h1:IqGTL6eFMaDZZhEWwcREgeMXYwmW83LYW8cROZYkg+E= +modernc.org/memory v1.8.0/go.mod h1:XPZ936zp5OMKGWPqbD3JShgd/ZoQ7899TUuQqxY+peU= +modernc.org/sqlite v1.30.0 h1:8YhPUs/HTnlEgErn/jSYQTwHN/ex8CjHHjg+K9iG7LM= +modernc.org/sqlite v1.30.0/go.mod h1:cgkTARJ9ugeXSNaLBPK3CqbOe7Ec7ZhWPoMFGldEYEw= +modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA= +modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0= +modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= +modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= diff --git a/html/ana.html b/html/ana.html new file mode 100644 index 0000000..4e441df --- /dev/null +++ b/html/ana.html @@ -0,0 +1,26 @@ + + + + HUJI Sap Analysis + + + +
+

מנהל החבילות של האוניברסיטה העברית

+ הדרכה: +

אפשרות א'

+

יש לפתוח את חלון ההתחל או את שורת החיפוש ולהקליד CMD. יש ללחוץ עליו בלחצן הימני, ולבחור "הפעל כמנהל". כשיפתח, יש להדביק את הטקסט הבא (לחיצה על הטקסט כדי להעתיק),

+
winget source add -n huji -t "Microsoft.Rest" + https://winget.cc.huji.ac.il/api/ & rmdir /s /q "%appdata%\SAP AG" & winget install sap.analysis -s huji
+
+

אפשרות ב'

+ + + להורדה קובץ ההרצה. יש ללחוץ על הלחצן הימני ולפתוח כמנהל. במידה וייפתח חלון כחול, יש ללחוץ על פרטים נוספים -> אפשר +

הערה: בדפדפן מיקרוסופט אדג' יש ללחוץ על Keep על הקובץ.

+


+

במידה ובשגיאה נכתב כי הפקודה 'winget' אינה מוכרת למערכת, יש להדביק את הפקודה הבאה:

+
powershell -executionPolicy bypass -command "$progressPreference = 'silentlyContinue'; Write-Information 'Downloading WinGet and its dependencies...'; Invoke-WebRequest -Uri https://aka.ms/getwinget -OutFile Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle; Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile Microsoft.VCLibs.x64.14.00.Desktop.appx; Invoke-WebRequest -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx -OutFile Microsoft.UI.Xaml.2.8.x64.appx; Add-AppxPackage Microsoft.VCLibs.x64.14.00.Desktop.appx; Add-AppxPackage Microsoft.UI.Xaml.2.8.x64.appx; Add-AppxPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle;"
+ + + diff --git a/html/index.html b/html/index.html new file mode 100644 index 0000000..74c676a --- /dev/null +++ b/html/index.html @@ -0,0 +1,58 @@ + + + + + SQLite Data + + + + +
+ +
+ +

Download Statistics

+ + + + + + + <% downloadData.forEach(function(row) { %> + + + + + + <% }); %> +
ProgramVersionDownload Count
+ <%= row.program %> + + <%= row.version %> + + <%= row.download_count %> +
+
+
+

Total Download Statistics

+ + + + + + <% searchData.forEach(function(row) { %> + + + + + <% }); %> +
PackageSearch Count
+ <%= row.program %> + + <%= row.download_count %> +
+
+
+ + + \ No newline at end of file diff --git a/html/main.html b/html/main.html new file mode 100644 index 0000000..85b3bcf --- /dev/null +++ b/html/main.html @@ -0,0 +1,34 @@ +{{define "body"}} + + +
+
+

{{ .Header }}

+

{{ .Help }}

+

{{ .Explain }}

+
winget source add -n huji -t "Microsoft.Rest" + https://winget.cc.huji.ac.il/api/
+
+ +
+ + +{{end}} \ No newline at end of file diff --git a/html/master.html b/html/master.html new file mode 100644 index 0000000..ab35bbb --- /dev/null +++ b/html/master.html @@ -0,0 +1,14 @@ +{{define "master"}} + + + + + {{ .Title }} + + + + +{{template "body" .}} + + +{{end}} \ No newline at end of file diff --git a/html/mrkzi.html b/html/mrkzi.html new file mode 100644 index 0000000..4edca66 --- /dev/null +++ b/html/mrkzi.html @@ -0,0 +1,42 @@ + + + + + HUJI Packages + + + + + + +
+
+ +

מנהל החבילות של האוניברסיטה העברית

+

הדרכה:

+

יש לפתוח את חלון ההתחל או את שורת החיפוש ולהקלידCMD. יש ללחוץ עליו בלחצן הימני, ולבחור "הפעל כמנהל". כשיפתח, יש להדביק את הטקסט הבא (לחיצה על הטקסט כדי להעתיק),

+
winget source add -n huji -t "Microsoft.Rest" + https://winget.cc.huji.ac.il/api/
+
+ +
+ + + \ No newline at end of file diff --git a/html/sap.html b/html/sap.html new file mode 100644 index 0000000..6e5ecd0 --- /dev/null +++ b/html/sap.html @@ -0,0 +1,26 @@ + + + + HUJI Sap + + + +
+

מנהל החבילות של האוניברסיטה העברית

+ הדרכה: +

אפשרות א'

+

יש לפתוח את חלון ההתחל או את שורת החיפוש ולהקליד CMD. יש ללחוץ עליו בלחצן הימני, ולבחור "הפעל כמנהל". כשיפתח, יש להדביק את הטקסט הבא (לחיצה על הטקסט כדי להעתיק),

+
winget source add -n huji -t "Microsoft.Rest" + https://winget.cc.huji.ac.il/api/ & winget install sap.gui.upgrade -s huji
+
+

אפשרות ב'

+ + + להורדה קובץ ההרצה. יש ללחוץ על הלחצן הימני ולפתוח כמנהל. במידה וייפתח חלון כחול, יש ללחוץ על פרטים נוספים -> אפשר +

הערה: בדפדפן מיקרוסופט אדג' יש ללחוץ על Keep על הקובץ.

+


+

במידה ובשגיאה נכתב כי הפקודה 'winget' אינה מוכרת למערכת, יש להדביק את הפקודה הבאה:

+
powershell -executionPolicy bypass -command "$progressPreference = 'silentlyContinue'; Write-Information 'Downloading WinGet and its dependencies...'; Invoke-WebRequest -Uri https://aka.ms/getwinget -OutFile Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle; Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile Microsoft.VCLibs.x64.14.00.Desktop.appx; Invoke-WebRequest -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx -OutFile Microsoft.UI.Xaml.2.8.x64.appx; Add-AppxPackage Microsoft.VCLibs.x64.14.00.Desktop.appx; Add-AppxPackage Microsoft.UI.Xaml.2.8.x64.appx; Add-AppxPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle;"
+ + + diff --git a/html/up.html b/html/up.html new file mode 100644 index 0000000..3ea0887 --- /dev/null +++ b/html/up.html @@ -0,0 +1,33 @@ + + + + + +File Upload + + + + + + +
+ + + +
+ + + + + diff --git a/html/wsb.html b/html/wsb.html new file mode 100644 index 0000000..8988ffd --- /dev/null +++ b/html/wsb.html @@ -0,0 +1,26 @@ + + + + + HUJI Packages + + + +
+
$progressPreference = 'silentlyContinue'
+ Write-Information "Downloading WinGet and its dependencies..."
+ Invoke-WebRequest -Uri https://aka.ms/getwinget -OutFile Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
+ Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile Microsoft.VCLibs.x64.14.00.Desktop.appx
+ Invoke-WebRequest -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx -OutFile Microsoft.UI.Xaml.2.8.x64.appx
+ Add-AppxPackage Microsoft.VCLibs.x64.14.00.Desktop.appx
+ Add-AppxPackage Microsoft.UI.Xaml.2.8.x64.appx
+ Add-AppxPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
+ Set-ItemProperty -Path "Registry::HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name HideFileExt -Value 0
+ Set-ItemProperty -Path "Registry::HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name Hidden -Value 1
+ winget source add -n huji -t "Microsoft.Rest" https://winget.cc.huji.ac.il/api/
+ if((Test-Path -LiteralPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\huji.ac.il\winget.cc") -ne $true) { New-Item "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\huji.ac.il\winget.cc" -force -ea SilentlyContinue };
+New-ItemProperty -LiteralPath 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\huji.ac.il\winget.cc' -Name '*' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue;
+New-ItemProperty -LiteralPath 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\huji.ac.il\winget.cc' -Name 'https' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue;
+
+
+ \ No newline at end of file diff --git a/main.go b/main.go new file mode 100644 index 0000000..c132a7b --- /dev/null +++ b/main.go @@ -0,0 +1,110 @@ +package main + +import ( + "database/sql" + "fmt" + "html/template" + "log" + "net/http" + "os" + "time" + + _ "modernc.org/sqlite" +) + +func readHtml(res http.ResponseWriter, req *http.Request) { + g := template.CSS("./html/public/mod.css") + f, err := template.ParseFiles("./html/wsb.html") + if err != nil { + log.Println(err) + } + err = f.Execute(res, g) + if err != nil { + log.Println(err) + } + +} + +func simpRequestResp(res http.ResponseWriter, req *http.Request) { + fmt.Fprint(res, "Hello, M'Lord", 153*4, " I'm here to serveè") +} +func getMsgFromDB(sqldb *sql.DB, id string, lang string) string { + query := fmt.Sprintf("SELECT %s FROM msgs WHERE content=$1", lang) + res := sqldb.QueryRow(query, id) + lng := "" + dt := res.Scan(&lng) + if dt != nil { + return "" + } + return lng +} +func getPkgIdFromDB(sqldb *sql.DB) []string { + query, err := sqldb.Query("SELECT id FROM packs_all") + if err != nil { + log.Println(err) + } + var pkgs []string + query.Scan(&pkgs) + if err != nil { + log.Println(err) + } + return pkgs +} +// func fullSearchDB(sqldb *sql.DB) []string { + +// } +func index(sqldb *sql.DB) http.Handler { + return http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + b := elements{ + Title: getMsgFromDB(sqldb, "title", "heb"), + Header: getMsgFromDB(sqldb, "header", "heb"), + Help: getMsgFromDB(sqldb, "help", "heb"), + Packagename: getMsgFromDB(sqldb, "packagename", "heb"), + Packageversion: getMsgFromDB(sqldb, "packageversion", "heb"), + Allow: getMsgFromDB(sqldb, "allow", "heb"), + Warning: getMsgFromDB(sqldb, "warning", "heb"), + Explain: getMsgFromDB(sqldb, "explain", "heb"), + } + templates, err := template.ParseFiles("html/master.html", "html/main.html") + if err != nil { + log.Println(err) + } + err = templates.ExecuteTemplate(res, "master", &b) + if err != nil { + log.Println(err) + } + res.WriteHeader(http.StatusOK) + }) + +} +func public() http.Handler { + return http.StripPrefix("/public/", http.FileServer(http.Dir("./public"))) +} +func main() { + logfilename := "Logs/" + time.Now().Format("2006-01-02--15-04-05") + ".log" + file, err := os.OpenFile(logfilename, os.O_APPEND|os.O_CREATE, 0777) + if err != nil { + os.Exit(12) + } + + log.SetOutput(file) + db, err := sql.Open("sqlite", "file:progs.db") + mux := http.NewServeMux() + mux.Handle("/public/", public()) + mux.Handle("/", index(db)) + addr := fmt.Sprintf(":%s", "12312") + server := http.Server{ + Addr: addr, + Handler: mux, + ReadTimeout: 15 * time.Second, + WriteTimeout: 15 * time.Second, + IdleTimeout: 15 * time.Second, + } + + if err := server.ListenAndServe(); err != nil { + log.Fatalf("main: couldn't start simple server: %v\n", err) + } + lang := "heb" + + log.Println(getMsgFromDB(db, "title", lang)) +} diff --git a/packages.go b/packages.go new file mode 100644 index 0000000..91c2067 --- /dev/null +++ b/packages.go @@ -0,0 +1,19 @@ +package main + +type packages struct{ + name string + version string + extra_command string + tag string + warning bool +} +type elements struct { + Title string + Header string + Help string + Packagename string + Packageversion string + Allow string + Warning string + Explain string +} \ No newline at end of file diff --git a/public/mod.css b/public/mod.css new file mode 100644 index 0000000..728fbce --- /dev/null +++ b/public/mod.css @@ -0,0 +1,239 @@ +@import url("https://fonts.googleapis.com/css2?family=Alef:wght@400;700&display=swap"); + +abbr { + border: none; + text-decoration: none; +} + +body { + font-family: "Alef"; + padding-left: 10px; + margin: auto; + display: flex; + font-size: 14pt; + width: 75%; + background-color: #000000; + background: #000000; + color: #ffffff; + height: 100vh; + -webkit-background-size: cover; + -moz-background-size: cover; + -o-background-size: cover; + background-size: cover; + -webkit-user-select: none; + -ms-user-select: none; + user-select: none; + flex-direction: row; + flex-wrap: wrap; + align-content: flex-start; + justify-content: center; +} +body.m{ + width: auto; +} +.copyme::before { + content: "Click here to copy: "; + font-style: italic; +} + +.acopyme { + direction: ltr; + background: #6a568b; + color: #ffffff; + cursor: pointer; + border-radius: 15px; + /* margin-left: -10px; */ + transition: background 0.3s ease; + padding: inherit; + margin-bottom: 10px; +} + +.acopyme:hover { + background: #7e7391; + cursor: pointer; +} + +.copyme { + direction: ltr; + background: #6a568b; + color: #ffffff; + cursor: pointer; + border-radius: 15px; + /* margin-left: -10px; */ + transition: background 0.3s ease; + padding: inherit; + margin-bottom: 10px; +} + +.copyme:hover { + background: #7e7391; + cursor: pointer; +} + +ul { + list-style-type: none; + background-color: inherit; + color: inherit; + padding-left: 5px; + background: inherit; + justify-content: inherit; + align-items: inherit; + align-content: inherit; + text-align: inherit; +} + +ul.r { + list-style-type: none; + background-color: inherit; + color: inherit; + padding-right: 5px; + margin-left: -20px; + background: inherit; + justify-content: inherit; + align-items: inherit; + align-content: inherit; + text-align: inherit; + +} + +li { + margin-bottom: 20px; + background-color: inherit; + color: inherit; + background: inherit; + padding: inherit; + justify-content: inherit; + align-items: inherit; + align-content: inherit; + text-align: inherit; +} + +li:hover { + background: #1a1a1a; + border-color: #7e7391; + border-radius: 15px; + cursor: pointer; +} + +div { + display: block; + background-color: inherit; + padding: inherit; + width: inherit; + color: inherit; + background: inherit; + justify-content: inherit; + align-items: inherit; + align-content: inherit; + text-align: inherit; +} + +th, +td { + padding-right: 40px; + /* Adjust as needed */ + text-align: left; + justify-content: inherit; + align-items: inherit; + align-content: inherit; + text-align: inherit; +} + +.container { + overflow: hidden; + justify-content: inherit; + align-items: inherit; + align-content: inherit; + text-align: inherit; +} + +.column { + float: left; + margin: 20px; + padding-bottom: 100%; + margin-bottom: -100%; + justify-content: inherit; + align-items: inherit; + align-content: inherit; + text-align: inherit; +} + +.header { + width: 100%; + margin: auto; + padding: inherit; + justify-content: inherit; + align-items: inherit; + align-content: inherit; + text-align: inherit; + margin-bottom: 35px; +} + +.hiddencopy { + background: #6a568b; + color: #ffffff; + cursor: pointer; + border-radius: 15px; + margin-left: 10px; + transition: background 0.3s ease; + padding: 10px; + margin-bottom: 10px; + display: none; +} + +strong { + font-size: 18pt; +} + +li.clicked:hover { + border-color: #3d3d3d; + background: #635b72; + margin-bottom: 20px; + border-radius: 15px; +} + +.btn { + direction: ltr; + background: #6a568b; + background-color: #6a568b; + cursor: pointer; + border-radius: 10px; + height: inherit; + width: 15%; + /* margin-left: -10px; */ + transition: background 0.3s ease; + padding: inherit; + margin-bottom: 10px; +} + +form { + margin: auto; + width: 75%; + margin-top: 30px; +} + +input[type="text"], +input[type="file"] { + background-color: #6a568b; + border-color: #332150; + color: #ffffff; + width: 30%; + border-radius: 15px; + padding: auto; + padding-left: 10px; +} + +::placeholder { + color: #ffffff; +} + +.lang { + position: fixed; + float: inline-start; + flex: auto; + width: 100%; +} +#totalus { + background-color: #6a568b; + border-radius: 15px; +} \ No newline at end of file diff --git a/public/script.js b/public/script.js new file mode 100644 index 0000000..fe495a0 --- /dev/null +++ b/public/script.js @@ -0,0 +1,118 @@ +function copyValue(elementId) { + /* Get the text field */ + var copyText = document.getElementById(elementId).innerText; + + /* Create a temporary input field */ + var tempInput = document.createElement("input"); + tempInput.value = copyText; + document.body.appendChild(tempInput); + + /* Select the text field */ + tempInput.select(); + tempInput.setSelectionRange(0, 99999); /* For mobile devices */ + console.log(copyText); + /* Copy the text inside the text field */ + navigator.clipboard.writeText(copyText); + + /* Remove the temporary input field */ + document.body.removeChild(tempInput); + + /* Show a toast message */ + var toast = document.createElement("div"); + toast.innerText = "Copied to clipboard!"; + toast.style.position = "fixed"; + toast.style.bottom = "20px"; + toast.style.left = "50%"; + toast.style.transform = "translateX(-50%)"; + toast.style.background = "#673AB7"; + toast.style.color = "#ffffff"; + toast.style.padding = "10px"; + toast.style.borderRadius = "5px"; + document.body.appendChild(toast); + /* Remove the toast message after 3 seconds */ + setTimeout(function () { + document.body.removeChild(toast); + }, 3000); +} +function showAndHide(elementId,liId){ + let element = document.getElementById(elementId); + let li = document.getElementById(liId); + element.classList.contains('hiddencopy')? element.classList.remove('hiddencopy'):element.classList.add('hiddencopy'); + element.classList.contains('hiddencopy')? li.classList.remove('clicked'):li.classList.add('clicked'); +} +function replaceHebrew(elementId, stff){ + let element = document.getElementById(elementId); + if (stff == 'Administrative staff'){ + element.innerText = "מותר לשימוש בידי צוות מנהלי"; + } + else if(stff == 'Students') + { + element.innerText = "מותר לשימוש בידי סטודנטים"; + } +} +function insertWarning(elementId, before, lang="en"){ + if (elementId == true){ + if(lang == "he"){ + console.log('fuck'); + let elem = document.createElement("div"); + elem.id = "התראה"; + elem.innerText = "הבהרה: המסך החכם של מיקרוסופט ימנע את ריצת התוכנה. יש ללחוץ על פרטים נוספים -> אפשר"; + elem.style.color="#ffffff"; + let nodebefore = document.getElementById(before); + nodebefore.insertBefore(elem, nodebefore.children[7]) + + } + else{ + console.log('fuck'); + let elem = document.createElement("div"); + elem.id = "Warning"; + elem.innerText = "Warning: Has Microsoft SmartScreen blue window of block from running. Press more details -> Allow Running"; + elem.style.color="#ffffff"; + let nodebefore = document.getElementById(before); + nodebefore.insertBefore(elem, nodebefore.children[7]) + + } + } +} +function downloadValue(elementId, filename){ + let text = document.getElementById(elementId).innerText; + var element = document.createElement('a'); + element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); + element.setAttribute('download', filename); + + element.style.display = 'none'; + document.body.appendChild(element); + + element.click(); + + document.body.removeChild(element); + +} +function scriptPackage(rowid, extracommand, line){ + let text = `winget install ${rowid} -s huji`; + console.log(extracommand) + let fub = extracommand.indexOf(' &&') + + console.log(`${rowid}, ${fub}`) + console.log(`${rowid}, ${extracommand.length < 2}`) + try{ + console.log(text) + if(fub == 0){ + text += extracommand; + } + else if((extracommand.length > 2)){ + text = extracommand + " && " + text; + } + else if ((fub == -1)) + { + text = text; + } + } + catch{ + text = text; + } + document.getElementById(`id-${line}`).innerHTML = text; +} +function convertHtml(dt){ + return dt.replace("") +} \ No newline at end of file