appscms-tools-theme 0.8.8 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1f1c4ec51b98d03064f1762f57f28a6148b23eddb24709dfe16c5198d646fe9
4
- data.tar.gz: 979740aacf21e9ec8e5e7d87558d3fbb60bb065610fbe744484f533a1af177d5
3
+ metadata.gz: 33c221c34fd9946100b5a6e912f8030fb955c2a7fe97d205b5cb6060cfb6c804
4
+ data.tar.gz: c85f15b2649fefe0e1645484b889bd1d2c804c398d6c00504ca5aafd27b84a9e
5
5
  SHA512:
6
- metadata.gz: fc954fca8a3a6baa51ccba9e122a7d7687f7df191a18800fd8442199d29f9eaf81167cdfc1d8bebac3289af6ffcd0057d090f861950356689c0fc59ed2555e53
7
- data.tar.gz: e43704840a72228abf13c3c156648bb99bb0d2e3f5b5ddee02d4c7360c416b171c938b3763c16831a6151844374be0c5b1766f487be902c267d921d8df552ef9
6
+ metadata.gz: 305a03e907b6ad3d1362c341dc3d1c6ade6c74947d922f5768e62bca624b1528a34e0055937f6a44f73d8bc1b62fd85140fac8bd9da488a0eda26698e6962a62
7
+ data.tar.gz: 592f0a11a2aec4624bd4b4c7c2cd4c62031418a5737189e4455c1dde7ba8dab0b36095b3dc2a30e7fe3121a18b13b13ae717b91a9c294071c90e3666e9236c4e
@@ -41,9 +41,10 @@ try {
41
41
  } catch (error) {
42
42
  }
43
43
  }
44
- document.addEventListener("DOMContentLoaded", function(event) {
44
+
45
+ window.addEventListener("load",()=>{
45
46
  fetchShareCount()
46
- });
47
-
47
+
48
+ });
48
49
  </script>
49
50
 
@@ -1,7 +1,8 @@
1
- const developerKey = 'AIzaSyDr30lsukCywJXYYPSn5prs6FwvmgqQkxg'
2
- const clientId =
3
- '762288849553-blsuhbaecksbh4tsi5blkhvp2hq9beo5.apps.googleusercontent.com'
4
- const appId = '762288849553'
1
+ ---
2
+ ---
3
+ const developerKey = '{{site.developerKey}}'
4
+ const clientId ='{{site.clientId}}'
5
+ const appId = '{{site.appId}}'
5
6
  const scope = [
6
7
  'https://www.googleapis.com/auth/drive.file',
7
8
  'https://www.googleapis.com/auth/drive.appdata',
@@ -35,7 +36,7 @@ const handleAuthResult = (authResult) => {
35
36
  const createPicker = () => {
36
37
  if (pickerApiLoaded && oauthToken) {
37
38
  const view = new google.picker.View(google.picker.ViewId.DOCS)
38
- view.setMimeTypes('application/pdf,image/jpeg,image/png,image/jpg')
39
+ view.setMimeTypes(mimeTypes)
39
40
  const picker = new google.picker.PickerBuilder()
40
41
  .enableFeature(google.picker.Feature.NAV_HIDDEN)
41
42
  .enableFeature(google.picker.Feature.MULTISELECT_ENABLED)
@@ -51,20 +52,83 @@ const createPicker = () => {
51
52
  }
52
53
  const pickerCallback = async (data) => {
53
54
  if (data.action == google.picker.Action.PICKED) {
55
+ showLoader()
54
56
  const res = await fetch(
55
- `https://www.googleapis.com/drive/v3/files/${data.docs[0].id}?key=${developerKey}`,
57
+ `https://www.googleapis.com/drive/v3/files/${data.docs[0].id}?alt=media`,
56
58
  {
57
59
  headers: {
58
60
  Authorization: `Bearer ${oauthToken}`,
59
- Accept: 'application/json',
60
61
  },
61
62
  }
62
- ).then((res) => res.json())
63
- const response = await fetch(res.downloadUrl).then((res) => res.blob())
63
+ ).then((res) => res.blob())
64
64
  let metadata = {
65
65
  type: data.docs[0].mimeType,
66
66
  }
67
- let file = new File([response], data.docs[0].name, metadata)
67
+ let file = new File([res], data.docs[0].name, metadata)
68
+ closeLoader()
68
69
  getFile(file)
69
70
  }
70
71
  }
72
+ function chooseFromDropbox() {
73
+ Dropbox.choose({
74
+ success: async (files) => {
75
+ if (files.length < 0) {
76
+ return
77
+ }
78
+ var file = files[0]
79
+ const url = new URL(file.link)
80
+ const response = await fetch(url).then((res) => res.blob())
81
+ let metadata = {
82
+ type: response.type,
83
+ }
84
+ let newFile = new File([response], file.name, metadata)
85
+ getDropBoxFile(newFile)
86
+ },
87
+ cancel: function () {},
88
+ linkType: 'direct',
89
+ multiselect: false,
90
+ extensions: ['.jpg'],
91
+ folderselect: false,
92
+ })
93
+ }
94
+
95
+ const fileupload=(file)=>{
96
+ gapi.load('auth', {'callback': onAuthLoad});
97
+ }
98
+ const onAuthLoad=()=> {
99
+ window.gapi.auth.authorize(
100
+ {
101
+ 'client_id': clientId,
102
+ 'scope': scope,
103
+ 'immediate': false
104
+ },
105
+ handleAuth);
106
+ }
107
+ const handleAuth=(authResult)=> {
108
+ if (authResult && !authResult.error) {
109
+ showuploadloading()
110
+ var formData = new FormData();
111
+ const fileToUpload = file
112
+ var metadata = {
113
+ name: fileToUpload.name,
114
+ mimeType: fileToUpload.type
115
+ };
116
+ formData.append( "metadata", new Blob( [JSON.stringify( metadata )], {type: "application/json"} ));
117
+ formData.append( "file", fileToUpload );
118
+ fetch( "https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart", {
119
+ method: "POST",
120
+ headers: new Headers({ "Authorization": "Bearer " + gapi.auth.getToken().access_token }),
121
+ body: formData
122
+ }).then( function( response ){
123
+ stopuploadloading()
124
+ return response.json();
125
+
126
+ }).then( function( value ){
127
+ stopuploadloading()
128
+ showmessage()
129
+ });
130
+ }
131
+ }
132
+
133
+
134
+
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: 0.8.8
4
+ version: 0.9.3
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-06-15 00:00:00.000000000 Z
11
+ date: 2021-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll