Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Murray Roke 503 posts 966 karma points c-trib
    Mar 07, 2012 @ 01:57
    Murray Roke
    1

    BackOfficePowerScripts nuggets

    Hi everyone, if you're using the fabulous BackOfficePowerScripts package from lee kelleher, and you've got some cool scripts to share, put them here :-)

  • Murray Roke 503 posts 966 karma points c-trib
    Mar 07, 2012 @ 02:03
    Murray Roke
    1

    I'll kick off with one of mine, this one makes the 'Label' datatype full width, so you can put lots of text into the Name and Description, and it won't confine it to the left column width.

    config:

    <add path="~/scripts/terabyte.big-label.js" targets="editContent.aspx" />

    ~/scripts/terabyte.big-label.js

           
        $("div.propertyItemheader").filter(function () {
                return ($(this).next().children().length == 1 && $(this).next().find('span:empty').length == 1); 
            })
                .width("100%")
                .next().remove();
    
  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Mar 08, 2012 @ 12:07
    Lee Kelleher
    3

    Here's a good one... Sisyphus.js - saves form data to LocalStorage to restore them after browser crashes, tabs closings and other disasters.

    <add path="~/scripts/sisyphus-loader.js" targets="editContent.aspx" />

    The loader script pulls in the Sisyphus.js library from GitHub directly, (you could/should probably keep this local too) ...

    $(function () {
        $('#body_TabView1_tab01layer_menu_slh').append('<div class="sisyphusLoader" style="display:none;float:right;"><img title="loading" class="editorIcon" src="../umbraco_client/images/progressbar.gif" alt="loading"></div>');
        var $loader = $('.sisyphusLoader');
        $.getScript('https://raw.github.com/simsalabim/sisyphus/master/sisyphus.js', function (data, textStatus) {
            $('#form1').sisyphus({
                timeout: 0,
                onSave: function () {
                    if ($loader.is(':hidden')) {
                        $loader.fadeIn('fast');
                        setTimeout(function () {
                            $loader.fadeOut('fast');
                        }, 250);
                    }
                },
                excludeFields: $('#__EVENTTARGET,#__EVENTARGUMENT,#__VIEWSTATE')
            });
        });
    });

    ... whenever you edit a form field (in "editContent.aspx"), the data/value is stored in your LocalStorage.  Think of it as a pre-save! ;-)

    Cheers, Lee.

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Mar 08, 2012 @ 12:22
    Lee Kelleher
    1

    Another quick one is to set a custom favicon.ico for the back-office.

    <add path="~/scripts/custom-favicon.js" targets="umbraco.aspx" />
    (function (d, id, src) {
        if (d.getElementById(id)) { return; }
        var l, h = d.getElementsByTagName('head')[0];
        l = d.createElement('link'); l.id = id; l.type = 'image/x-icon'; l.rel = 'shortcut icon'; l.href = src;
        h.appendChild(l);
    } (document, 'favicon', '/umbraco/images/aboutNew.png'));

    Cheers, Lee.

  • Pavel Budik 12 posts 71 karma points c-trib
    Jul 10, 2012 @ 14:50
    Pavel Budik
    0

    Icon next to the General properties tab to open the current page in frontend:

     $(document).ready(function () {
        /// <summary>show icon to open page</summary>
        
        // find links property
        var linksTitle = $("div.propertyItemheader:contains('" + UmbClientMgr.uiKeys()["content_urls"] + "')");
        var links = linksTitle.next().children("a");
    
        // find the right link
        var url = "";
        var isDev = false;
        for (var i = 0; i < links.length; i++) {
            if (i == 0)
                url = links[i].href;
    
            // some conditions which URL to use
        }
    
        // find tabs UL
        var settingsTab = $("nobr:contains('" + UmbClientMgr.uiKeys()["general_properties"] + "')");
        var headerTabsUl = settingsTab.parents("ul");
        headerTabsUl.append("<li style=\"cursor:pointer; margin-left:15px\" onclick=\"window.open('" + url + "')\">" +
                    "<img src=\"/umbraco/plugins/BackOfficePowerScripts/scripts/nw.png\" width=\"16\" height=\"16\" " +
                    "alt=\"Open page\" title=\"Open page\"/></li>");
    });
Please Sign in or register to post replies

Write your reply to:

Draft