appscms-tools-theme 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_includes/head/index.html +3 -0
- data/assets/js/multiselect.js +156 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4e8235d8d612010b549fd1c186f8a3a383e8d6ad4430cc249083a27255ab545
|
4
|
+
data.tar.gz: 2c995b9e852949c9fa6306b26bd31f73bd81540ed073f24696c0a10f043214db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f11f0b021478dfd2f33cc95ae090ddd90ec9f597cc62b1bc9ebd7f3f33bba70f1bd521a725961fb4bc033842402249d020b3282021a1ba649341d9133b9a667
|
7
|
+
data.tar.gz: 8081cfeed4f99bb471ee4400cb6542ceb00d119b3d7045075ef00d6eab13da59092a76ea3364a5ab4238dfe7ce443494700f1e78ec1c3b1a203f5ecd878fbfe2
|
data/_includes/head/index.html
CHANGED
@@ -34,6 +34,9 @@
|
|
34
34
|
<meta data-rh="true" name="twitter:title" content="{{title}}">
|
35
35
|
<meta data-rh="true" name="twitter:description" content="{{description}}">
|
36
36
|
<meta data-rh="true" name="twitter:image:src" content="{{site.url}}{{favicon}}">
|
37
|
+
{%- if page.noindex -%}
|
38
|
+
<meta name="robots" content="noindex">
|
39
|
+
{%- endif -%}
|
37
40
|
{%- if site.pwa -%}
|
38
41
|
<link rel="manifest" href="/assets/js/manifest.json">
|
39
42
|
{%- endif -%}
|
@@ -0,0 +1,156 @@
|
|
1
|
+
---
|
2
|
+
---
|
3
|
+
|
4
|
+
const addScripts=()=>{
|
5
|
+
const scripts=document.getElementsByTagName('script')
|
6
|
+
const check= Array.from(scripts).find(item=>item.src==='https://www.dropbox.com/static/api/2/dropins.js')
|
7
|
+
if(!check){
|
8
|
+
const dropboxscript = document.createElement('script')
|
9
|
+
dropboxscript.src = 'https://www.dropbox.com/static/api/2/dropins.js'
|
10
|
+
dropboxscript.dataset.appKey = '{{site.dropboxapikey}}'
|
11
|
+
dropboxscript.id='dropboxjs'
|
12
|
+
document.head.append(dropboxscript)
|
13
|
+
}
|
14
|
+
const checkgooglescript= Array.from(scripts).find(item=>item.src==='https://apis.google.com/js/api.js')
|
15
|
+
if(!checkgooglescript){
|
16
|
+
const googlescript = document.createElement('script')
|
17
|
+
googlescript.src = 'https://apis.google.com/js/api.js'
|
18
|
+
document.head.append(googlescript)
|
19
|
+
}
|
20
|
+
}
|
21
|
+
const developerKey = '{{site.developerKey}}'
|
22
|
+
const clientId ='{{site.clientId}}'
|
23
|
+
const appId = '{{site.appId}}'
|
24
|
+
const scope = [
|
25
|
+
'https://www.googleapis.com/auth/drive.file',
|
26
|
+
'https://www.googleapis.com/auth/drive.appdata',
|
27
|
+
]
|
28
|
+
let pickerApiLoaded = false
|
29
|
+
let oauthToken
|
30
|
+
const loadPicker = () => {
|
31
|
+
gapi.load('auth', { callback: onAuthApiLoad })
|
32
|
+
gapi.load('picker', { callback: onPickerApiLoad })
|
33
|
+
}
|
34
|
+
const onAuthApiLoad = () => {
|
35
|
+
window.gapi.auth.authorize(
|
36
|
+
{
|
37
|
+
client_id: clientId,
|
38
|
+
scope: scope,
|
39
|
+
immediate: false,
|
40
|
+
},
|
41
|
+
handleAuthResult
|
42
|
+
)
|
43
|
+
}
|
44
|
+
let onPickerApiLoad = () => {
|
45
|
+
pickerApiLoaded = true
|
46
|
+
createPicker()
|
47
|
+
}
|
48
|
+
const handleAuthResult = (authResult) => {
|
49
|
+
if (authResult && !authResult.error) {
|
50
|
+
oauthToken = authResult.access_token
|
51
|
+
createPicker()
|
52
|
+
}
|
53
|
+
}
|
54
|
+
const createPicker = () => {
|
55
|
+
if (pickerApiLoaded && oauthToken) {
|
56
|
+
const view = new google.picker.View(google.picker.ViewId.DOCS)
|
57
|
+
view.setMimeTypes(mimeTypes)
|
58
|
+
const picker = new google.picker.PickerBuilder()
|
59
|
+
.enableFeature(google.picker.Feature.NAV_HIDDEN)
|
60
|
+
.enableFeature(google.picker.Feature.MULTISELECT_ENABLED)
|
61
|
+
.setAppId(appId)
|
62
|
+
.setOAuthToken(oauthToken)
|
63
|
+
.addView(view)
|
64
|
+
.addView(new google.picker.DocsUploadView())
|
65
|
+
.setDeveloperKey(developerKey)
|
66
|
+
.setCallback(pickerCallback)
|
67
|
+
.build()
|
68
|
+
picker.setVisible(true)
|
69
|
+
}
|
70
|
+
}
|
71
|
+
const pickerCallback = async (data) => {
|
72
|
+
if (data.action == google.picker.Action.PICKED) {
|
73
|
+
showLoader()
|
74
|
+
var filesArray=data.docs.map(async(i)=>{
|
75
|
+
const res= await fetch(`https://www.googleapis.com/drive/v3/files/${i.id}?alt=media`,{
|
76
|
+
headers: {
|
77
|
+
'Authorization': `Bearer ${oauthToken}` }
|
78
|
+
}).then(res=>res.blob())
|
79
|
+
let metadata = {
|
80
|
+
type: i.mimeType
|
81
|
+
}
|
82
|
+
const file = new File([res], i.name, metadata);
|
83
|
+
return file
|
84
|
+
})
|
85
|
+
closeLoader()
|
86
|
+
getFile(filesArray)
|
87
|
+
}
|
88
|
+
}
|
89
|
+
function chooseFromDropbox() {
|
90
|
+
Dropbox.choose({
|
91
|
+
success: async (files) => {
|
92
|
+
if (files.length < 0) {
|
93
|
+
return
|
94
|
+
}
|
95
|
+
var dropboxArray=data.docs.map(async(file)=>{
|
96
|
+
showLoader()
|
97
|
+
const url = new URL(file.link)
|
98
|
+
const response = await fetch(url).then((res) => res.blob())
|
99
|
+
let metadata = {
|
100
|
+
type: response.type,
|
101
|
+
}
|
102
|
+
let newFile = new File([response], file.name, metadata)
|
103
|
+
return newFile
|
104
|
+
})
|
105
|
+
|
106
|
+
closeLoader()
|
107
|
+
getDropBoxFile(dropboxArray)
|
108
|
+
},
|
109
|
+
cancel: function () {},
|
110
|
+
linkType: 'direct',
|
111
|
+
multiselect: true,
|
112
|
+
extensions: [...filemimes],
|
113
|
+
folderselect: false,
|
114
|
+
})
|
115
|
+
}
|
116
|
+
|
117
|
+
const fileupload=(file)=>{
|
118
|
+
gapi.load('auth', {'callback': onAuthLoad});
|
119
|
+
}
|
120
|
+
const onAuthLoad=()=> {
|
121
|
+
window.gapi.auth.authorize(
|
122
|
+
{
|
123
|
+
'client_id': clientId,
|
124
|
+
'scope': scope,
|
125
|
+
'immediate': false
|
126
|
+
},
|
127
|
+
handleAuth);
|
128
|
+
}
|
129
|
+
const handleAuth=(authResult)=> {
|
130
|
+
if (authResult && !authResult.error) {
|
131
|
+
showuploadloading()
|
132
|
+
var formData = new FormData();
|
133
|
+
const fileToUpload = file
|
134
|
+
var metadata = {
|
135
|
+
name: fileToUpload.name,
|
136
|
+
mimeType: fileToUpload.type
|
137
|
+
};
|
138
|
+
formData.append( "metadata", new Blob( [JSON.stringify( metadata )], {type: "application/json"} ));
|
139
|
+
formData.append( "file", fileToUpload );
|
140
|
+
fetch( "https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart", {
|
141
|
+
method: "POST",
|
142
|
+
headers: new Headers({ "Authorization": "Bearer " + gapi.auth.getToken().access_token }),
|
143
|
+
body: formData
|
144
|
+
}).then( function( response ){
|
145
|
+
stopuploadloading()
|
146
|
+
return response.json();
|
147
|
+
|
148
|
+
}).then( function( value ){
|
149
|
+
stopuploadloading()
|
150
|
+
showmessage()
|
151
|
+
});
|
152
|
+
}
|
153
|
+
}
|
154
|
+
|
155
|
+
|
156
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appscms-tools-theme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vivek-appscms
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -295,6 +295,7 @@ files:
|
|
295
295
|
- assets/js/files/en/png.json
|
296
296
|
- assets/js/googledrive.js
|
297
297
|
- assets/js/manifest.json
|
298
|
+
- assets/js/multiselect.js
|
298
299
|
- assets/linkdin.svg
|
299
300
|
- assets/noserverupload.svg
|
300
301
|
- assets/pdf.svg
|