appscms-tools-theme 1.2.8 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +21 -21
  3. data/README.md +50 -50
  4. data/_data/about/en/about.json +16 -16
  5. data/_data/blog/alertbar.yml +3 -3
  6. data/_data/blog/authors.yml +11 -11
  7. data/_data/blog/blog.yml +3 -3
  8. data/_data/blog/nav.json +13 -13
  9. data/_data/blog/share.yml +28 -28
  10. data/_data/contact/en/contact.json +38 -38
  11. data/_data/disclaimer/en/disclaimer.json +37 -37
  12. data/_data/download/en/download.json +35 -35
  13. data/_data/feature/en/compress-pdf.json +191 -191
  14. data/_data/feature/en/split-pdf.json +115 -115
  15. data/_data/feature/hi/compress-pdf.json +81 -81
  16. data/_data/fileinfo/en/fileinfo.json +14 -14
  17. data/_data/files/.gitignore +4 -4
  18. data/_data/files/en/3gp.json +144 -144
  19. data/_data/files/en/acc.json +25 -25
  20. data/_data/files/en/aff.json +65 -65
  21. data/_data/files/en/cr2.json +169 -169
  22. data/_data/files/en/dvd.json +25 -25
  23. data/_data/files/en/mov.json +146 -146
  24. data/_data/files/en/ogg.json +163 -163
  25. data/_data/files/en/vmv.json +47 -47
  26. data/_data/footer/en/data.json +72 -72
  27. data/_data/footer/hi/data.json +68 -68
  28. data/_data/footer/networksites.json +15 -15
  29. data/_data/header/en/data.json +144 -144
  30. data/_data/header/hi/data.json +144 -144
  31. data/_data/home/en/en.json +270 -270
  32. data/_data/home/hi/hi.json +86 -86
  33. data/_data/languagesupport/compress-pdf-langs.json +11 -11
  34. data/_data/languagesupport/index-langs.json +13 -13
  35. data/_data/privacy/en/privacyPolicy.json +265 -265
  36. data/_data/termAndCondition/en/termAndCondition.json +358 -358
  37. data/_includes/Rating/rating.html +91 -91
  38. data/_includes/Rating/structureddata.html +53 -53
  39. data/_includes/Usp/usp.html +84 -84
  40. data/_includes/adsense/adsense.html +7 -7
  41. data/_includes/author_bio.html +15 -15
  42. data/_includes/authors/authors.html +27 -27
  43. data/_includes/cssfile/links.html +13 -13
  44. data/_includes/custom-head.html +41 -41
  45. data/_includes/disqus_comments.html +10 -10
  46. data/_includes/dropdown/langdropdown.html +22 -22
  47. data/_includes/feature.html +35 -35
  48. data/_includes/fileformat/comparisonfiles.html +145 -145
  49. data/_includes/fileformat/fileformatdetail.html +99 -99
  50. data/_includes/fileformat/fileinfoformat.html +90 -90
  51. data/_includes/footer/index.html +100 -100
  52. data/_includes/google-analytics.html +22 -22
  53. data/_includes/head/index.html +159 -159
  54. data/_includes/header/blogHeader.html +28 -28
  55. data/_includes/header/index.html +92 -92
  56. data/_includes/nofiletransfer/nofiletransfer.html +38 -38
  57. data/_includes/paginationBlogPage.html +34 -34
  58. data/_includes/paginationPostPage.html +14 -14
  59. data/_includes/postauthorbio.html +17 -17
  60. data/_includes/postbox.html +29 -29
  61. data/_includes/script.html +15 -15
  62. data/_includes/section/alertbar.html +11 -11
  63. data/_includes/section/count.html +23 -23
  64. data/_includes/section/recent_posts.html +42 -42
  65. data/_includes/section/related_categories_post.html +158 -74
  66. data/_includes/share/socialshare.html +50 -50
  67. data/_layouts/aboutUs.html +22 -22
  68. data/_layouts/blog.html +66 -66
  69. data/_layouts/categories.html +25 -25
  70. data/_layouts/contactUs.html +22 -22
  71. data/_layouts/default.html +1 -1
  72. data/_layouts/disclaimer.html +35 -35
  73. data/_layouts/download.html +243 -243
  74. data/_layouts/feature.html +152 -148
  75. data/_layouts/fileInfo.html +37 -37
  76. data/_layouts/help.html +22 -22
  77. data/_layouts/home.html +153 -147
  78. data/_layouts/page.html +5 -5
  79. data/_layouts/post.html +127 -144
  80. data/_layouts/privacyPolicy.html +400 -400
  81. data/_layouts/termAndCondition.html +401 -401
  82. data/assets/cross.svg +4 -4
  83. data/assets/css/blog.css +491 -485
  84. data/assets/css/tools.css +1805 -1805
  85. data/assets/facebook.svg +4 -4
  86. data/assets/instagram.svg +4 -4
  87. data/assets/js/TopScroll.js +8 -8
  88. data/assets/js/googledrive.js +153 -153
  89. data/assets/js/manifest.json +16 -16
  90. data/assets/js/multiselect.js +155 -155
  91. data/assets/linkdin.svg +4 -4
  92. data/assets/pdf.svg +20 -20
  93. data/assets/secure.svg +43 -43
  94. data/assets/star.svg +4 -4
  95. data/assets/twitter.svg +4 -4
  96. data/assets/youtube.svg +4 -4
  97. metadata +7 -8
  98. data/_includes/section/related_tag_post.html +0 -60
data/assets/facebook.svg CHANGED
@@ -1,5 +1,5 @@
1
- <svg viewBox="0 0 24 24" fill="#000000" xmlns="http://www.w3.org/2000/svg">
2
- <path
3
- d="M18 4.63h-2.397c-1.69 0-2.182.65-2.182 1.897v2.52h4.395l-.584 3.901H13.42V23H8.81V12.948H5V9.047h3.81V6.175C8.81 2.897 11.117 1 14.559 1c1.444 0 2.612.054 3.442.135v3.496z">
4
- </path>
1
+ <svg viewBox="0 0 24 24" fill="#000000" xmlns="http://www.w3.org/2000/svg">
2
+ <path
3
+ d="M18 4.63h-2.397c-1.69 0-2.182.65-2.182 1.897v2.52h4.395l-.584 3.901H13.42V23H8.81V12.948H5V9.047h3.81V6.175C8.81 2.897 11.117 1 14.559 1c1.444 0 2.612.054 3.442.135v3.496z">
4
+ </path>
5
5
  </svg>
data/assets/instagram.svg CHANGED
@@ -1,5 +1,5 @@
1
- <svg viewBox="0 0 24 24" fill="#000000" xmlns="http://www.w3.org/2000/svg">
2
- <path
3
- d="M12 2.982c2.937 0 3.285.011 4.445.064 1.072.05 1.655.228 2.043.379.513.2.88.438 1.264.823.385.385.624.751.823 1.265.15.387.33.97.379 2.042.053 1.16.064 1.508.064 4.445 0 2.937-.011 3.285-.064 4.445-.05 1.072-.228 1.655-.379 2.043-.2.513-.438.88-.823 1.264a3.408 3.408 0 01-1.264.823c-.388.15-.97.33-2.043.379-1.16.053-1.508.064-4.445.064-2.937 0-3.285-.011-4.445-.064-1.072-.049-1.655-.228-2.042-.379-.514-.2-.88-.438-1.265-.823a3.408 3.408 0 01-.823-1.264c-.15-.388-.33-.97-.379-2.043-.053-1.16-.064-1.508-.064-4.445 0-2.937.011-3.285.064-4.445.049-1.072.228-1.655.379-2.042.2-.514.438-.88.823-1.265a3.408 3.408 0 011.265-.823c.387-.15.97-.33 2.042-.379 1.16-.053 1.508-.064 4.445-.064zM12 1c-2.987 0-3.362.013-4.535.066-1.171.054-1.97.24-2.67.512a5.392 5.392 0 00-1.949 1.268 5.392 5.392 0 00-1.269 1.949c-.271.7-.457 1.499-.51 2.67C1.012 8.638 1 9.013 1 12c0 2.988.013 3.362.066 4.535.054 1.171.24 1.97.511 2.67a5.392 5.392 0 001.27 1.949 5.392 5.392 0 001.948 1.268c.7.273 1.499.458 2.67.512C8.638 22.987 9.013 23 12 23s3.362-.013 4.535-.066c1.171-.054 1.97-.24 2.67-.512a5.391 5.391 0 001.949-1.268 5.391 5.391 0 001.268-1.948c.272-.7.458-1.5.512-2.67.053-1.174.066-1.549.066-4.536 0-2.987-.013-3.362-.066-4.535-.054-1.171-.24-1.97-.512-2.67a5.39 5.39 0 00-1.268-1.949 5.391 5.391 0 00-1.949-1.268c-.7-.272-1.499-.458-2.67-.512C15.362 1.013 14.987 1 12 1zm0 5.351a5.649 5.649 0 100 11.298A5.649 5.649 0 0012 6.35zm0 9.316a3.667 3.667 0 110-7.334 3.667 3.667 0 010 7.334zm7.192-9.539a1.32 1.32 0 11-2.64 0 1.32 1.32 0 012.64 0z">
4
- </path>
1
+ <svg viewBox="0 0 24 24" fill="#000000" xmlns="http://www.w3.org/2000/svg">
2
+ <path
3
+ d="M12 2.982c2.937 0 3.285.011 4.445.064 1.072.05 1.655.228 2.043.379.513.2.88.438 1.264.823.385.385.624.751.823 1.265.15.387.33.97.379 2.042.053 1.16.064 1.508.064 4.445 0 2.937-.011 3.285-.064 4.445-.05 1.072-.228 1.655-.379 2.043-.2.513-.438.88-.823 1.264a3.408 3.408 0 01-1.264.823c-.388.15-.97.33-2.043.379-1.16.053-1.508.064-4.445.064-2.937 0-3.285-.011-4.445-.064-1.072-.049-1.655-.228-2.042-.379-.514-.2-.88-.438-1.265-.823a3.408 3.408 0 01-.823-1.264c-.15-.388-.33-.97-.379-2.043-.053-1.16-.064-1.508-.064-4.445 0-2.937.011-3.285.064-4.445.049-1.072.228-1.655.379-2.042.2-.514.438-.88.823-1.265a3.408 3.408 0 011.265-.823c.387-.15.97-.33 2.042-.379 1.16-.053 1.508-.064 4.445-.064zM12 1c-2.987 0-3.362.013-4.535.066-1.171.054-1.97.24-2.67.512a5.392 5.392 0 00-1.949 1.268 5.392 5.392 0 00-1.269 1.949c-.271.7-.457 1.499-.51 2.67C1.012 8.638 1 9.013 1 12c0 2.988.013 3.362.066 4.535.054 1.171.24 1.97.511 2.67a5.392 5.392 0 001.27 1.949 5.392 5.392 0 001.948 1.268c.7.273 1.499.458 2.67.512C8.638 22.987 9.013 23 12 23s3.362-.013 4.535-.066c1.171-.054 1.97-.24 2.67-.512a5.391 5.391 0 001.949-1.268 5.391 5.391 0 001.268-1.948c.272-.7.458-1.5.512-2.67.053-1.174.066-1.549.066-4.536 0-2.987-.013-3.362-.066-4.535-.054-1.171-.24-1.97-.512-2.67a5.39 5.39 0 00-1.268-1.949 5.391 5.391 0 00-1.949-1.268c-.7-.272-1.499-.458-2.67-.512C15.362 1.013 14.987 1 12 1zm0 5.351a5.649 5.649 0 100 11.298A5.649 5.649 0 0012 6.35zm0 9.316a3.667 3.667 0 110-7.334 3.667 3.667 0 010 7.334zm7.192-9.539a1.32 1.32 0 11-2.64 0 1.32 1.32 0 012.64 0z">
4
+ </path>
5
5
  </svg>
@@ -1,8 +1,8 @@
1
- const alertbar = document.querySelector('.alertbar')
2
- window.addEventListener('scroll', () => {
3
- if (pageYOffset > 200) {
4
- alertbar.style.display = 'block'
5
- } else {
6
- alertbar.style.display = 'none'
7
- }
8
- })
1
+ const alertbar = document.querySelector('.alertbar')
2
+ window.addEventListener('scroll', () => {
3
+ if (pageYOffset > 200) {
4
+ alertbar.style.display = 'block'
5
+ } else {
6
+ alertbar.style.display = 'none'
7
+ }
8
+ })
@@ -1,154 +1,154 @@
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
- const res = await fetch(
75
- `https://www.googleapis.com/drive/v3/files/${data.docs[0].id}?alt=media`,
76
- {
77
- headers: {
78
- Authorization: `Bearer ${oauthToken}`,
79
- },
80
- }
81
- ).then((res) => res.blob())
82
- let metadata = {
83
- type: data.docs[0].mimeType,
84
- }
85
- let file = new File([res], data.docs[0].name, metadata)
86
- closeLoader()
87
- getFile(file)
88
- }
89
- }
90
- function chooseFromDropbox() {
91
- Dropbox.choose({
92
- success: async (files) => {
93
- if (files.length < 0) {
94
- return
95
- }
96
- var file = files[0]
97
- const url = new URL(file.link)
98
- showLoader()
99
- const response = await fetch(url).then((res) => res.blob())
100
- let metadata = {
101
- type: response.type,
102
- }
103
- let newFile = new File([response], file.name, metadata)
104
- closeLoader()
105
- getDropBoxFile(newFile)
106
- },
107
- cancel: function () {},
108
- linkType: 'direct',
109
- multiselect: false,
110
- extensions: [...filemimes],
111
- folderselect: false,
112
- })
113
- }
114
-
115
- const fileupload=(file)=>{
116
- gapi.load('auth', {'callback': onAuthLoad});
117
- }
118
- const onAuthLoad=()=> {
119
- window.gapi.auth.authorize(
120
- {
121
- 'client_id': clientId,
122
- 'scope': scope,
123
- 'immediate': false
124
- },
125
- handleAuth);
126
- }
127
- const handleAuth=(authResult)=> {
128
- if (authResult && !authResult.error) {
129
- showuploadloading()
130
- var formData = new FormData();
131
- const fileToUpload = file
132
- var metadata = {
133
- name: fileToUpload.name,
134
- mimeType: fileToUpload.type
135
- };
136
- formData.append( "metadata", new Blob( [JSON.stringify( metadata )], {type: "application/json"} ));
137
- formData.append( "file", fileToUpload );
138
- fetch( "https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart", {
139
- method: "POST",
140
- headers: new Headers({ "Authorization": "Bearer " + gapi.auth.getToken().access_token }),
141
- body: formData
142
- }).then( function( response ){
143
- stopuploadloading()
144
- return response.json();
145
-
146
- }).then( function( value ){
147
- stopuploadloading()
148
- showmessage()
149
- });
150
- }
151
- }
152
-
153
-
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
+ const res = await fetch(
75
+ `https://www.googleapis.com/drive/v3/files/${data.docs[0].id}?alt=media`,
76
+ {
77
+ headers: {
78
+ Authorization: `Bearer ${oauthToken}`,
79
+ },
80
+ }
81
+ ).then((res) => res.blob())
82
+ let metadata = {
83
+ type: data.docs[0].mimeType,
84
+ }
85
+ let file = new File([res], data.docs[0].name, metadata)
86
+ closeLoader()
87
+ getFile(file)
88
+ }
89
+ }
90
+ function chooseFromDropbox() {
91
+ Dropbox.choose({
92
+ success: async (files) => {
93
+ if (files.length < 0) {
94
+ return
95
+ }
96
+ var file = files[0]
97
+ const url = new URL(file.link)
98
+ showLoader()
99
+ const response = await fetch(url).then((res) => res.blob())
100
+ let metadata = {
101
+ type: response.type,
102
+ }
103
+ let newFile = new File([response], file.name, metadata)
104
+ closeLoader()
105
+ getDropBoxFile(newFile)
106
+ },
107
+ cancel: function () {},
108
+ linkType: 'direct',
109
+ multiselect: false,
110
+ extensions: [...filemimes],
111
+ folderselect: false,
112
+ })
113
+ }
114
+
115
+ const fileupload=(file)=>{
116
+ gapi.load('auth', {'callback': onAuthLoad});
117
+ }
118
+ const onAuthLoad=()=> {
119
+ window.gapi.auth.authorize(
120
+ {
121
+ 'client_id': clientId,
122
+ 'scope': scope,
123
+ 'immediate': false
124
+ },
125
+ handleAuth);
126
+ }
127
+ const handleAuth=(authResult)=> {
128
+ if (authResult && !authResult.error) {
129
+ showuploadloading()
130
+ var formData = new FormData();
131
+ const fileToUpload = file
132
+ var metadata = {
133
+ name: fileToUpload.name,
134
+ mimeType: fileToUpload.type
135
+ };
136
+ formData.append( "metadata", new Blob( [JSON.stringify( metadata )], {type: "application/json"} ));
137
+ formData.append( "file", fileToUpload );
138
+ fetch( "https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart", {
139
+ method: "POST",
140
+ headers: new Headers({ "Authorization": "Bearer " + gapi.auth.getToken().access_token }),
141
+ body: formData
142
+ }).then( function( response ){
143
+ stopuploadloading()
144
+ return response.json();
145
+
146
+ }).then( function( value ){
147
+ stopuploadloading()
148
+ showmessage()
149
+ });
150
+ }
151
+ }
152
+
153
+
154
154
 
@@ -1,17 +1,17 @@
1
- ---
2
- ---
3
- {
4
- "short_name": "{{site.name}}",
5
- "name": "{{site.name}}",
6
- "icons": [
7
- {
8
- "src": "{{site.pwalogo}}",
9
- "type": "image/png",
10
- "sizes": "1024x1024"
11
- }
12
- ],
13
- "start_url": "/",
14
- "display": "standalone",
15
- "theme_color": "#000000",
16
- "background_color": "#ffffff"
1
+ ---
2
+ ---
3
+ {
4
+ "short_name": "{{site.name}}",
5
+ "name": "{{site.name}}",
6
+ "icons": [
7
+ {
8
+ "src": "{{site.pwalogo}}",
9
+ "type": "image/png",
10
+ "sizes": "1024x1024"
11
+ }
12
+ ],
13
+ "start_url": "/",
14
+ "display": "standalone",
15
+ "theme_color": "#000000",
16
+ "background_color": "#ffffff"
17
17
  }
@@ -1,156 +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=files.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
-
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=files.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
156