diff --git a/lib/user.js b/lib/user.js index 37fb5d28..ed0a8e3a 100644 --- a/lib/user.js +++ b/lib/user.js @@ -28,6 +28,7 @@ Volcanos("user", {help: "用户操作", agent: { isExtension: location && location.protocol && location.protocol == "chrome-extension:", isLocalFile: location && location.protocol && location.protocol == "file:", isLandscape: function() { return window.innerWidth > window.innerHeight }, + isPortrait: function() { return window.innerWidth < window.innerHeight }, mod: { isPod: location && location.pathname && (location.pathname.indexOf("/chat/pod/") == 0 || location.pathname.indexOf("/x/") == 0), isDiv: location && location.pathname && (location.pathname.indexOf("/chat/div/") == 0), diff --git a/plugin/local/wiki/word.js b/plugin/local/wiki/word.js index b2f294bd..2e73d9ff 100644 --- a/plugin/local/wiki/word.js +++ b/plugin/local/wiki/word.js @@ -1,14 +1,27 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, cb, target) { + can.onmotion.clear(can), can.base.isFunc(cb) && cb(msg) if (msg.Length() > 0) { return can.onappend.table(can, msg) } can.page.Modify(can, target, msg.Result()) can.page.Select(can, target, wiki.ITEM, function(item) { var data = item.dataset||{} - can.core.CallFunc([can.onimport, data.type], [can, data, item]) can.page.Modify(can, item, {style: can.base.Obj(data.style)}) - can.page.style(can, item, html.MAX_WIDTH, can.ConfWidth()-(can.user.isWindows? 40: 30)) + can.core.CallFunc([can.onimport, data.type], [can, data, item]) + // can.page.style(can, item, html.MAX_WIDTH, can.ConfWidth()-(can.user.isWindows? 40: 30)) }) }, + image: function(can, data, target) { + can.page.style(can, target, html.MAX_HEIGHT, can.ConfHeight()/2, html.MAX_WIDTH, can.ConfWidth()) + + // if (can.user.isMobile) { + if (can.user.isLandscape()) { + } else{ + can.page.style(can, target, html.MAX_HEIGHT, can.ConfHeight(), html.MAX_WIDTH, can.ConfWidth()) + } + // return + // } + // can.page.style(can, target, html.MAX_HEIGHT, can.ConfHeight()/4) + }, navmenu: function(can, data, target) { var nav = can.sup._navmenu nav = nav||can.page.Append(can, can._fields, [{view: wiki.NAVMENU}]).first can.onmotion.clear(can, nav), can._fields.insertBefore(nav, can._output)