diff --git a/playground/playgrounds.go b/playground/playgrounds.go index 2566ca5..bbba44b 100644 --- a/playground/playgrounds.go +++ b/playground/playgrounds.go @@ -75,9 +75,15 @@ func IndexHandler(w http.ResponseWriter, r *http.Request) { code = string(bytes) } + embed := false + embedArg, ok := r.URL.Query()["embed"] + if ok && "true" == embedArg[0] { + embed = true + } + model := map[string]interface{}{"conf": conf.Wide, "i18n": i18n.GetAll(locale), "locale": locale, "session": wideSession, "pathSeparator": conf.PathSeparator, "codeMirrorVer": conf.CodeMirrorVer, - "code": template.HTML(code), "ver": conf.WideVersion, "year": time.Now().Year()} + "code": template.HTML(code), "ver": conf.WideVersion, "year": time.Now().Year(), "embed": embed} wideSessions := session.WideSessions.GetByUsername(username) diff --git a/static/css/playground-embed.css b/static/css/playground-embed.css new file mode 100644 index 0000000..73871a0 --- /dev/null +++ b/static/css/playground-embed.css @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2014-2015, b3log.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +.font-ico { + font-size: 26px; +} + +.header { + margin: 0; + padding: 10px; +} + +.header .gravatar { + width: 26px; + border-radius: 13px; +} + +.header > .fn-right { + margin-top: 10px; +} + +.header .logo { + height: 36px; + margin-top: -4px; +} + +.share-panel { + position: absolute; + z-index: 20; + width: 258px; + padding: 10px 10px; + right: 0px; + line-height: normal; + top: 57px; +} + +.share-panel .font-ico { + transition: all .2s ease-out 0s; + margin: 0 5px; + width: 24px; +} + +.share-panel .font-ico:hover { + transform:rotate(360deg); +} + +#editorDiv { + width: 60%; + float: left; +} + +#output { + width: 40%; + float: right; + border-width: 0; + border-left: 1px solid #919191; +} \ No newline at end of file diff --git a/views/playground/index.html b/views/playground/index.html index dbc7c91..f87da8a 100644 --- a/views/playground/index.html +++ b/views/playground/index.html @@ -14,7 +14,7 @@ - + {{if .embed}}{{else}}{{end}}