").addClass("terminal-output").attr("role","log").appendTo(Ve);ue.addClass("terminal");if(je.login&&M("onBeforeLogin")===false){qe=false}var Ze;if(typeof e==="string"){Ze=e}else if(is_array(e)){for(var et=0,tt=e.length;et
',{raw:true})}function u(e){var t=window.URL||window.webkitURL;return t.createObjectURL(e)}function a(e,t){if(!t){var n={target:ue};if(typeof e==="string"){n.text=e}else if(e instanceof Blob){n.image=u(e)}var r=M("onPaste",[n]);if(r){if(is_function(r.then||r.done)){return(r.then||r.done).call(r,function(e){a(e,true)})}else{a(r,true)}}else if(r!==false){a(n.image||n.text,true)}}else if(e instanceof Blob){i(u(e))}else if(typeof e==="string"){if(e.match(/^(data:|blob:)/)){i(e)}else{ue.insert(e)}}}if(e.clipboardData){if(ue.enabled()){var n=e.clipboardData.items;if(n){for(var r=0;r
").appendTo(Ve).cmd({tabindex:je.tabindex,mobileDelete:je.mobileDelete,mobileIngoreAutoSpace:je.mobileIngoreAutoSpace,prompt:nt?false:t,history:je.memory?"memory":je.history,historyFilter:je.historyFilter,historySize:je.historySize,caseSensitiveSearch:je.caseSensitiveSearch,onPaste:je.onPaste,width:"100%",enabled:false,charWidth:Oe.width,keydown:V,keymap:st,clickTimeout:je.clickTimeout,holdTimeout:je.holdTimeout,holdRepeatTimeout:je.holdRepeatTimeout,repeatTimeoutKeys:je.repeatTimeoutKeys,allowedAttributes:je.allowedAttributes,keypress:G,tabs:je.tabs,onPositionChange:function(){var e=[].slice.call(arguments);W();M("onPositionChange",e)},onCommandChange:function(e){if(Te!==Xe.width()){ue.resizer()}M("onCommandChange",[e]);W()},commands:L});function n(e){if(is_mobile){return}e=e.originalEvent;if(e){var t=document.elementFromPoint(e.clientX,e.clientY);if(!$(t).closest(".terminal").length&&ue.enabled()){ue.disable()}}}ue.oneTime(100,function(){$(document).bind("click.terminal_"+ue.id(),n).bind("contextmenu.terminal_"+ue.id(),n)});var r=$(window);document.addEventListener("resume",function(){ue.disable()});if(is_mobile){(function(){ue.addClass("terminal-mobile");var i;var u;var n;var a=3;var e=Ke.clip();var r=200;var o;e.$node.off("touchstart.cmd");ue.on("touchstart.terminal",function(e){e=e.originalEvent;window.touch_event=e;if(e.target.tagName.toLowerCase()==="a"){return}if(!He&&e.touches.length===1){n=ue.enabled();var t=e.touches[0];i={x:t.clientX,y:t.clientY};o=setTimeout(function(){i=null},r)}}).on("touchmove.terminal",function(e){if(e.touches.length===1&&i){var t=e.touches[0];var n=Math.abs(t.clientX-i.x);var r=Math.abs(t.clientY-i.y);if(n>a||r>a){u=true}}}).on("touchend.terminal",function(){if(i){clearTimeout(o);if(!u){if(!n){e.focus();ue.focus()}else{e.blur();ue.disable()}}}u=false;i=null})})()}else{r.on("focus.terminal_"+ue.id(),rt).on("blur.terminal_"+ue.id(),it);var h;(function(){var t=0;var n;var r="click_"+ue.id();var i=ue.find(".cmd textarea");function u(){if(n.is(".terminal")||n.is(".terminal-wrapper")){var e=ue.get_command().length;ue.set_position(e)}else if(n.closest(".cmd-prompt").length){ue.set_position(0)}if(!i.is(":focus")){i.focus()}a()}function a(){t=0;n=null}var o=".terminal-output textarea,"+".terminal-output input";ue.mousedown(function(e){if(!scrollbar_event(e,Xe)){n=$(e.target)}}).mouseup(function(){if(h){h=false;return}if(n&&n.closest(o).length){if(Me){ue.disable()}}else if(get_selected_html()===""&&n){if(++t===1){if(!He){if(!Me){ue.focus();ue.scroll_to_bottom()}else{var e=je.clickTimeout;ue.oneTime(e,r,u);return}}}else{ue.stopTime(r)}}a()}).dblclick(function(){a();ue.stopTime(r)})})();(function(){var m=Ke.clip().$node;function d(e){return e.type==="mousedown"&&e.buttons===2||e.type==="contextmenu"}var e;if("oncontextmenu"in window){e="contextmenu.terminal"}else{e="mousedown.terminal"}ue.on(e,function(e){h=get_selected_html()===""&&d(e);if(h){var t=$(e.target);if(t.is("img,value,audio,object,canvas,a")){return}if(!ue.enabled()){ue.enable()}var n=Ke.offset();var r=Ke[0].getBoundingClientRect();var i=ue.offset();var u=i.top-n.top;var a=Math.max(e.pageY-n.top-20,u);var o=e.pageX-n.left-20;var s=4*14;var l=5*14;var f=ue[0].getBoundingClientRect();var c=Xe.outerWidth();var p=a+r.top+s;p=p-f.height-f.top;var D=o+r.left+l;D=D-c-f.left;if(p>0){s-=Math.ceil(p)}if(D>0){l-=Math.ceil(D)}m.attr("style",["left:"+o+"px !important","top:"+a+"px !important","width:"+l+"px !important","height:"+s+"px !important"].join(";"));if(!m.is(":focus")){m.focus()}ue.stopTime("textarea");ue.oneTime(100,"textarea",function(){var e={left:"",top:"",width:"",height:""};if(!is_css_variables_supported){var t=ue.find(".cmd .cmd-cursor-line").prevUntil(".cmd-prompt").length;e.top=t*14+"px"}m.css(e)});ue.stopTime("selection");ue.everyTime(20,"selection",function(){if(m[0].selection!==m[0].value){if(get_textarea_selection(m[0])){clear_textarea_selection(m[0]);select(ue.find(".terminal-output")[0],ue.find(".cmd div:last-of-type")[0]);ue.stopTime("selection")}}})}})})();ue.on("scroll",function(){var e=ue.find("textarea");var t=ue[0].getBoundingClientRect();var n=ue[0].scrollHeight;var r=ue.scrollTop();var i=n-(r+t.height);if(i===0){e.css("top","")}else{e.css("top",-i)}})}ue.on("click","a",function(e){var t=$(this);if(t.closest(".terminal-exception").length){var n=t.attr("href");if(n.match(/:[0-9]+$/)){e.preventDefault();D(n,ue.cols())}}if(Me){ue.find(".cmd textarea").focus()}});function i(){var e=Oe.width;Oe=get_char_size(ue);if(e!==Oe.width){Ke.option("charWidth",Oe.width).refresh()}}u();function u(){if(ue.is(":visible")){var e=Xe.width();var t=Xe.height();if(Le){Le=!terminal_ready(ue);i()}if(Se!==t||Te!==e){ue.resize()}Se=t;Te=e}}function a(){var e={prefix:"terminal-"};ue.resizer("unbind").resizer(u,e);Ge.resizer("unbind").resizer(function(){i();ue.resize()},e)}function o(e){$e=e[0].intersectionRatio===1}function s(){if(window.IntersectionObserver){var e=$('
').appendTo(ue);var t=e;if(je.scrollBottomOffset!==-1){t=$("
").css({height:je.scrollBottomOffset}).appendTo(e)}ke=new IntersectionObserver(o,{root:ue[0]});ke.observe(t[0])}}s();if(ue.is(":visible")){a()}function l(){if(Qe){if(Qe.unobserve){Qe.unobserve(ue[0])}else{clearInterval(Qe)}}var e=ue.enabled();var t=ue.is(":visible");if(e&&!t){ue.disable()}if(t){a()}else{Ve.css("visibility","hidden")}function n(){if(ue.is(":visible")&&!t){t=true;a();i();u();if(e){ue.enable()}Ve.css("visibility","")}else if(t&&!ue.is(":visible")){t=false;e=$.terminal.active()===ue&&ue.enabled();ue.disable();Ve.css("visibility","hidden")}}if(window.IntersectionObserver&&ue.css("position")!=="fixed"){Qe=new IntersectionObserver(n,{root:null});Qe.observe(ue[0])}else{Qe=setInterval(n,100)}}var f=!!ue.closest("body").length;var c=window.MutationObserver||window.WebKitMutationObserver;if(c){Ye=new c(function(){if(ue.closest("body").length){if(!f){ue.scroll_to_bottom();l();u()}f=true}else if(f){f=false}});Ye.observe(document.body,{childList:true})}if(f){l()}Ce.resolve();if(Me&&ue.is(":visible")&&!is_mobile){ue.focus(undefined,true)}else{ue.disable()}if(is_function(nt)){ue.login(nt,true,K)}else{K()}function p(e,t){var n=terminals.get()[e[0]];var r=$.Deferred();if(n&&he===n.id()){if(!e[2]){r.resolve();return r.promise()}else if(We){O.push(function(){return n.exec(e[2],t).done(function(){n.save_state(e[2],true,e[1]);r.resolve()})});return r.promise()}else{return n.exec(e[2],t).done(function(){n.save_state(e[2],true,e[1])})}}}if(je.execHash){if(location.hash){setTimeout(function(){try{var e=location.hash.replace(/^#/,"");hash_commands=JSON.parse(decodeURIComponent(e));if(!e.match(/\[/)){q(hash_commands)}var n=0;var r={typing:je.execAnimation,delay:je.execAnimationDelay};(function e(){var t=hash_commands[n++];if(t){p(t,r).done(e)}else{change_hash=true}})()}catch(e){}})}else{change_hash=true}}else{change_hash=true}(function(){var i=false;$(document).bind("keydown.terminal_"+ue.id(),function(e){if(e.shiftKey){i=true}}).bind("keyup.terminal_"+ue.id(),function(e){if(e.shiftKey||e.which===16){i=false}});function n(e,t){if(!i){var n=Ue.top();var r;if(is_function(n.mousewheel)){r=n.mousewheel(e,t,ue)}else if(is_function(je.mousewheel)){r=je.mousewheel(e,t,ue)}if(r===true){return}if((B()||r===false)&&!e.ctrlKey){e.stopPropagation();e.preventDefault()}if(r===false){return false}if(t>0){ue.scroll(-40)}else{ue.scroll(40)}}}if($.event.special.mousewheel){ue.on("mousewheel",n)}else{var r;var e=document.createElement("div");if("onwheel"in e){r="wheel"}else if(document.onmousewheel!==undefined){r="mousewheel"}else{r="DOMMouseScroll"}e=null;ue.on(r,function(e){var t;if(r==="mousewheel"){t=-1/40*e.originalEvent.wheelDelta}else{t=e.originalEvent.deltaY||e.originalEvent.detail}n(e,-t)})}ue.touch_scroll(function(e){var t=e.current.clientY-e.previous.clientY;var n;var r=Ue.top();if(is_function(r.touchscroll)){n=r.touchscroll(e,t,ue)}else if(is_function(je.touchscroll)){n=je.touchscroll(e,t,ue)}css(ue[0],{"--terminal-scroll":ue.prop("scrollTop")});if(n===true){return}return false})})()});return ue}});
47 | //# sourceMappingURL=jquery.terminal.min.js.map
--------------------------------------------------------------------------------
/img/colabshell.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/singhsidhukuldeep/Google-Colab-Shell/2e1b1e68e20f688c29de151cb5f5635b9b13b2b4/img/colabshell.PNG
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | # !/usr/bin/env python3
2 | # coding:utf-8
3 | """
4 | Name : setup.py
5 | Author : Kuldeep Singh Sidhu
6 | GitHub : https://github.com/singhsidhukuldeep
7 | Description: Used to setup and publish
8 | """
9 |
10 | from setuptools import setup, find_packages
11 |
12 | classifiers = [
13 | "Development Status :: 5 - Production/Stable",
14 | "Intended Audience :: Education",
15 | "Programming Language :: Python :: 3",
16 | "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
17 | "Programming Language :: Python",
18 | ]
19 |
20 | setup(
21 | name="google-colab-shell",
22 | version="0.2",
23 | description="An efficent python package to launch terminal in Google Colab",
24 | long_description=open("README.md").read()
25 | + "\n\n"
26 | + open("CHANGELOG.md").read()
27 | + "\n\nRead more at https://github.com/singhsidhukuldeep/Google-Colab-Shell",
28 | long_description_content_type="text/markdown",
29 | url="https://github.com/singhsidhukuldeep/Google-Colab-Shell",
30 | author="Kuldeep Singh Sidhu",
31 | author_email="singhsidhukuldeep@gmail.com",
32 | classifiers=classifiers,
33 | keywords="Google Colab Shell Terminal",
34 | packages=find_packages(),
35 | install_requires=[],
36 | zip_safe=False,
37 | )
--------------------------------------------------------------------------------