Skip to content

fix for using of external jquery #6

@alexbodn

Description

@alexbodn

hello friends,

i made a couple fixes to allow usage of jquery from google apis,
even versions not supplied with the widget.

diff --git a/tw2/jquery/base.py b/tw2/jquery/base.py
index 69bf8b4..535ebb3 100644
--- a/tw2/jquery/base.py
+++ b/tw2/jquery/base.py
@@ -54,3 +54,4 @@ class jQueryPluginCSSLink(jQueryPluginLinkMixin, CSSLink):
 
 jquery_js = jQueryJSLink()
 jQuery = js_function('jQuery')
+
diff --git a/tw2/jquery/version.py b/tw2/jquery/version.py
index 83334c5..6f291d4 100644
--- a/tw2/jquery/version.py
+++ b/tw2/jquery/version.py
@@ -81,8 +81,9 @@ class JSLinkMixin(Link):
                     'static',
                     self.dirname,
                     self.core_filename
-                ))).replace('//', '/')
-            self._link = link
+                )))
+            self._link = '://'.join([
+                part.replace('//', '/')  for part in link.split('://')])
         return self._link % self.substitutions
 
     def _set_link(self, link):
@@ -97,6 +98,8 @@ class JSLinkMixin(Link):
         ))
 
     def try_filename(self, filename):
+        if self.is_external:
+            return filename
         abspath = self.abspath(filename)
         if os.path.exists(abspath):
             return filename

please patch and enjoy

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions