add doubletap to like

This commit is contained in:
talon 2019-05-03 15:11:29 -04:00
parent da683569ae
commit 8645387657
6 changed files with 192 additions and 33 deletions

174
package-lock.json generated
View file

@ -1625,6 +1625,21 @@
"resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz",
"integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8="
}, },
"browser-resolve": {
"version": "1.11.3",
"resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.3.tgz",
"integrity": "sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ==",
"requires": {
"resolve": "1.1.7"
},
"dependencies": {
"resolve": {
"version": "1.1.7",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz",
"integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs="
}
}
},
"browserify-aes": { "browserify-aes": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", "resolved": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz",
@ -3317,6 +3332,11 @@
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz",
"integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=" "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM="
}, },
"estree-walker": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.2.1.tgz",
"integrity": "sha1-va/oCVOD2EFNXcLs9MkXO225QS4="
},
"esutils": { "esutils": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz",
@ -3914,7 +3934,8 @@
}, },
"ansi-regex": { "ansi-regex": {
"version": "2.1.1", "version": "2.1.1",
"bundled": true "bundled": true,
"optional": true
}, },
"aproba": { "aproba": {
"version": "1.2.0", "version": "1.2.0",
@ -3932,11 +3953,13 @@
}, },
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true "bundled": true,
"optional": true
}, },
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
@ -3949,15 +3972,18 @@
}, },
"code-point-at": { "code-point-at": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true "bundled": true,
"optional": true
}, },
"concat-map": { "concat-map": {
"version": "0.0.1", "version": "0.0.1",
"bundled": true "bundled": true,
"optional": true
}, },
"console-control-strings": { "console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true "bundled": true,
"optional": true
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
@ -4060,7 +4086,8 @@
}, },
"inherits": { "inherits": {
"version": "2.0.3", "version": "2.0.3",
"bundled": true "bundled": true,
"optional": true
}, },
"ini": { "ini": {
"version": "1.3.5", "version": "1.3.5",
@ -4070,6 +4097,7 @@
"is-fullwidth-code-point": { "is-fullwidth-code-point": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"number-is-nan": "^1.0.0" "number-is-nan": "^1.0.0"
} }
@ -4082,17 +4110,20 @@
"minimatch": { "minimatch": {
"version": "3.0.4", "version": "3.0.4",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
}, },
"minimist": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"bundled": true "bundled": true,
"optional": true
}, },
"minipass": { "minipass": {
"version": "2.3.5", "version": "2.3.5",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"safe-buffer": "^5.1.2", "safe-buffer": "^5.1.2",
"yallist": "^3.0.0" "yallist": "^3.0.0"
@ -4109,6 +4140,7 @@
"mkdirp": { "mkdirp": {
"version": "0.5.1", "version": "0.5.1",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "0.0.8"
} }
@ -4181,7 +4213,8 @@
}, },
"number-is-nan": { "number-is-nan": {
"version": "1.0.1", "version": "1.0.1",
"bundled": true "bundled": true,
"optional": true
}, },
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
@ -4191,6 +4224,7 @@
"once": { "once": {
"version": "1.4.0", "version": "1.4.0",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1"
} }
@ -4266,7 +4300,8 @@
}, },
"safe-buffer": { "safe-buffer": {
"version": "5.1.2", "version": "5.1.2",
"bundled": true "bundled": true,
"optional": true
}, },
"safer-buffer": { "safer-buffer": {
"version": "2.1.2", "version": "2.1.2",
@ -4296,6 +4331,7 @@
"string-width": { "string-width": {
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0", "is-fullwidth-code-point": "^1.0.0",
@ -4313,6 +4349,7 @@
"strip-ansi": { "strip-ansi": {
"version": "3.0.1", "version": "3.0.1",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"ansi-regex": "^2.0.0" "ansi-regex": "^2.0.0"
} }
@ -4351,11 +4388,13 @@
}, },
"wrappy": { "wrappy": {
"version": "1.0.2", "version": "1.0.2",
"bundled": true "bundled": true,
"optional": true
}, },
"yallist": { "yallist": {
"version": "3.0.3", "version": "3.0.3",
"bundled": true "bundled": true,
"optional": true
} }
} }
}, },
@ -4557,6 +4596,11 @@
"resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz",
"integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=" "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE="
}, },
"hammerjs": {
"version": "2.0.8",
"resolved": "https://registry.npmjs.org/hammerjs/-/hammerjs-2.0.8.tgz",
"integrity": "sha1-BO93hiz/K7edMPdpIJWTAiK/YPE="
},
"handle-thing": { "handle-thing": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-2.0.0.tgz", "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-2.0.0.tgz",
@ -5745,6 +5789,14 @@
"yallist": "^2.1.2" "yallist": "^2.1.2"
} }
}, },
"magic-string": {
"version": "0.16.0",
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.16.0.tgz",
"integrity": "sha1-lw67DacZMwEoX7GqZQ85vdgetFo=",
"requires": {
"vlq": "^0.2.1"
}
},
"make-dir": { "make-dir": {
"version": "1.3.0", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz",
@ -8021,6 +8073,90 @@
"inherits": "^2.0.1" "inherits": "^2.0.1"
} }
}, },
"rollup-plugin-cleanup": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/rollup-plugin-cleanup/-/rollup-plugin-cleanup-0.1.4.tgz",
"integrity": "sha1-n+06tDAJiKiC1j3jMh5BDNr8YzE=",
"requires": {
"acorn": "^3.3.0",
"magic-string": "^0.16.0",
"rollup-pluginutils": "^1.5.2"
},
"dependencies": {
"acorn": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz",
"integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo="
}
}
},
"rollup-plugin-commonjs": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/rollup-plugin-commonjs/-/rollup-plugin-commonjs-7.1.0.tgz",
"integrity": "sha1-w6dywuSl+hNQf1xXi2bME7DLink=",
"requires": {
"acorn": "^4.0.1",
"estree-walker": "^0.3.0",
"magic-string": "^0.19.0",
"resolve": "^1.1.7",
"rollup-pluginutils": "^2.0.1"
},
"dependencies": {
"acorn": {
"version": "4.0.13",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz",
"integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c="
},
"estree-walker": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.3.1.tgz",
"integrity": "sha1-5rGlHPcpJSTnI3wxLl/mZgwc4ao="
},
"magic-string": {
"version": "0.19.1",
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.19.1.tgz",
"integrity": "sha1-FNdoATyvLsj96hakmvgvw3fnUgE=",
"requires": {
"vlq": "^0.2.1"
}
},
"rollup-pluginutils": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.6.0.tgz",
"integrity": "sha512-aGQwspEF8oPKvg37u3p7h0cYNwmJR1sCBMZGZ5b9qy8HGtETknqjzcxrDRrcAnJNXN18lBH4Q9vZYth/p4n8jQ==",
"requires": {
"estree-walker": "^0.6.0",
"micromatch": "^3.1.10"
},
"dependencies": {
"estree-walker": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.0.tgz",
"integrity": "sha512-peq1RfVAVzr3PU/jL31RaOjUKLoZJpObQWJJ+LgfcxDUifyLZ1RjPQZTl0pzj2uJ45b7A7XpyppXvxdEqzo4rw=="
}
}
}
}
},
"rollup-plugin-node-resolve": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-2.1.1.tgz",
"integrity": "sha1-y7eDsNFbAnlNWJFTULLw2QK43cg=",
"requires": {
"browser-resolve": "^1.11.0",
"builtin-modules": "^1.1.0",
"resolve": "^1.1.6"
}
},
"rollup-pluginutils": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz",
"integrity": "sha1-HhVud4+UtyVb+hs9AXi+j1xVJAg=",
"requires": {
"estree-walker": "^0.2.1",
"minimatch": "^3.0.2"
}
},
"run-async": { "run-async": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz",
@ -9532,6 +9668,11 @@
"extsprintf": "^1.2.0" "extsprintf": "^1.2.0"
} }
}, },
"vlq": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/vlq/-/vlq-0.2.3.tgz",
"integrity": "sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow=="
},
"vm-browserify": { "vm-browserify": {
"version": "0.0.4", "version": "0.0.4",
"resolved": "http://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", "resolved": "http://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz",
@ -9618,6 +9759,17 @@
"date-fns": "^1.29.0" "date-fns": "^1.29.0"
} }
}, },
"vue-touch": {
"version": "2.0.0-beta.4",
"resolved": "https://registry.npmjs.org/vue-touch/-/vue-touch-2.0.0-beta.4.tgz",
"integrity": "sha1-Alml+/if7RLV5deJ//uZuHSuBQE=",
"requires": {
"hammerjs": "^2.0.8",
"rollup-plugin-cleanup": "^0.1.4",
"rollup-plugin-commonjs": "^7.0.0",
"rollup-plugin-node-resolve": "^2.0.0"
}
},
"watchpack": { "watchpack": {
"version": "1.6.0", "version": "1.6.0",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz",

View file

@ -45,7 +45,8 @@
"vue-content-loader": "^0.2.1", "vue-content-loader": "^0.2.1",
"vue-infinite-loading": "^2.4.3", "vue-infinite-loading": "^2.4.3",
"vue-loading-overlay": "^3.1.1", "vue-loading-overlay": "^3.1.1",
"vue-timeago": "^5.0.0" "vue-timeago": "^5.0.0",
"vue-touch": "^2.0.0-beta.4"
}, },
"collective": { "collective": {
"type": "opencollective", "type": "opencollective",

View file

@ -7,6 +7,12 @@ window.axios = require('axios');
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
require('readmore-js'); require('readmore-js');
Vue.use(require("vue-touch"), {name: "v-touch"})
VueTouch.registerCustomEvent('doubletap', {
type: 'tap',
taps: 2
})
let token = document.head.querySelector('meta[name="csrf-token"]'); let token = document.head.querySelector('meta[name="csrf-token"]');
if (token) { if (token) {
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content; window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;

View file

@ -212,7 +212,7 @@
<div v-if="profileLayout == 'moment'" class="momentui"> <div v-if="profileLayout == 'moment'" class="momentui">
<div class="bg-dark mt-md-n4"> <div class="bg-dark mt-md-n4">
<div class="container"> <div class="container", v-on:doubletap="likeStatus(status, $event)">
<div class="postPresenterContainer d-none d-flex justify-content-center align-items-center bg-dark"> <div class="postPresenterContainer d-none d-flex justify-content-center align-items-center bg-dark">
<div v-if="status.pf_type === 'photo'" class="w-100"> <div v-if="status.pf_type === 'photo'" class="w-100">
<photo-presenter :status="status" v-on:lightbox="lightbox"></photo-presenter> <photo-presenter :status="status" v-on:lightbox="lightbox"></photo-presenter>
@ -345,8 +345,8 @@
</infinite-loading> </infinite-loading>
</div> </div>
</b-modal> </b-modal>
<b-modal <b-modal
id="lightbox" id="lightbox"
ref="lightboxModal" ref="lightboxModal"
:hide-header="true" :hide-header="true"
:hide-footer="true" :hide-footer="true"
@ -437,11 +437,11 @@ pixelfed.postComponent = {};
export default { export default {
props: [ props: [
'status-id', 'status-id',
'status-username', 'status-username',
'status-template', 'status-template',
'status-url', 'status-url',
'status-profile-url', 'status-profile-url',
'status-avatar', 'status-avatar',
'status-profile-id', 'status-profile-id',
'profile-layout' 'profile-layout'
@ -732,7 +732,7 @@ export default {
postReply() { postReply() {
let self = this; let self = this;
if(this.replyText.length == 0 || if(this.replyText.length == 0 ||
this.replyText.trim() == '@'+this.status.account.acct) { this.replyText.trim() == '@'+this.status.account.acct) {
self.replyText = null; self.replyText = null;
$('textarea[name="comment"]').blur(); $('textarea[name="comment"]').blur();
@ -769,7 +769,7 @@ export default {
l(e) { l(e) {
let len = e.length; let len = e.length;
if(len < 10) { return e; } if(len < 10) { return e; }
return e.substr(0, 10)+'...'; return e.substr(0, 10)+'...';
}, },
@ -842,7 +842,7 @@ export default {
if($('body').hasClass('loggedIn') == false) { if($('body').hasClass('loggedIn') == false) {
return; return;
} }
axios.post('/i/like', { axios.post('/i/like', {
item: status.id item: status.id
}).then(res => { }).then(res => {
@ -900,7 +900,7 @@ export default {
this.replyText += em; this.replyText += em;
$('textarea[name="comment"]').focus(); $('textarea[name="comment"]').focus();
} }
}, },
toggleCommentVisibility() { toggleCommentVisibility() {
if(this.ownerOrAdmin() == false) { if(this.ownerOrAdmin() == false) {

View file

@ -23,7 +23,7 @@
</div> </div>
<div class="col-7 pl-2"> <div class="col-7 pl-2">
<p class="align-middle"> <p class="align-middle">
<span class="font-weight-ultralight h3 mb-0">{{profile.username}}</span> <span class="font-weight-ultralight h3 mb-0">{{profile.username}}</span>
<span class="float-right mb-0" v-if="!loading && profile.id != user.id && user.hasOwnProperty('id')"> <span class="float-right mb-0" v-if="!loading && profile.id != user.id && user.hasOwnProperty('id')">
<a class="fas fa-cog fa-lg text-muted text-decoration-none" href="#" @click.prevent="visitorMenu"></a> <a class="fas fa-cog fa-lg text-muted text-decoration-none" href="#" @click.prevent="visitorMenu"></a>
@ -57,7 +57,7 @@
</span> </span>
<span class="pl-4"> <span class="pl-4">
<a :href="'/users/'+profile.username+'.atom'" class="fas fa-rss fa-lg text-muted text-decoration-none"></a> <a :href="'/users/'+profile.username+'.atom'" class="fas fa-rss fa-lg text-muted text-decoration-none"></a>
</span> </span>
<span class="pl-4" v-if="owner && user.hasOwnProperty('id')"> <span class="pl-4" v-if="owner && user.hasOwnProperty('id')">
<a class="fas fa-cog fa-lg text-muted text-decoration-none" href="/settings/home"></a> <a class="fas fa-cog fa-lg text-muted text-decoration-none" href="/settings/home"></a>
</span> </span>
@ -212,7 +212,7 @@
</div> </div>
</div> </div>
<div class="postPresenterContainer"> <div class="postPresenterContainer" v-on:doubletap="likeStatus(status, $event)">
<div v-if="status.pf_type === 'photo'" class="w-100"> <div v-if="status.pf_type === 'photo'" class="w-100">
<photo-presenter :status="status"></photo-presenter> <photo-presenter :status="status"></photo-presenter>
</div> </div>
@ -312,7 +312,7 @@
<div class="col-4 text-right mt-2"> <div class="col-4 text-right mt-2">
<span class="d-none d-md-inline-block pl-4"> <span class="d-none d-md-inline-block pl-4">
<a :href="'/users/'+profile.username+'.atom'" class="fas fa-rss fa-lg text-muted text-decoration-none"></a> <a :href="'/users/'+profile.username+'.atom'" class="fas fa-rss fa-lg text-muted text-decoration-none"></a>
</span> </span>
<span class="pl-md-4 pl-sm-2" v-if="owner"> <span class="pl-md-4 pl-sm-2" v-if="owner">
<a class="fas fa-cog fa-lg text-muted text-decoration-none" href="/settings/home"></a> <a class="fas fa-cog fa-lg text-muted text-decoration-none" href="/settings/home"></a>
</span> </span>
@ -983,7 +983,7 @@ export default {
if(res.data.length < 10) { if(res.data.length < 10) {
this.followerMore = false; this.followerMore = false;
} }
}) })
this.$refs.followerModal.show(); this.$refs.followerModal.show();
}, },

View file

@ -57,7 +57,7 @@
</div> </div>
</div> </div>
<div class="postPresenterContainer"> <div class="postPresenterContainer" v-on:doubletap="likeStatus(status, $event)">
<div v-if="status.pf_type === 'photo'" class="w-100"> <div v-if="status.pf_type === 'photo'" class="w-100">
<photo-presenter :status="status" v-on:lightbox="lightbox"></photo-presenter> <photo-presenter :status="status" v-on:lightbox="lightbox"></photo-presenter>
</div> </div>
@ -327,8 +327,8 @@
</div> </div>
</div> </div>
</b-modal> --> </b-modal> -->
<b-modal <b-modal
id="lightbox" id="lightbox"
ref="lightboxModal" ref="lightboxModal"
hide-header hide-header
hide-footer hide-footer
@ -660,7 +660,7 @@
if(window.confirm('Are you sure you want to delete this post?') == false) { if(window.confirm('Are you sure you want to delete this post?') == false) {
return; return;
} }
axios.post('/i/delete', { axios.post('/i/delete', {
type: 'status', type: 'status',
item: status.id item: status.id