* Disaru Allright, this is my first share code. Sorry if it looks like a mess :D

This script will add a floating admin bar on your xtgem wapsite. The main objective for this script is to make easier to manage your xtblog by adding quick shortcut to edit the viewed blog post.

This script is from Mr. Graham, I only made little modification here.

1. The main code, place in your _footer file:
# Start configuration
var $admin_hash= YOUR_BLOG_ID
var $key = 1234
get admkey
if $admkey != $key
goto @end_qedit
# End configuration
var $site= <xt:url type="domain"/>
var $path=<xt:url type="path" urlencode="yes"/>
print <div id="admin-bar" style="position:fixed;top:30px;right:0;max-width:100%;overflow:hidden;opacity:0.9;padding:0 10px;background:#333;color:#fff"><div class="btn-group btn-group-xs pull-left">;
get __xtblog_entry
if $__xtblog_entry
print <a class="btn btn-default" href="http://xtgem.com/blog/entry/edit?entry_id=$__xtblog_entry&blog_id=$admin_hash&file=$path" target="xtgem">Edit Post</a><a class="btn btn-default" href="http://xtgem.com/blog/entry/add?blog_id=$admin_hash&type=1&file=$path" target="xtgem">New Post</a>
print <a class="btn btn-default" href="http://xtgem.com/creator/edit_file?file=$path" target="xtgem">Building Tool</a><a class="btn btn-default" href="http://xtgem.com/filebrowser/file_edit?file=$path" target="xtgem">Text Editor</a><a class="btn btn-default login" href="http://xtgem.com/account/site_login?site=$site" target="xtgem"><b>[LOGIN]</b></a><hr/><span style="color:#ccc">Switch version:</span> <a class="btn btn-default" href="http://xtgem.com/template/confirm?t=touch" target="xtgem">Touch</a><a class="btn btn-default" href="http://xtgem.com/template/confirm?t=mobile" target="xtgem">Mobile</a><a class="btn btn-default" href="http://xtgem.com/template/confirm?t=web" target="xtgem">Web</a></div></div>;

Copy code

Replace "YOUR_BLOG_ID" with your blog id.

2. The CSS code, add it to your CSS code or simply copy to your _headtags file
#admin-bar a, #admin-bar span {padding:10px;color:#fff;display:inline-block}
#admin-bar a:hover, #admin-bar a:active {background:#efefef;color:#333}
#admin-bar .login {color:lightgreen}
#admin-bar hr {padding:0 !important;margin:5px 0 !important}

Copy code

With the default value above, you can call the admin bar by adding admkey=1234 parameter in the url, then visit the link.

Example you are viewing your blog post which has url: http://mysite.xtgem.com/index/__xtblog_entry/123456-aaa-bbb-ccc?__xtblog_block_id=1#xt_blog.

Then edit the link to http://mysite.xtgem.com/index/__xtblog_entry/123456-aaa-bbb-ccc?admkey=1234&__xtblog_block_id=1#xt_blog - Then visit the link to call the admin bar...

You can change the parameter name (admkey) and value (1234) as you want.

Note: The script is only work if we are logged in to the site on Touch/mobile version.
The admin bar provide link to log in to your current viewed site, if you click it and it NOT showing error, it means you are logged in. Make sure to always click [LOGIN] before you edit post or create new post!

If you are using desktop/PC, the admin bar also provide link to swith version to Touch.

Q: How to get my blog id?
A: Login to your site on Touch/mobile version. Go to your xtblog block in file browser, and copy the link on "New Post" link. You will get something like "http://xtgem.com/blog/entry/add?blog_id=XXXXXXXXXXXXXXXXXX=&file=index"

Tested and working smoothly on my Windows tablet using Firefox Browser.

Donate: You can send me donuts or coffee to my Paypal: sarumpaetd@gmail.com - Thanks :D

Special thanks to:
Mr. Graham for the script and the guide
All readers

For update of this script, please visit my blog: https://weblogwap.blogspot.com/2018/04/xtqadminbar-v-1-quick-admin-bar-script.html
2018-04-10 06:14
* *
* Screen Shot 2018-04-10-21.37.58.png · image/png · 32.65KB
* Screenshot_2018-04-10_213825.jpg · image/jpeg · 122.4KB
(edited 2018-04-14 21:39 by Disaru ) · (0)

Online: Guests: 1