appscms-tools-theme 0.9.2 → 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: 4e6a02f9dd1cd64fb97a475bdf11acba6691ef1e61ff07fd1b8dbdb8f5b63113
4
- data.tar.gz: 53cf156ab737311665bf19c851af472e6d42f683fae0e5c1d214a8a41d16199e
3
+ metadata.gz: 33c221c34fd9946100b5a6e912f8030fb955c2a7fe97d205b5cb6060cfb6c804
4
+ data.tar.gz: c85f15b2649fefe0e1645484b889bd1d2c804c398d6c00504ca5aafd27b84a9e
5
5
  SHA512:
6
- metadata.gz: cf1280578c941aa8c6d406edea30fc495e329cc8ca205be22c698b16e2ea7049400bcc3a1ee4caacfde96af103b2e11c0063d33ded9a127fc4c06e0f5110152f
7
- data.tar.gz: f8de7c53c5e2eda8934f5fccda2e54cc1bddcf321c22733d757dc9f59004b308b067c67feedce02e7c6ca34c84fb33cc2e34438dfd82fbee74b9ca3e40acc473
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,6 +52,7 @@ 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
57
  `https://www.googleapis.com/drive/v3/files/${data.docs[0].id}?alt=media`,
56
58
  {
@@ -63,6 +65,7 @@ const pickerCallback = async (data) => {
63
65
  type: data.docs[0].mimeType,
64
66
  }
65
67
  let file = new File([res], data.docs[0].name, metadata)
68
+ closeLoader()
66
69
  getFile(file)
67
70
  }
68
71
  }
@@ -82,9 +85,50 @@ function chooseFromDropbox() {
82
85
  getDropBoxFile(newFile)
83
86
  },
84
87
  cancel: function () {},
85
- linkType: 'direct', //Direct = Download link
86
- multiselect: false, //Allow to select one file
87
- extensions: ['.jpg'], //Allow to choose PDF file only
88
- folderselect: false, //Not allow to select folder
88
+ linkType: 'direct',
89
+ multiselect: false,
90
+ extensions: ['.jpg'],
91
+ folderselect: false,
89
92
  })
90
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.9.2
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-16 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