appscms-tools-theme 0.9.0 → 0.9.5

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: ca15a7c361170971239f1c88fad5544b70c52e58ef11445cd31f7ad0c52bbcc3
4
- data.tar.gz: 42bfb2d4b4d0072ed83653acdc974f80b6f962e169879cb3088dc0436d4d5bee
3
+ metadata.gz: 036b7a24001add163d19a0503ef4de9c2bd71339762b9e393d93897b11b82d2a
4
+ data.tar.gz: 7914a96bb2f2ed3d4f432e407246fd43e6b9916a8fc828baacd3c91038443939
5
5
  SHA512:
6
- metadata.gz: b93720825ec1e547f3da872cfe38fc681a2263edde7142986c41448358564a839a7e7aabed45abb3fd008c975bc22c773f68fff68f3f28c712dce8f08cdbd851
7
- data.tar.gz: d65782fc14252367d1d8771c5d58192b63a42d7f313d0a5904227742c0b3b7d97cc145553b3d483632f10aed56757232e910e5d22581c478360fb0d80c08d4ca
6
+ metadata.gz: b06d6ff126097a8bd827fc5a6f142b0af8d10a0f7a2dbd4ca10f9170b5fbe4a0e426b45c94ec10abf45b40d1bf7243b6cdb6a362cb39a81a8472e3afeab20555
7
+ data.tar.gz: 69359ae79aeaeeb0c6d769a9b3901c4800bfb7c4fdebd107943dfef9aa8f3768bfebc212d7be665d0c4da5e79569bf83433006c28c679cbb7db19615b5414349
@@ -123,7 +123,6 @@
123
123
  {%- if page.tool -%}
124
124
  {%- include Rating/structureddata.html -%}
125
125
  {%- endif -%}
126
- <!-- GA -->
127
126
  {%- include google-analytics.html -%}
128
127
  {%- if site.pwa -%}
129
128
  <script>
@@ -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,26 @@
1
- const developerKey = 'AIzaSyDr30lsukCywJXYYPSn5prs6FwvmgqQkxg'
2
- const clientId =
3
- '762288849553-blsuhbaecksbh4tsi5blkhvp2hq9beo5.apps.googleusercontent.com'
4
- const appId = '762288849553'
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 = '{{site.googleapisrc}}'
18
+ document.head.append(googlescript)
19
+ }
20
+ }
21
+ const developerKey = '{{site.developerKey}}'
22
+ const clientId ='{{site.clientId}}'
23
+ const appId = '{{site.appId}}'
5
24
  const scope = [
6
25
  'https://www.googleapis.com/auth/drive.file',
7
26
  'https://www.googleapis.com/auth/drive.appdata',
@@ -35,7 +54,7 @@ const handleAuthResult = (authResult) => {
35
54
  const createPicker = () => {
36
55
  if (pickerApiLoaded && oauthToken) {
37
56
  const view = new google.picker.View(google.picker.ViewId.DOCS)
38
- view.setMimeTypes('application/pdf,image/jpeg,image/png,image/jpg')
57
+ view.setMimeTypes(mimeTypes)
39
58
  const picker = new google.picker.PickerBuilder()
40
59
  .enableFeature(google.picker.Feature.NAV_HIDDEN)
41
60
  .enableFeature(google.picker.Feature.MULTISELECT_ENABLED)
@@ -51,6 +70,7 @@ const createPicker = () => {
51
70
  }
52
71
  const pickerCallback = async (data) => {
53
72
  if (data.action == google.picker.Action.PICKED) {
73
+ showLoader()
54
74
  const res = await fetch(
55
75
  `https://www.googleapis.com/drive/v3/files/${data.docs[0].id}?alt=media`,
56
76
  {
@@ -63,23 +83,70 @@ const pickerCallback = async (data) => {
63
83
  type: data.docs[0].mimeType,
64
84
  }
65
85
  let file = new File([res], data.docs[0].name, metadata)
86
+ closeLoader()
66
87
  getFile(file)
67
88
  }
68
89
  }
69
90
  function chooseFromDropbox() {
70
91
  Dropbox.choose({
71
- success: function (files) {
92
+ success: async (files) => {
72
93
  if (files.length < 0) {
73
94
  return
74
95
  }
75
96
  var file = files[0]
76
- alert('Download Link : ' + file.link + '\nFile Name : ' + file.name)
77
- console.log(file.link)
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
+ getDropBoxFile(newFile)
78
104
  },
79
105
  cancel: function () {},
80
- linkType: 'direct',
81
- multiselect: false,
82
- extensions: ['.jpg'],
83
- folderselect: false,
106
+ linkType: 'direct',
107
+ multiselect: false,
108
+ extensions: ['.jpg'],
109
+ folderselect: false,
84
110
  })
85
111
  }
112
+
113
+ const fileupload=(file)=>{
114
+ gapi.load('auth', {'callback': onAuthLoad});
115
+ }
116
+ const onAuthLoad=()=> {
117
+ window.gapi.auth.authorize(
118
+ {
119
+ 'client_id': clientId,
120
+ 'scope': scope,
121
+ 'immediate': false
122
+ },
123
+ handleAuth);
124
+ }
125
+ const handleAuth=(authResult)=> {
126
+ if (authResult && !authResult.error) {
127
+ showuploadloading()
128
+ var formData = new FormData();
129
+ const fileToUpload = file
130
+ var metadata = {
131
+ name: fileToUpload.name,
132
+ mimeType: fileToUpload.type
133
+ };
134
+ formData.append( "metadata", new Blob( [JSON.stringify( metadata )], {type: "application/json"} ));
135
+ formData.append( "file", fileToUpload );
136
+ fetch( "https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart", {
137
+ method: "POST",
138
+ headers: new Headers({ "Authorization": "Bearer " + gapi.auth.getToken().access_token }),
139
+ body: formData
140
+ }).then( function( response ){
141
+ stopuploadloading()
142
+ return response.json();
143
+
144
+ }).then( function( value ){
145
+ stopuploadloading()
146
+ showmessage()
147
+ });
148
+ }
149
+ }
150
+
151
+
152
+
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.0
4
+ version: 0.9.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-06-16 00:00:00.000000000 Z
11
+ date: 2021-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll