Created
June 18, 2013 08:55
-
-
Save funivan/5803762 to your computer and use it in GitHub Desktop.
Pocket new feature
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Just add this text to bookmark panel | |
| javascript:(function () {ISRIL_SCRIPT = document.createElement('SCRIPT');ISRIL_SCRIPT.type = 'text/javascript';ISRIL_SCRIPT.src='http://localhost/Fiv/tools/saveForFun/save.js';document.getElementsByTagName('head')[0].appendChild(ISRIL_SCRIPT)})(); | |
| // Next content save to http://localhost/Fiv/tools/saveForFun/save.js | |
| // | |
| $(document).ready(function () { | |
| var getSimpleHtml = function (el) { | |
| var items = el.find('*').addBack(); | |
| items.find(":hidden").remove(); | |
| items.map(function (i, element) { | |
| element.removeAttribute('style'); | |
| if (element.hasAttribute('src')) { | |
| element.setAttribute('src', element.src); | |
| } | |
| }); | |
| return el[0].outerHTML; | |
| } | |
| var elements = $('body *'); | |
| elements.unbind(); | |
| $('a').click(function () { | |
| alert(123); | |
| return false; | |
| }); | |
| elements.mousedown(function (event) { | |
| var tags = prompt("Please enter tags. Seperated by comma"); | |
| var el = $(this); | |
| el.css('outline', 'none'); | |
| var html = getSimpleHtml(el); | |
| $('<form>', { | |
| "html": '<input type="text" name="tags" value="' + tags + '"/><textarea type="hidden" name="html">' + html + '</textarea>', | |
| "action": 'http://localhost/Fiv/tools/saveForFun/save.php', // change url for your own | |
| 'method': 'POST' | |
| }).appendTo(document.body).submit(); | |
| event.stopPropagation(); | |
| return false; | |
| }); | |
| elements.on('mouseover mouseout', function (event) { | |
| if (event.type == 'mouseover') { | |
| $(this).css('outline', '5px solid #dfdfdf'); | |
| } else { | |
| $(this).css('outline', 'none'); | |
| } | |
| return false; | |
| }); | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment