git ssb

16+

Dominic / patchbay



Commit 3c2247fb3d903ae61e79bc60acac7876c3370fa4

add mcss pattern to blob module

mix irving committed on 1/13/2017, 10:59:56 PM
Parent: 449d051990b8d8149dd2a3bb9078e269533e324e

Files changed

modules_core/blob-url.jschanged
modules_extra/blob.jschanged
modules_extra/blob.mcssadded
modules_core/blob-url.jsView
@@ -1,10 +1,10 @@
11 var config = require('../config')
22
33 module.exports = {
44 gives: 'blob_url',
5- create: function () {
6- return function (link) {
5 + create: () => {
6 + return link => {
77 if('string' == typeof link.link)
88 link = link.link
99 return config().blobsUrl + '/'+link
1010 }
modules_extra/blob.jsView
@@ -1,27 +1,31 @@
1-var h = require('hyperscript')
2-var ref = require('ssb-ref')
1 +const fs = require('fs')
2 +const h = require('../h')
3 +const ref = require('ssb-ref')
34
4-exports.gives = 'screen_view'
5-
65 exports.needs = {
76 blob_url: 'first'
87 }
98
10-exports.create = function (api) {
11- return function (path) {
12- if(ref.isBlob(path)) return blob_view(path)
9 +exports.gives = {
10 + 'screen_view': true,
11 + 'mcss': true
12 +}
13 +
14 +exports.create = (api) => {
15 + return {
16 + screen_view,
17 + mcss: () => fs.readFileSync(__filename.replace(/js$/, 'mcss'), 'utf8')
1318 }
1419
15- function blob_view(id) {
16- return h('iframe', {
17- src: api.blob_url(id),
18- sandbox: '',
19- style: {
20- position: 'absolute',
21- width: '100%',
22- height: '100%',
23- border: 0,
24- }
25- })
20 + function screen_view (path) {
21 + if(!ref.isBlob(path)) return
22 +
23 + return h('Blob', [
24 + h('iframe', {
25 + src: api.blob_url(path),
26 + sandbox: ''
27 + })
28 + ])
2629 }
2730 }
31 +
modules_extra/blob.mcssView
@@ -1,0 +1,9 @@
1 +Blob {
2 + iframe {
3 + position: absolute
4 + width: 100%
5 + height: 100%
6 + border: 0
7 + }
8 +}
9 +

Built with git-ssb-web