Skip to content

Commit

Permalink
Add support for Facebook
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Dec 12, 2018
1 parent 2cf3725 commit 29e6da0
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dist/uppload.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/uppload.no-polyfills.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class Uppload {
this.currentPage = this.settings.defaultService || "upload";

// Array of services plugin should have, fallback default
this.settings.services = this.settings.services || ["upload", "camera", "link", "instagram"];
this.settings.services = this.settings.services || ["upload", "camera", "link", "instagram", "facebook"];
// Remove `camera` from the array if browser doesn't support it
if (!webcamAvailable) {
const index = this.settings.services.indexOf("camera");
Expand Down
4 changes: 4 additions & 0 deletions modules/i18n/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ export default {
post_url: "Instagram post URL",
import: "Import from Instagram"
},
facebook: {
post_url: "Facebook public post URL",
import: "Import from Facebook"
},
link: {
post_url: "Link to file",
import: "Import from URL"
Expand Down
1 change: 1 addition & 0 deletions modules/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export default {
upload: `<i class="fas fa-upload fa-fw"></i>`,
import: `<i class="fas fa-link fa-fw"></i>`,
instagram: `<i class="fab fa-instagram fa-fw"></i>`,
facebook: `<i class="fab fa-facebook fa-fw"></i>`,
back: `<i class="fas fa-arrow-left fa-fw"></i>`,
forward: `<i class="fas fa-arrow-right fa-fw"></i>`,
uploading: `<i class="fas fa-spinner fa-4x fa-spin fa-fw"></i><br><br>`,
Expand Down
16 changes: 16 additions & 0 deletions modules/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,22 @@ export default scope => {
init() {
microLinkFetch(scope, "instagram", true);
}
},
facebook: {
icon: icons.facebook,
title: "Facebook",
html: `
<div class="center-middle">
<label>
<div>${i18n.instagram.post_url}</div>
<input id="microLinkInput" type="text" value="https://www.facebook.com/utwente/photos/a.2213200618711319/2213200642044650/" placeholder="https://www.facebook.com/example">
</label>
<button id="microLinkButton" class="primary-button facebook">${i18n.instagram.import + rightArrow}</button>
</div>
`,
init() {
microLinkFetch(scope, "facebook", true);
}
}
};
let navItems = ``;
Expand Down
2 changes: 1 addition & 1 deletion modules/services/microLinkFetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import uploadFile from "../upload";

/**
* Initialization function for Microlink fetch service
* Used for Instagram and others
* Used for Instagram, Facebook and others
* @param {Object} scope - Parent Uppload object
*/
export default (scope, serviceName, isMicroLink = false) => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "uppload",
"version": "0.3.6",
"version": "0.3.7",
"main": "index.js",
"repository": "https://github.com/elninotech/uppload.git",
"author": "Anand Chowdhary (mail@anandchowdhary) with El Niño (https://elnino.tech)",
Expand Down
1 change: 1 addition & 0 deletions styles/services.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@import "./services/instagram";
@import "./services/facebook";
@import "./services/crop";
@import "./services/preview";
@import "./services/camera";
Expand Down
8 changes: 8 additions & 0 deletions styles/services/facebook.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.uppload-modal {
.primary-button.facebook {
background-color: #3b5998;
&:hover {
background-color: #2f4779;
}
}
}

0 comments on commit 29e6da0

Please sign in to comment.